/[cmucl]/src/lisp/hppa-assem.S
ViewVC logotype

Contents of /src/lisp/hppa-assem.S

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.14 - (show annotations)
Fri Aug 23 17:05:35 2002 UTC (11 years, 7 months ago) by pmai
Branch: MAIN
CVS Tags: sparc-tramp-assem-base, double-double-array-base, post-merge-intl-branch, release-19b-pre1, release-19b-pre2, merged-unicode-utf16-extfmt-2009-06-11, double-double-init-sparc-2, unicode-utf16-extfmt-2009-03-27, double-double-base, snapshot-2007-09, snapshot-2007-08, snapshot-2008-08, snapshot-2008-09, sse2-packed-2008-11-12, snapshot-2008-05, snapshot-2008-06, snapshot-2008-07, snapshot-2007-05, snapshot-2008-01, snapshot-2008-02, snapshot-2008-03, intl-branch-working-2010-02-19-1000, snapshot-2006-11, snapshot-2006-10, double-double-init-sparc, snapshot-2006-12, unicode-string-buffer-impl-base, sse2-base, release-20b-pre1, release-20b-pre2, unicode-string-buffer-base, sse2-packed-base, sparc-tramp-assem-2010-07-19, amd64-dd-start, snapshot-2003-10, snapshot-2004-10, release-18e-base, release-19f-pre1, snapshot-2008-12, snapshot-2008-11, intl-2-branch-base, snapshot-2004-08, snapshot-2004-09, remove_negative_zero_not_zero, snapshot-2007-01, snapshot-2007-02, snapshot-2004-05, snapshot-2004-06, snapshot-2004-07, release-19e, release-19d, GIT-CONVERSION, double-double-init-ppc, release-19c, dynamic-extent-base, unicode-utf16-sync-2008-12, LINKAGE_TABLE, release-19c-base, cross-sol-x86-merged, label-2009-03-16, release-19f-base, PRE_LINKAGE_TABLE, merge-sse2-packed, mod-arith-base, sparc_gencgc_merge, merge-with-19f, snapshot-2004-12, snapshot-2004-11, intl-branch-working-2010-02-11-1000, unicode-snapshot-2009-05, unicode-snapshot-2009-06, amd64-merge-start, double-double-init-%make-sparc, unicode-utf16-sync-2008-07, release-18e-pre2, unicode-utf16-sync-2008-09, unicode-utf16-extfmts-sync-2008-12, prm-before-macosx-merge-tag, cold-pcl-base, RELEASE_20b, snapshot-2008-04, snapshot-2003-11, snapshot-2005-07, unicode-utf16-sync-label-2009-03-16, RELEASE_19f, snapshot-2007-03, release-20a-base, cross-sol-x86-base, unicode-utf16-char-support-2009-03-26, unicode-utf16-char-support-2009-03-25, release-19a-base, unicode-utf16-extfmts-pre-sync-2008-11, snapshot-2008-10, sparc_gencgc, snapshot-2007-04, snapshot-2010-12, snapshot-2010-11, unicode-utf16-sync-2008-11, snapshot-2007-07, snapshot-2011-09, snapshot-2011-06, snapshot-2011-07, snapshot-2011-04, snapshot-2007-06, snapshot-2011-02, snapshot-2011-03, snapshot-2011-01, snapshot-2003-12, release-19a-pre1, release-19a-pre3, release-19a-pre2, pre-merge-intl-branch, release-19a, UNICODE-BASE, double-double-array-checkpoint, double-double-reader-checkpoint-1, release-19d-base, release-19e-pre1, double-double-irrat-end, release-19e-pre2, snapshot-2010-05, snapshot-2010-04, snapshot-2010-07, snapshot-2010-06, snapshot-2010-01, snapshot-2010-03, snapshot-2010-02, release-19d-pre2, release-19d-pre1, snapshot-2010-08, release-18e, double-double-init-checkpoint-1, double-double-reader-base, label-2009-03-25, snapshot-2005-03, release-19b-base, cross-sol-x86-2010-12-20, double-double-init-x86, sse2-checkpoint-2008-10-01, intl-branch-2010-03-18-1300, snapshot-2005-11, double-double-sparc-checkpoint-1, snapshot-2004-04, sse2-merge-with-2008-11, sse2-merge-with-2008-10, snapshot-2005-10, RELEASE_20a, snapshot-2005-12, release-20a-pre1, snapshot-2005-01, snapshot-2009-11, snapshot-2009-12, unicode-utf16-extfmt-2009-06-11, portable-clx-import-2009-06-16, unicode-utf16-string-support, release-19c-pre1, cross-sparc-branch-base, release-19e-base, intl-branch-base, double-double-irrat-start, snapshot-2005-06, snapshot-2005-05, snapshot-2005-04, ppc_gencgc_snap_2005-05-14, snapshot-2005-02, unicode-utf16-base, portable-clx-base, snapshot-2005-09, snapshot-2005-08, lisp-executable-base, snapshot-2009-08, snapshot-2007-12, snapshot-2007-10, snapshot-2007-11, snapshot-2009-02, snapshot-2009-01, snapshot-2009-07, snapshot-2009-05, snapshot-2009-04, snapshot-2006-02, snapshot-2006-03, release-18e-pre1, snapshot-2006-01, snapshot-2006-06, snapshot-2006-07, snapshot-2006-04, snapshot-2006-05, pre-telent-clx, snapshot-2006-08, snapshot-2006-09, HEAD
Branch point for: release-19b-branch, double-double-reader-branch, double-double-array-branch, mod-arith-branch, RELEASE-19F-BRANCH, portable-clx-branch, sparc_gencgc_branch, cross-sparc-branch, RELEASE-20B-BRANCH, unicode-string-buffer-branch, sparc-tramp-assem-branch, dynamic-extent, UNICODE-BRANCH, release-19d-branch, ppc_gencgc_branch, sse2-packed-branch, lisp-executable, RELEASE-20A-BRANCH, amd64-dd-branch, double-double-branch, unicode-string-buffer-impl-branch, intl-branch, release-18e-branch, cold-pcl, unicode-utf16-branch, cross-sol-x86-branch, release-19e-branch, sse2-branch, release-19a-branch, release-19c-branch, intl-2-branch, unicode-utf16-extfmt-branch
Changes since 1.13: +2 -3 lines
Fixed suspected bug on HPPA, as confirmed by Christophe Rhodes.
1 #define LANGUAGE_ASSEMBLY
2
3 #include "internals.h"
4 #include "lispregs.h"
5
6 .import $global$,data
7 .import foreign_function_call_active,data
8 .import current_control_stack_pointer,data
9 .import current_control_frame_pointer,data
10 .import current_binding_stack_pointer,data
11 .import current_dynamic_space_free_pointer,data
12
13 .space $TEXT$
14 .subspa $CODE$
15 .import $$dyncall,MILLICODE
16
17
18 /*
19 * Call-into-lisp
20 */
21
22 .export call_into_lisp
23 call_into_lisp
24 .proc
25 .callinfo entry_gr=18,save_rp
26 .entry
27 /* %arg0=function, %arg1=cfp, %arg2=nargs */
28
29 stw %rp,-0x14(%sr0,%sp)
30 stwm %r3,0x40(%sr0,%sp)
31 stw %r4,-0x3c(%sr0,%sp)
32 stw %r5,-0x38(%sr0,%sp)
33 stw %r6,-0x34(%sr0,%sp)
34 stw %r7,-0x30(%sr0,%sp)
35 stw %r8,-0x2c(%sr0,%sp)
36 stw %r9,-0x28(%sr0,%sp)
37 stw %r10,-0x24(%sr0,%sp)
38 stw %r11,-0x20(%sr0,%sp)
39 stw %r12,-0x1c(%sr0,%sp)
40 stw %r13,-0x18(%sr0,%sp)
41 stw %r14,-0x14(%sr0,%sp)
42 stw %r15,-0x10(%sr0,%sp)
43 stw %r16,-0xc(%sr0,%sp)
44 stw %r17,-0x8(%sr0,%sp)
45 stw %r18,-0x4(%sr0,%sp)
46
47 /* Clear the descriptor regs, moving in args as approporate. */
48 copy %r0,reg_CODE
49 copy %r0,reg_FDEFN
50 copy %arg0,reg_LEXENV
51 zdep %arg2,29,30,reg_NARGS
52 copy %r0,reg_OCFP
53 copy %r0,reg_LRA
54 copy %r0,reg_A0
55 copy %r0,reg_A1
56 copy %r0,reg_A2
57 copy %r0,reg_A3
58 copy %r0,reg_A4
59 copy %r0,reg_A5
60 copy %r0,reg_L0
61 copy %r0,reg_L1
62 copy %r0,reg_L2
63
64 /* Establish NIL. */
65 ldil L%NIL,reg_NULL
66 ldo R%NIL(reg_NULL),reg_NULL
67
68 /* Turn on pseudo-atomic. */
69 ldo 4(%r0),reg_ALLOC
70
71 /* No longer in foreign function call land. */
72 addil L%foreign_function_call_active-$global$,%dp
73 stw %r0,R%foreign_function_call_active-$global$(0,%r1)
74
75 /* Load lisp state. */
76 addil L%current_dynamic_space_free_pointer-$global$,%dp
77 ldw R%current_dynamic_space_free_pointer-$global$(0,%r1),%r1
78 add reg_ALLOC,%r1,reg_ALLOC
79 addil L%current_binding_stack_pointer-$global$,%dp
80 ldw R%current_binding_stack_pointer-$global$(0,%r1),reg_BSP
81 addil L%current_control_stack_pointer-$global$,%dp
82 ldw R%current_control_stack_pointer-$global$(0,%r1),reg_CSP
83 addil L%current_control_frame_pointer-$global$,dp
84 ldw R%current_control_frame_pointer-$global$(0,%r1),reg_OCFP
85 copy %arg1,reg_CFP
86
87 /* End of pseudo-atomic. */
88 addit,od -4,reg_ALLOC,reg_ALLOC
89
90 /* Establish lisp arguments. */
91 ldw 0(reg_CFP),reg_A0
92 ldw 4(reg_CFP),reg_A1
93 ldw 8(reg_CFP),reg_A2
94 ldw 12(reg_CFP),reg_A3
95 ldw 16(reg_CFP),reg_A4
96 ldw 20(reg_CFP),reg_A5
97
98 /* Calculate the LRA. */
99 ldil L%lra+type_OtherPointer,reg_LRA
100 ldo R%lra+type_OtherPointer(reg_LRA),reg_LRA
101
102 /* Indirect the closure */
103 ldw CLOSURE_FUNCTION_OFFSET(0,reg_LEXENV),reg_CODE
104 addi 6*4-type_FunctionPointer,reg_CODE,reg_LIP
105
106 /* And into lisp we go. */
107 .export break_here
108 break_here
109 be,n 0(%sr5,reg_LIP)
110
111 break 0,0
112
113 .align 8
114 lra
115 .word type_ReturnPcHeader
116 copy reg_OCFP,reg_CSP
117
118 /* Copy CFP (%r4) into someplace else and restore r4. */
119 copy reg_CFP,reg_NL1
120 ldw -64(0,%sp),%r4
121
122 /* Copy the return value. */
123 copy reg_A0,%ret0
124
125 /* Turn on pseudo-atomic. */
126 addi 4,reg_ALLOC,reg_ALLOC
127
128 /* Store the lisp state. */
129 copy reg_ALLOC,reg_NL0
130 depi 0,31,3,reg_NL0
131 addil L%current_dynamic_space_free_pointer-$global$,%dp
132 stw reg_NL0,R%current_dynamic_space_free_pointer-$global$(0,%r1)
133 addil L%current_binding_stack_pointer-$global$,%dp
134 stw reg_BSP,R%current_binding_stack_pointer-$global$(0,%r1)
135 addil L%current_control_stack_pointer-$global$,%dp
136 stw reg_CSP,R%current_control_stack_pointer-$global$(0,%r1)
137 addil L%current_control_frame_pointer-$global$,%dp
138 stw reg_NL1,R%current_control_frame_pointer-$global$(0,%r1)
139
140 /* Back in C land. [CSP is just a handy non-zero value.] */
141 addil L%foreign_function_call_active-$global$,%dp
142 stw reg_CSP,R%foreign_function_call_active-$global$(0,%r1)
143
144 /* Turn off pseudo-atomic and check for traps. */
145 addit,od -4,reg_ALLOC,reg_ALLOC
146
147
148 ldw -0x54(%sr0,%sp),%rp
149 ldw -0x4(%sr0,%sp),%r18
150 ldw -0x8(%sr0,%sp),%r17
151 ldw -0xc(%sr0,%sp),%r16
152 ldw -0x10(%sr0,%sp),%r15
153 ldw -0x14(%sr0,%sp),%r14
154 ldw -0x18(%sr0,%sp),%r13
155 ldw -0x1c(%sr0,%sp),%r12
156 ldw -0x20(%sr0,%sp),%r11
157 ldw -0x24(%sr0,%sp),%r10
158 ldw -0x28(%sr0,%sp),%r9
159 ldw -0x2c(%sr0,%sp),%r8
160 ldw -0x30(%sr0,%sp),%r7
161 ldw -0x34(%sr0,%sp),%r6
162 ldw -0x38(%sr0,%sp),%r5
163 ldw -0x3c(%sr0,%sp),%r4
164 bv %r0(%rp)
165 ldwm -0x40(%sr0,%sp),%r3
166
167
168 /* And thats all. */
169 .exit
170 .procend
171
172
173 /*
174 * Call-into-C
175 */
176
177
178 .export call_into_c
179 call_into_c
180 /* Set up a lisp stack frame. Note: we convert the raw return pc into
181 * a fixnum pc-offset because we don't have ahold of an lra object.
182 */
183 copy reg_CFP, reg_OCFP
184 copy reg_CSP, reg_CFP
185 addi 32, reg_CSP, reg_CSP
186 stw reg_OCFP, 0(0,reg_CFP)
187 sub reg_LIP, reg_CODE, reg_NL5
188 addi 3-type_OtherPointer, reg_NL5, reg_NL5
189 stw reg_NL5, 4(0,reg_CFP)
190 stw reg_CODE, 8(0,reg_CFP)
191
192 /* Turn on pseudo-atomic. */
193 addi 4, reg_ALLOC, reg_ALLOC
194
195 /* Store the lisp state. */
196 copy reg_ALLOC,reg_NL5
197 depi 0,31,3,reg_NL5
198 addil L%current_dynamic_space_free_pointer-$global$,%dp
199 stw reg_NL5,R%current_dynamic_space_free_pointer-$global$(0,%r1)
200 addil L%current_binding_stack_pointer-$global$,%dp
201 stw reg_BSP,R%current_binding_stack_pointer-$global$(0,%r1)
202 addil L%current_control_stack_pointer-$global$,%dp
203 stw reg_CSP,R%current_control_stack_pointer-$global$(0,%r1)
204 addil L%current_control_frame_pointer-$global$,%dp
205 stw reg_CFP,R%current_control_frame_pointer-$global$(0,%r1)
206
207 /* Back in C land. [CSP is just a handy non-zero value.] */
208 addil L%foreign_function_call_active-$global$,%dp
209 stw reg_CSP,R%foreign_function_call_active-$global$(0,%r1)
210
211 /* Turn off pseudo-atomic and check for traps. */
212 addit,od -4,reg_ALLOC,reg_ALLOC
213
214 /* in order to be able to call incrementally linked (ld -A) functions,
215 we have to do some mild trickery here */
216 copy reg_CFUNC,%r22
217 bl $$dyncall,%r31
218 copy %r31, %r2
219
220 /* Clear the callee saves descriptor regs. */
221 copy %r0, reg_A5
222 copy %r0, reg_L0
223 copy %r0, reg_L1
224 copy %r0, reg_L2
225
226 /* Turn on pseudo-atomic. */
227 ldi 4, reg_ALLOC
228
229 /* Turn off foreign function call. */
230 addil L%foreign_function_call_active-$global$,%dp
231 stw %r0,R%foreign_function_call_active-$global$(0,%r1)
232
233 /* Load ALLOC. */
234 addil L%current_dynamic_space_free_pointer-$global$,%dp
235 ldw R%current_dynamic_space_free_pointer-$global$(0,%r1),%r1
236 add reg_ALLOC,%r1,reg_ALLOC
237
238 /* We don't need to load OCFP, CFP, CSP, or BSP because they are
239 * in caller saves registers.
240 */
241
242 /* End of pseudo-atomic. */
243 addit,od -4,reg_ALLOC,reg_ALLOC
244
245 /* Restore CODE. Even though it is in a callee saves register
246 * it might have been GC'ed.
247 */
248 ldw 8(0,reg_CFP), reg_CODE
249
250 /* Restore the return pc. */
251 ldw 4(0,reg_CFP), reg_NL0
252 addi type_OtherPointer-3, reg_NL0, reg_NL0
253 add reg_CODE, reg_NL0, reg_LIP
254
255 /* Pop the lisp stack frame, and back we go. */
256 copy reg_CFP, reg_CSP
257 be 0(4,reg_LIP)
258 copy reg_OCFP, reg_CFP
259
260
261
262 /*
263 * Stuff to sanctify a block of memory for execution.
264 */
265
266 .EXPORT sanctify_for_execution
267 sanctify_for_execution
268 .proc
269 .callinfo
270 .entry
271 /* %arg0=start addr, %arg1=length in bytes */
272 add %arg0,%arg1,%arg1
273 ldo -1(%arg1),%arg1
274 depi 0,31,5,%arg0
275 depi 0,31,5,%arg1
276 ldsid (%arg0),%t1
277 mtsp %t1,%sr1
278 ldi 32,%t1 ; bytes per cache line
279 sanctify_loop
280 fdc 0(%sr1,%arg0)
281 comb,< %arg0,%arg1,sanctify_loop
282 fic,m %t1(%sr1,%arg0)
283
284 bv %r0(%rp)
285 nop
286
287 .exit
288 .procend
289
290
291 /*
292 * Trampolines.
293 */
294
295 .EXPORT closure_tramp
296 closure_tramp
297 /* reg_FDEFN holds the fdefn object. */
298 ldw FDEFN_FUNCTION_OFFSET(0,reg_FDEFN),reg_LEXENV
299 ldw CLOSURE_FUNCTION_OFFSET(0,reg_LEXENV),reg_L0
300 addi FUNCTION_CODE_OFFSET, reg_L0, reg_LIP
301 bv,n 0(reg_LIP)
302
303 .EXPORT undefined_tramp
304 undefined_tramp
305 break trap_Error,0
306 /* Number of argument bytes */
307 .byte 4
308 .byte UNDEFINED_SYMBOL_ERROR
309 /* Escape to create 16bit BE number from following two values */
310 .byte 254
311 /* SC_OFFSET(sc_DescriptorReg,reg_FDEFN) */
312 .byte (0x20 + sc_DescriptorReg)
313 .byte 1
314 .align 4
315
316
317 /*
318 * Core saving/restoring support
319 */
320
321 .export call_on_stack
322 call_on_stack
323 /* %arg0 = fn to invoke, %arg1 = new stack base */
324
325 /* Compute the new stack pointer. */
326 addi 64,%arg1,%sp
327
328 /* Zero out the previous stack pointer. */
329 stw %r0,-4(0,%sp)
330
331 /* Invoke the function. */
332 ble 0(4,%arg0)
333 copy %r31, %r2
334
335 /* Flame out. */
336 break 0,0
337
338 .export save_state
339 save_state
340 .proc
341 .callinfo entry_gr=18,entry_fr=21,save_rp,calls
342 .entry
343
344 stw %rp,-0x14(%sr0,%sp)
345 fstds,ma %fr12,8(%sr0,%sp)
346 fstds,ma %fr13,8(%sr0,%sp)
347 fstds,ma %fr14,8(%sr0,%sp)
348 fstds,ma %fr15,8(%sr0,%sp)
349 fstds,ma %fr16,8(%sr0,%sp)
350 fstds,ma %fr17,8(%sr0,%sp)
351 fstds,ma %fr18,8(%sr0,%sp)
352 fstds,ma %fr19,8(%sr0,%sp)
353 fstds,ma %fr20,8(%sr0,%sp)
354 fstds,ma %fr21,8(%sr0,%sp)
355 stwm %r3,0x70(%sr0,%sp)
356 stw %r4,-0x6c(%sr0,%sp)
357 stw %r5,-0x68(%sr0,%sp)
358 stw %r6,-0x64(%sr0,%sp)
359 stw %r7,-0x60(%sr0,%sp)
360 stw %r8,-0x5c(%sr0,%sp)
361 stw %r9,-0x58(%sr0,%sp)
362 stw %r10,-0x54(%sr0,%sp)
363 stw %r11,-0x50(%sr0,%sp)
364 stw %r12,-0x4c(%sr0,%sp)
365 stw %r13,-0x48(%sr0,%sp)
366 stw %r14,-0x44(%sr0,%sp)
367 stw %r15,-0x40(%sr0,%sp)
368 stw %r16,-0x3c(%sr0,%sp)
369 stw %r17,-0x38(%sr0,%sp)
370 stw %r18,-0x34(%sr0,%sp)
371
372
373 /* Remember the function we want to invoke */
374 copy %arg0,%r19
375
376 /* Pass the new stack pointer in as %arg0 */
377 copy %sp,%arg0
378
379 /* Leave %arg1 as %arg1. */
380
381 /* do the call. */
382 ble 0(4,%r19)
383 copy %r31, %r2
384
385 .export _restore_state
386 _restore_state
387
388 ldw -0xd4(%sp0,%sp),%rp
389 ldw -0x34(%sp0,%sp),%r18
390 ldw -0x38(%sp0,%sp),%r17
391 ldw -0x3c(%sp0,%sp),%r16
392 ldw -0x40(%sp0,%sp),%r15
393 ldw -0x44(%sp0,%sp),%r14
394 ldw -0x48(%sp0,%sp),%r13
395 ldw -0x4c(%sp0,%sp),%r12
396 ldw -0x50(%sp0,%sp),%r11
397 ldw -0x54(%sp0,%sp),%r10
398 ldw -0x58(%sp0,%sp),%r9
399 ldw -0x5c(%sp0,%sp),%r8
400 ldw -0x60(%sp0,%sp),%r7
401 ldw -0x64(%sp0,%sp),%r6
402 ldw -0x68(%sp0,%sp),%r5
403 ldw -0x6c(%sp0,%sp),%r4
404 ldwm -0x70(%sp0,%sp),%r3
405 fldds,mb -8(%sp0,%sp),%fr21
406 fldds,mb -8(%sp0,%sp),%fr20
407 fldds,mb -8(%sp0,%sp),%fr19
408 fldds,mb -8(%sp0,%sp),%fr18
409 fldds,mb -8(%sp0,%sp),%fr17
410 fldds,mb -8(%sp0,%sp),%fr16
411 fldds,mb -8(%sp0,%sp),%fr15
412 fldds,mb -8(%sp0,%sp),%fr14
413 fldds,mb -8(%sp0,%sp),%fr13
414 bv %r0(%rp)
415 fldds,mb -8(%sr0,%sp),%fr12
416
417
418 .exit
419 .procend
420
421 .export restore_state
422 restore_state
423 .proc
424 .callinfo
425 copy %arg0,%sp
426 b _restore_state
427 copy %arg1,%ret0
428 .procend
429
430
431
432 .export SingleStepTraps
433 SingleStepTraps
434 break trap_SingleStepBreakpoint,0
435 break trap_SingleStepBreakpoint,0
436 /* Missing !! NOT
437 there's a break 0,0 in the new version here!!!
438 */
439
440 .align 8
441 .export function_end_breakpoint_guts
442 function_end_breakpoint_guts
443 .word type_ReturnPcHeader
444 /* multiple value return point -- just jump to trap. */
445 b,n function_end_breakpoint_trap
446 /* single value return point -- convert to multiple w/ n=1 */
447 copy reg_CSP, reg_OCFP
448 addi 4, reg_CSP, reg_CSP
449 addi 4, %r0, reg_NARGS
450 copy reg_NULL, reg_A1
451 copy reg_NULL, reg_A2
452 copy reg_NULL, reg_A3
453 copy reg_NULL, reg_A4
454 copy reg_NULL, reg_A5
455
456 .export function_end_breakpoint_trap
457 function_end_breakpoint_trap
458 break trap_FunctionEndBreakpoint,0
459 b,n function_end_breakpoint_trap
460
461 .export function_end_breakpoint_end
462 function_end_breakpoint_end

  ViewVC Help
Powered by ViewVC 1.1.5