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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (hide annotations)
Sun Mar 27 16:41:13 1994 UTC (20 years ago) by hallgren
Branch: MAIN
Changes since 1.2: +4 -3 lines
Change offsets again, and add back line which originally was supposed
to be commented out.
1 hallgren 1.3 /* $Header: /tiger/var/lib/cvsroots/cmucl/src/lisp/alpha-assem.S,v 1.3 1994/03/27 16:41:13 hallgren Exp $ */
2 hallgren 1.1 #include <machine/regdef.h>
3     #include <machine/pal.h>
4    
5     #include "internals.h"
6     #include "lispregs.h"
7    
8     /*
9     * Function to transfer control into lisp.
10     */
11     .text
12     .align 4
13     .globl call_into_lisp
14     .ent call_into_lisp
15     call_into_lisp:
16     #define framesize 8*8
17     ldgp gp, 0($27) /* ### */
18     /* Save all the C regs. */
19     lda sp,-framesize(sp)
20     stq ra, framesize-8*8(sp)
21     stq s0, framesize-8*7(sp)
22     stq s1, framesize-8*6(sp)
23     stq s2, framesize-8*5(sp)
24     stq s3, framesize-8*4(sp)
25     stq s4, framesize-8*3(sp)
26     stq s5, framesize-8*2(sp)
27     stq s6, framesize-8*1(sp)
28     .mask 0x0fc001fe, -framesize
29     .frame sp,framesize,ra
30    
31     /* Clear descriptor regs */
32     ldil reg_CODE,0
33     ldil reg_FDEFN,0
34     mov a0,reg_LEXENV
35     sll a2,2,reg_NARGS
36     ldil reg_OCFP,0
37     ldil reg_LRA,0
38     ldil reg_L0,0
39     ldil reg_L1,0
40    
41    
42     /* Establish NIL. */
43     ldil reg_NULL,NIL
44    
45     /* Start pseudo-atomic. */
46    
47     /* No longer in foreign call. */
48     stl zero,foreign_function_call_active
49    
50     /* Load lisp state. */
51     ldl reg_ALLOC,current_dynamic_space_free_pointer
52     ldl reg_BSP,current_binding_stack_pointer
53     ldl reg_CSP,current_control_stack_pointer
54     ldl reg_OCFP,current_control_frame_pointer
55     mov a1,reg_CFP
56    
57     .set noat
58     ldil reg_L2,0
59     /* End of pseudo-atomic. */
60    
61     /* Establish lisp arguments. */
62     ldl reg_A0,0(reg_CFP)
63     ldl reg_A1,4(reg_CFP)
64     ldl reg_A2,8(reg_CFP)
65     ldl reg_A3,12(reg_CFP)
66     ldl reg_A4,16(reg_CFP)
67     ldl reg_A5,20(reg_CFP)
68    
69     /* Calculate the LRA. */
70     lda reg_LRA,call_into_lisp_LRA_page+type_OtherPointer
71    
72     /* Indirect the closure */
73     ldl reg_CODE,CLOSURE_FUNCTION_OFFSET(reg_LEXENV)
74     addl reg_CODE,6*4-type_FunctionPointer,reg_LIP
75    
76     /* And into lisp we go. */
77     jsr reg_ZERO,(reg_LIP)
78    
79     .set noreorder
80     .align 3
81     .globl call_into_lisp_LRA
82     call_into_lisp_LRA:
83    
84     .word type_ReturnPcHeader
85    
86     mov reg_OCFP,reg_CSP
87     nop
88    
89     /* return value already there */
90     mov reg_A0,v0
91    
92     /* Turn on pseudo-atomic. */
93    
94     /* Save LISP registers */
95     stl reg_ALLOC,current_dynamic_space_free_pointer
96     stl reg_BSP,current_binding_stack_pointer
97     stl reg_CSP,current_control_stack_pointer
98     stl reg_CFP,current_control_frame_pointer
99    
100     /* Back in C land. [CSP is just a handy non-zero value.] */
101     stl reg_CSP,foreign_function_call_active
102    
103     /* Turn off pseudo-atomic and check for traps. */
104    
105     /* Restore C regs */
106     ldq ra, framesize-8*8(sp)
107     ldq s0, framesize-8*7(sp)
108     ldq s1, framesize-8*6(sp)
109     ldq s2, framesize-8*5(sp)
110     ldq s3, framesize-8*4(sp)
111     ldq s4, framesize-8*3(sp)
112     ldq s5, framesize-8*2(sp)
113     ldq s6, framesize-8*1(sp)
114    
115     ret zero,(ra),1
116     .globl call_into_lisp_end
117     call_into_lisp_end:
118     .end call_into_lisp
119    
120     /*
121     * Transfering control from Lisp into C
122     */
123     .set noreorder
124     .text
125     .align 4
126     .globl call_into_c
127     .ent call_into_c
128     call_into_c:
129     .mask 0x0fc001fe, -12
130     .frame sp,12,ra
131     mov reg_CFP, reg_OCFP
132     mov reg_CSP, reg_CFP
133     addq reg_CFP, 32, reg_CSP
134     stl reg_OCFP, 0(reg_CFP)
135     subl reg_LIP, reg_CODE, reg_L1
136     addl reg_L1, type_OtherPointer, reg_L1
137     stl reg_L1, 4(reg_CFP)
138     stl reg_CODE, 8(reg_CFP)
139     stl reg_NULL, 12(reg_CFP)
140    
141     /* Set the pseudo-atomic flag. */
142     addq reg_ALLOC,1,reg_ALLOC
143    
144     /* Get the top two register args and fix the NSP to point to arg 7 */
145     ldq reg_NL4,0(reg_NSP)
146     ldq reg_NL5,8(reg_NSP)
147     addq reg_NSP,16,reg_NSP
148    
149     /* Save lisp state. */
150     subq reg_ALLOC,1,reg_L1
151     stl reg_L1, current_dynamic_space_free_pointer
152     stl reg_BSP, current_binding_stack_pointer
153     stl reg_CSP, current_control_stack_pointer
154     stl reg_CFP, current_control_frame_pointer
155    
156     /* Mark us as in C land. */
157     stl reg_CSP, foreign_function_call_active
158    
159     /* Were we interrupted? */
160     subq reg_ALLOC,1,reg_ALLOC
161     stl reg_ZERO,0(reg_ALLOC)
162    
163     /* Into C land we go. */
164 hallgren 1.3 mov reg_CFUNC, reg_L1 /* ### This line is a mystery */
165 hallgren 1.1 jsr ra, (reg_CFUNC)
166     ldgp $29,0(ra)
167    
168     /* restore NSP */
169     subq reg_NSP,16,reg_NSP
170    
171     /* Clear unsaved descriptor regs */
172     mov reg_ZERO, reg_NARGS
173     mov reg_ZERO, reg_A0
174     mov reg_ZERO, reg_A1
175     mov reg_ZERO, reg_A2
176     mov reg_ZERO, reg_A3
177     mov reg_ZERO, reg_A4
178     mov reg_ZERO, reg_A5
179     mov reg_ZERO, reg_L0
180     mov reg_ZERO, reg_L2
181    
182     /* Turn on pseudo-atomic. */
183     lda reg_ALLOC,1(reg_ZERO)
184    
185     /* Mark us at in Lisp land. */
186     stl reg_ZERO, foreign_function_call_active
187    
188     /* Restore ALLOC, preserving pseudo-atomic-atomic */
189     ldl reg_NL0,current_dynamic_space_free_pointer
190     addq reg_ALLOC,reg_NL0,reg_ALLOC
191    
192     /* Check for interrupt */
193     subq reg_ALLOC,1,reg_ALLOC
194     stl reg_ZERO,0(reg_ALLOC)
195    
196     ldl reg_NULL, 12(reg_CFP)
197    
198     /* Restore LRA & CODE (they may have been GC'ed) */
199     ldl reg_CODE, 8(reg_CFP)
200     ldl reg_NL0, 4(reg_CFP)
201     subq reg_NL0, type_OtherPointer, reg_NL0
202     addq reg_CODE, reg_NL0, reg_NL0
203    
204     mov reg_CFP, reg_CSP
205     mov reg_OCFP, reg_CFP
206    
207     ret zero, (reg_NL0), 1
208    
209     .end call_into_c
210    
211     .text
212     .globl start_of_tramps
213     start_of_tramps:
214    
215     /*
216     * The undefined-function trampoline.
217     */
218     .text
219     .globl undefined_tramp
220     .ent undefined_tramp_offset
221 hallgren 1.3 undefined_tramp = /* ### undefined_tramp_offset-call_into_lisp_LRA*/ 0x140+call_into_lisp_LRA_page
222 hallgren 1.1 undefined_tramp_offset:
223     call_pal PAL_gentrap
224     .long 10
225     .byte 4
226     .byte 23
227     .byte 254
228     .byte 238
229     .byte 2
230     .align 2
231     .end undefined_tramp
232    
233    
234     /*
235     * The closure trampoline.
236     */
237     .text
238     .globl closure_tramp
239     .ent closure_tramp_offset
240 hallgren 1.3 closure_tramp = /* ### */ 0x150 + call_into_lisp_LRA_page
241 hallgren 1.1 closure_tramp_offset:
242     ldl reg_LEXENV, FDEFN_FUNCTION_OFFSET(reg_FDEFN)
243     ldl reg_L0, CLOSURE_FUNCTION_OFFSET(reg_LEXENV)
244     addl reg_L0, FUNCTION_CODE_OFFSET, reg_LIP
245     jmp reg_ZERO,(reg_LIP)
246     .end closure_tramp
247    
248     .text
249     .globl end_of_tramps
250     end_of_tramps:
251    

  ViewVC Help
Powered by ViewVC 1.1.5