/[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.2 - (show annotations)
Sun Mar 27 16:18:16 1994 UTC (20 years, 1 month ago) by hallgren
Branch: MAIN
Changes since 1.1: +3 -3 lines
Fixed the hacked offsets.
1 /* $Header: /tiger/var/lib/cvsroots/cmucl/src/lisp/alpha-assem.S,v 1.2 1994/03/27 16:18:16 hallgren Exp $ */
2 #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 jsr ra, (reg_CFUNC)
165 ldgp $29,0(ra)
166
167 /* restore NSP */
168 subq reg_NSP,16,reg_NSP
169
170 /* Clear unsaved descriptor regs */
171 mov reg_ZERO, reg_NARGS
172 mov reg_ZERO, reg_A0
173 mov reg_ZERO, reg_A1
174 mov reg_ZERO, reg_A2
175 mov reg_ZERO, reg_A3
176 mov reg_ZERO, reg_A4
177 mov reg_ZERO, reg_A5
178 mov reg_ZERO, reg_L0
179 mov reg_ZERO, reg_L2
180
181 /* Turn on pseudo-atomic. */
182 lda reg_ALLOC,1(reg_ZERO)
183
184 /* Mark us at in Lisp land. */
185 stl reg_ZERO, foreign_function_call_active
186
187 /* Restore ALLOC, preserving pseudo-atomic-atomic */
188 ldl reg_NL0,current_dynamic_space_free_pointer
189 addq reg_ALLOC,reg_NL0,reg_ALLOC
190
191 /* Check for interrupt */
192 subq reg_ALLOC,1,reg_ALLOC
193 stl reg_ZERO,0(reg_ALLOC)
194
195 ldl reg_NULL, 12(reg_CFP)
196
197 /* Restore LRA & CODE (they may have been GC'ed) */
198 ldl reg_CODE, 8(reg_CFP)
199 ldl reg_NL0, 4(reg_CFP)
200 subq reg_NL0, type_OtherPointer, reg_NL0
201 addq reg_CODE, reg_NL0, reg_NL0
202
203 mov reg_CFP, reg_CSP
204 mov reg_OCFP, reg_CFP
205
206 ret zero, (reg_NL0), 1
207
208 .end call_into_c
209
210 .text
211 .globl start_of_tramps
212 start_of_tramps:
213
214 /*
215 * The undefined-function trampoline.
216 */
217 .text
218 .globl undefined_tramp
219 .ent undefined_tramp_offset
220 undefined_tramp = /* ### undefined_tramp_offset-call_into_lisp_LRA*/ 0x13c+call_into_lisp_LRA_page
221 undefined_tramp_offset:
222 call_pal PAL_gentrap
223 .long 10
224 .byte 4
225 .byte 23
226 .byte 254
227 .byte 238
228 .byte 2
229 .align 2
230 .end undefined_tramp
231
232
233 /*
234 * The closure trampoline.
235 */
236 .text
237 .globl closure_tramp
238 .ent closure_tramp_offset
239 closure_tramp = /* ### */ 0x14c + call_into_lisp_LRA_page
240 closure_tramp_offset:
241 ldl reg_LEXENV, FDEFN_FUNCTION_OFFSET(reg_FDEFN)
242 ldl reg_L0, CLOSURE_FUNCTION_OFFSET(reg_LEXENV)
243 addl reg_L0, FUNCTION_CODE_OFFSET, reg_LIP
244 jmp reg_ZERO,(reg_LIP)
245 .end closure_tramp
246
247 .text
248 .globl end_of_tramps
249 end_of_tramps:
250

  ViewVC Help
Powered by ViewVC 1.1.5