/[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.12 - (hide annotations)
Fri Aug 23 17:01:01 2002 UTC (11 years, 8 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-pre1, 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, 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, snapshot-2005-03, 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, 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, lisp-executable, 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, sse2-packed-branch, RELEASE-20A-BRANCH, ppc-gencgc, 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.11: +9 -5 lines
Added export of internal error code constants to internals.h, so that
platform assembler code can use those, instead of magic numbers and
bogus conditionalization on type_Long_Float.  Inspired/Stolen from
SBCL.  Also added some more comments in places, and a generic
SC_OFFSET macro that matches lisp/debug-info.lisp.
1 wlott 1.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 ram 1.8 .import $$dyncall,MILLICODE
16 wlott 1.1
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     .enter
27     /* arg0=function, arg1=cfp, arg2=nargs */
28    
29     /* Clear the descriptor regs, moving in args as approporate. */
30     copy r0,reg_CODE
31     copy r0,reg_FDEFN
32     copy arg0,reg_LEXENV
33     zdep arg2,29,30,reg_NARGS
34     copy r0,reg_OCFP
35     copy r0,reg_LRA
36     copy r0,reg_A0
37     copy r0,reg_A1
38     copy r0,reg_A2
39     copy r0,reg_A3
40     copy r0,reg_A4
41     copy r0,reg_A5
42     copy r0,reg_L0
43     copy r0,reg_L1
44     copy r0,reg_L2
45    
46     /* Establish NIL. */
47     ldil L%NIL,reg_NULL
48     ldo R%NIL(reg_NULL),reg_NULL
49    
50     /* Turn on pseudo-atomic. */
51     ldo 4(r0),reg_ALLOC
52    
53     /* No longer in foreign function call land. */
54     addil L%foreign_function_call_active-$global$,dp
55     stw r0,R%foreign_function_call_active-$global$(0,r1)
56    
57     /* Load lisp state. */
58     addil L%current_dynamic_space_free_pointer-$global$,dp
59     ldw R%current_dynamic_space_free_pointer-$global$(0,r1),r1
60     add reg_ALLOC,r1,reg_ALLOC
61     addil L%current_binding_stack_pointer-$global$,dp
62     ldw R%current_binding_stack_pointer-$global$(0,r1),reg_BSP
63     addil L%current_control_stack_pointer-$global$,dp
64     ldw R%current_control_stack_pointer-$global$(0,r1),reg_CSP
65     addil L%current_control_frame_pointer-$global$,dp
66     ldw R%current_control_frame_pointer-$global$(0,r1),reg_OCFP
67     copy arg1,reg_CFP
68    
69     /* End of pseudo-atomic. */
70     addit,od -4,reg_ALLOC,reg_ALLOC
71    
72     /* Establish lisp arguments. */
73     ldw 0(reg_CFP),reg_A0
74     ldw 4(reg_CFP),reg_A1
75     ldw 8(reg_CFP),reg_A2
76     ldw 12(reg_CFP),reg_A3
77     ldw 16(reg_CFP),reg_A4
78     ldw 20(reg_CFP),reg_A5
79    
80     /* Calculate the LRA. */
81     ldil L%lra+type_OtherPointer,reg_LRA
82     ldo R%lra+type_OtherPointer(reg_LRA),reg_LRA
83    
84     /* Indirect the closure */
85     ldw CLOSURE_FUNCTION_OFFSET(0,reg_LEXENV),reg_CODE
86     addi 6*4-type_FunctionPointer,reg_CODE,reg_LIP
87    
88     /* And into lisp we go. */
89     .export break_here
90     break_here
91 dtc 1.11 be,n 0(sr5,reg_LIP)
92 wlott 1.1
93     .align 8
94     lra
95     .word type_ReturnPcHeader
96     copy reg_OCFP,reg_CSP
97    
98     /* Copy CFP (r4) into someplace else and restore r4. */
99     copy reg_CFP,reg_NL1
100     ldw -64(0,sp),r4
101    
102     /* Copy the return value. */
103     copy reg_A0,ret0
104    
105     /* Turn on pseudo-atomic. */
106     addi 4,reg_ALLOC,reg_ALLOC
107    
108     /* Store the lisp state. */
109     copy reg_ALLOC,reg_NL0
110     depi 0,31,3,reg_NL0
111     addil L%current_dynamic_space_free_pointer-$global$,dp
112     stw reg_NL0,R%current_dynamic_space_free_pointer-$global$(0,r1)
113     addil L%current_binding_stack_pointer-$global$,dp
114     stw reg_BSP,R%current_binding_stack_pointer-$global$(0,r1)
115     addil L%current_control_stack_pointer-$global$,dp
116     stw reg_CSP,R%current_control_stack_pointer-$global$(0,r1)
117     addil L%current_control_frame_pointer-$global$,dp
118     stw reg_NL1,R%current_control_frame_pointer-$global$(0,r1)
119    
120     /* Back in C land. [CSP is just a handy non-zero value.] */
121     addil L%foreign_function_call_active-$global$,dp
122     stw reg_CSP,R%foreign_function_call_active-$global$(0,r1)
123    
124     /* Turn off pseudo-atomic and check for traps. */
125     addit,od -4,reg_ALLOC,reg_ALLOC
126    
127     /* And thats all. */
128     .leave
129     .procend
130    
131    
132     /*
133     * Call-into-C
134     */
135    
136    
137     .export call_into_c
138     call_into_c
139     /* Set up a lisp stack frame. Note: we convert the raw return pc into
140     * a fixnum pc-offset because we don't have ahold of an lra object.
141     */
142     copy reg_CFP, reg_OCFP
143     copy reg_CSP, reg_CFP
144     addi 32, reg_CSP, reg_CSP
145     stw reg_OCFP, 0(0,reg_CFP)
146     sub reg_LIP, reg_CODE, reg_NL5
147     addi 3-type_OtherPointer, reg_NL5, reg_NL5
148     stw reg_NL5, 4(0,reg_CFP)
149     stw reg_CODE, 8(0,reg_CFP)
150    
151     /* Turn on pseudo-atomic. */
152     addi 4, reg_ALLOC, reg_ALLOC
153    
154     /* Store the lisp state. */
155     copy reg_ALLOC,reg_NL5
156     depi 0,31,3,reg_NL5
157     addil L%current_dynamic_space_free_pointer-$global$,dp
158     stw reg_NL5,R%current_dynamic_space_free_pointer-$global$(0,r1)
159     addil L%current_binding_stack_pointer-$global$,dp
160     stw reg_BSP,R%current_binding_stack_pointer-$global$(0,r1)
161     addil L%current_control_stack_pointer-$global$,dp
162     stw reg_CSP,R%current_control_stack_pointer-$global$(0,r1)
163     addil L%current_control_frame_pointer-$global$,dp
164     stw reg_CFP,R%current_control_frame_pointer-$global$(0,r1)
165    
166     /* Back in C land. [CSP is just a handy non-zero value.] */
167     addil L%foreign_function_call_active-$global$,dp
168     stw reg_CSP,R%foreign_function_call_active-$global$(0,r1)
169    
170     /* Turn off pseudo-atomic and check for traps. */
171     addit,od -4,reg_ALLOC,reg_ALLOC
172    
173 ram 1.7 /* in order to be able to call incrementally linked (ld -A) functions,
174     we have to do some mild trickery here */
175     copy reg_CFUNC,%r22
176     bl $$dyncall,r31
177     copy r31, r2
178 wlott 1.1
179     /* Clear the callee saves descriptor regs. */
180     copy r0, reg_A5
181     copy r0, reg_L0
182     copy r0, reg_L1
183     copy r0, reg_L2
184    
185     /* Turn on pseudo-atomic. */
186     ldi 4, reg_ALLOC
187    
188     /* Turn off foreign function call. */
189     addil L%foreign_function_call_active-$global$,dp
190     stw r0,R%foreign_function_call_active-$global$(0,r1)
191    
192     /* Load ALLOC. */
193     addil L%current_dynamic_space_free_pointer-$global$,dp
194     ldw R%current_dynamic_space_free_pointer-$global$(0,r1),r1
195     add reg_ALLOC,r1,reg_ALLOC
196    
197     /* We don't need to load OCFP, CFP, CSP, or BSP because they are
198     * in caller saves registers.
199     */
200    
201     /* End of pseudo-atomic. */
202     addit,od -4,reg_ALLOC,reg_ALLOC
203    
204     /* Restore CODE. Even though it is in a callee saves register
205     * it might have been GC'ed.
206     */
207     ldw 8(0,reg_CFP), reg_CODE
208    
209     /* Restore the return pc. */
210     ldw 4(0,reg_CFP), reg_NL0
211     addi type_OtherPointer-3, reg_NL0, reg_NL0
212     add reg_CODE, reg_NL0, reg_LIP
213    
214     /* Pop the lisp stack frame, and back we go. */
215     copy reg_CFP, reg_CSP
216     be 0(4,reg_LIP)
217     copy reg_OCFP, reg_CFP
218    
219    
220    
221     /*
222 wlott 1.2 * Stuff to sanctify a block of memory for execution.
223     */
224    
225     .EXPORT sanctify_for_execution
226     sanctify_for_execution
227     .proc
228     .callinfo
229     .enter
230     /* arg0=start addr, arg1=length in bytes */
231     add arg0,arg1,arg1
232 wlott 1.4 ldo -1(arg1),arg1
233 wlott 1.2 depi 0,31,5,arg0
234     depi 0,31,5,arg1
235 wlott 1.9 ldsid (arg0),r19
236     mtsp r19,sr1
237     ldi 32,r19 ; bytes per cache line
238 wlott 1.2 sanctify_loop
239     fdc 0(sr1,arg0)
240     comb,< arg0,arg1,sanctify_loop
241 wlott 1.9 fic,m r19(sr1,arg0)
242 wlott 1.2 .leave
243     .procend
244    
245    
246     /*
247 wlott 1.1 * Trampolines.
248     */
249    
250     .EXPORT closure_tramp
251     closure_tramp
252     /* reg_FDEFN holds the fdefn object. */
253     ldw FDEFN_FUNCTION_OFFSET(0,reg_FDEFN),reg_LEXENV
254     ldw CLOSURE_FUNCTION_OFFSET(0,reg_LEXENV),reg_L0
255 wlott 1.3 addi FUNCTION_CODE_OFFSET, reg_L0, reg_LIP
256 wlott 1.1 bv,n 0(reg_LIP)
257    
258     .EXPORT undefined_tramp
259     undefined_tramp
260     break trap_Error,0
261 pmai 1.12 /* Number of argument bytes */
262     .byte 4
263     .byte UNDEFINED_SYMBOL_ERROR
264     /* Escape to create 16bit BE number from following two values */
265     .byte 254
266     /* SC_OFFSET(sc_DescriptorReg,reg_LEXENV) */
267     /* Shouldn't this be reg_FDEFN, instead? */
268     .byte (0x40 + sc_DescriptorReg)
269     .byte 1
270 wlott 1.1 .align 4
271    
272    
273     /*
274     * Core saving/restoring support
275     */
276    
277     .export call_on_stack
278     call_on_stack
279     /* arg0 = fn to invoke, arg1 = new stack base */
280    
281     /* Compute the new stack pointer. */
282     addi 64,arg1,sp
283    
284     /* Zero out the previous stack pointer. */
285     stw r0,-4(0,sp)
286    
287     /* Invoke the function. */
288     ble 0(4,arg0)
289     copy r31, r2
290    
291     /* Flame out. */
292     break 0,0
293    
294     .export save_state
295     save_state
296     .proc
297     .callinfo entry_gr=18,entry_fr=21,save_rp,calls
298     .enter
299    
300     /* Remember the function we want to invoke */
301     copy arg0,r19
302    
303     /* Pass the new stack pointer in as arg0 */
304     copy sp,arg0
305    
306     /* Leave arg1 as arg1. */
307    
308     /* do the call. */
309     ble 0(4,r19)
310     copy r31, r2
311    
312     _restore_state
313     .leave
314     .procend
315    
316     .export restore_state
317     restore_state
318     .proc
319     .callinfo
320     copy arg0,sp
321     b _restore_state
322     copy arg1,ret0
323     .procend
324 wlott 1.6
325    
326    
327     .export SingleStepTraps
328     SingleStepTraps
329     break trap_SingleStepBreakpoint,0
330     break trap_SingleStepBreakpoint,0
331    
332    
333    
334     .align 8
335     .export function_end_breakpoint_guts
336     function_end_breakpoint_guts
337     .word type_ReturnPcHeader
338     /* multiple value return point -- just jump to trap. */
339     b,n function_end_breakpoint_trap
340     /* single value return point -- convert to multiple w/ n=1 */
341     copy reg_CSP, reg_OCFP
342     addi 4, reg_CSP, reg_CSP
343     addi 4, r0, reg_NARGS
344     copy reg_NULL, reg_A1
345     copy reg_NULL, reg_A2
346     copy reg_NULL, reg_A3
347     copy reg_NULL, reg_A4
348     copy reg_NULL, reg_A5
349    
350     .export function_end_breakpoint_trap
351     function_end_breakpoint_trap
352     break trap_FunctionEndBreakpoint,0
353     b,n function_end_breakpoint_trap
354    
355     .export function_end_breakpoint_end
356     function_end_breakpoint_end

  ViewVC Help
Powered by ViewVC 1.1.5