|
7 | 7 | * All Rights Reserved.
|
8 | 8 | */
|
9 | 9 |
|
10 |
| -#if defined(__ia64__) |
11 |
| - |
12 |
| - /****************************************************************/ |
13 |
| - |
14 |
| - /* |
15 |
| - * The internal __jmp_buf layout is different from one used |
16 |
| - * by setjmp()/longjmp(). |
17 |
| - * |
18 |
| - * Offset Description |
19 |
| - * ------ ----------- |
20 |
| - * 0x000 stack pointer (r12) |
21 |
| - * 0x008 gp (r1) |
22 |
| - * 0x010 caller's unat |
23 |
| - * 0x018 fpsr |
24 |
| - * 0x020 r4 |
25 |
| - * 0x028 r5 |
26 |
| - * 0x030 r6 |
27 |
| - * 0x038 r7 |
28 |
| - * 0x040 rp (b0) |
29 |
| - * 0x048 b1 |
30 |
| - * 0x050 b2 |
31 |
| - * 0x058 b3 |
32 |
| - * 0x060 b4 |
33 |
| - * 0x068 b5 |
34 |
| - * 0x070 ar.pfs |
35 |
| - * 0x078 ar.lc |
36 |
| - * 0x080 pr |
37 |
| - * 0x088 ar.bsp |
38 |
| - * 0x090 ar.unat |
39 |
| - * 0x098 &__jmp_buf |
40 |
| - * 0x0a0 ar.rsc |
41 |
| - * 0x0a8 ar.rnat |
42 |
| - * 0x0b0 f2 |
43 |
| - * 0x0c0 f3 |
44 |
| - * 0x0d0 f4 |
45 |
| - * 0x0e0 f5 |
46 |
| - * 0x0f0 f16 |
47 |
| - * 0x100 f17 |
48 |
| - * 0x110 f18 |
49 |
| - * 0x120 f19 |
50 |
| - * 0x130 f20 |
51 |
| - * 0x130 f21 |
52 |
| - * 0x140 f22 |
53 |
| - * 0x150 f23 |
54 |
| - * 0x160 f24 |
55 |
| - * 0x170 f25 |
56 |
| - * 0x180 f26 |
57 |
| - * 0x190 f27 |
58 |
| - * 0x1a0 f28 |
59 |
| - * 0x1b0 f29 |
60 |
| - * 0x1c0 f30 |
61 |
| - * 0x1d0 f31 |
62 |
| - * |
63 |
| - * Note that the address of __jmp_buf is saved but not used: we assume |
64 |
| - * that the jmp_buf data structure is never moved around in memory. |
65 |
| - */ |
66 |
| - |
67 |
| - /* |
68 |
| - * Implemented according to "IA-64 Software Conventions and Runtime |
69 |
| - * Architecture Guide", Chapter 10: "Context Management". |
70 |
| - */ |
71 |
| - |
72 |
| - .text |
73 |
| - .psr abi64 |
74 |
| - .psr lsb |
75 |
| - .lsb |
76 |
| - |
77 |
| - /* _st_md_cxt_save(__jmp_buf env) */ |
78 |
| - .align 32 |
79 |
| - .global _st_md_cxt_save |
80 |
| - .proc _st_md_cxt_save |
81 |
| - _st_md_cxt_save: |
82 |
| - alloc r14 = ar.pfs,1,0,0,0 |
83 |
| - mov r16 = ar.unat |
84 |
| - ;; |
85 |
| - mov r17 = ar.fpsr |
86 |
| - mov r2 = in0 |
87 |
| - add r3 = 8,in0 |
88 |
| - ;; |
89 |
| - st8.spill.nta [r2] = sp,16 // r12 (sp) |
90 |
| - ;; |
91 |
| - st8.spill.nta [r3] = gp,16 // r1 (gp) |
92 |
| - ;; |
93 |
| - st8.nta [r2] = r16,16 // save caller's unat |
94 |
| - st8.nta [r3] = r17,16 // save fpsr |
95 |
| - add r8 = 0xb0,in0 |
96 |
| - ;; |
97 |
| - st8.spill.nta [r2] = r4,16 // r4 |
98 |
| - ;; |
99 |
| - st8.spill.nta [r3] = r5,16 // r5 |
100 |
| - add r9 = 0xc0,in0 |
101 |
| - ;; |
102 |
| - stf.spill.nta [r8] = f2,32 |
103 |
| - stf.spill.nta [r9] = f3,32 |
104 |
| - mov r15 = rp |
105 |
| - ;; |
106 |
| - stf.spill.nta [r8] = f4,32 |
107 |
| - stf.spill.nta [r9] = f5,32 |
108 |
| - mov r17 = b1 |
109 |
| - ;; |
110 |
| - stf.spill.nta [r8] = f16,32 |
111 |
| - stf.spill.nta [r9] = f17,32 |
112 |
| - mov r18 = b2 |
113 |
| - ;; |
114 |
| - stf.spill.nta [r8] = f18,32 |
115 |
| - stf.spill.nta [r9] = f19,32 |
116 |
| - mov r19 = b3 |
117 |
| - ;; |
118 |
| - stf.spill.nta [r8] = f20,32 |
119 |
| - stf.spill.nta [r9] = f21,32 |
120 |
| - mov r20 = b4 |
121 |
| - ;; |
122 |
| - stf.spill.nta [r8] = f22,32 |
123 |
| - stf.spill.nta [r9] = f23,32 |
124 |
| - mov r21 = b5 |
125 |
| - ;; |
126 |
| - stf.spill.nta [r8] = f24,32 |
127 |
| - stf.spill.nta [r9] = f25,32 |
128 |
| - mov r22 = ar.lc |
129 |
| - ;; |
130 |
| - stf.spill.nta [r8] = f26,32 |
131 |
| - stf.spill.nta [r9] = f27,32 |
132 |
| - mov r24 = pr |
133 |
| - ;; |
134 |
| - stf.spill.nta [r8] = f28,32 |
135 |
| - stf.spill.nta [r9] = f29,32 |
136 |
| - ;; |
137 |
| - stf.spill.nta [r8] = f30 |
138 |
| - stf.spill.nta [r9] = f31 |
139 |
| - |
140 |
| - st8.spill.nta [r2] = r6,16 // r6 |
141 |
| - ;; |
142 |
| - st8.spill.nta [r3] = r7,16 // r7 |
143 |
| - ;; |
144 |
| - mov r23 = ar.bsp |
145 |
| - mov r25 = ar.unat |
146 |
| - |
147 |
| - st8.nta [r2] = r15,16 // b0 |
148 |
| - st8.nta [r3] = r17,16 // b1 |
149 |
| - ;; |
150 |
| - st8.nta [r2] = r18,16 // b2 |
151 |
| - st8.nta [r3] = r19,16 // b3 |
152 |
| - mov r26 = ar.rsc |
153 |
| - ;; |
154 |
| - st8.nta [r2] = r20,16 // b4 |
155 |
| - st8.nta [r3] = r21,16 // b5 |
156 |
| - ;; |
157 |
| - st8.nta [r2] = r14,16 // ar.pfs |
158 |
| - st8.nta [r3] = r22,16 // ar.lc |
159 |
| - ;; |
160 |
| - st8.nta [r2] = r24,16 // pr |
161 |
| - st8.nta [r3] = r23,16 // ar.bsp |
162 |
| - ;; |
163 |
| - st8.nta [r2] = r25,16 // ar.unat |
164 |
| - st8.nta [r3] = in0,16 // &__jmp_buf (just in case) |
165 |
| - ;; |
166 |
| - st8.nta [r2] = r26 // ar.rsc |
167 |
| - ;; |
168 |
| - flushrs // flush dirty regs to backing store |
169 |
| - ;; |
170 |
| - and r27 = ~0x3,r26 // clear ar.rsc.mode |
171 |
| - ;; |
172 |
| - mov ar.rsc = r27 // put RSE in enforced lazy mode |
173 |
| - ;; |
174 |
| - mov r28 = ar.rnat |
175 |
| - ;; |
176 |
| - st8.nta [r3] = r28 // ar.rnat |
177 |
| - mov ar.rsc = r26 // restore ar.rsc |
178 |
| - ;; |
179 |
| - mov r8 = 0 |
180 |
| - br.ret.sptk.few b0 |
181 |
| - .endp _st_md_cxt_save |
182 |
| - |
183 |
| - |
184 |
| - /****************************************************************/ |
185 |
| - |
186 |
| - /* _st_md_cxt_restore(__jmp_buf env, int val) */ |
187 |
| - .global _st_md_cxt_restore |
188 |
| - .proc _st_md_cxt_restore |
189 |
| - _st_md_cxt_restore: |
190 |
| - alloc r8 = ar.pfs,2,0,0,0 |
191 |
| - add r2 = 0x88,in0 // r2 <- &jmpbuf.ar_bsp |
192 |
| - mov r16 = ar.rsc |
193 |
| - ;; |
194 |
| - flushrs // flush dirty regs to backing store |
195 |
| - ;; |
196 |
| - and r17 = ~0x3,r16 // clear ar.rsc.mode |
197 |
| - ;; |
198 |
| - mov ar.rsc = r17 // put RSE in enforced lazy mode |
199 |
| - ;; |
200 |
| - invala // invalidate the ALAT |
201 |
| - ;; |
202 |
| - ld8 r23 = [r2],8 // r23 <- jmpbuf.ar_bsp |
203 |
| - ;; |
204 |
| - mov ar.bspstore = r23 // write BSPSTORE |
205 |
| - ld8 r25 = [r2],24 // r25 <- jmpbuf.ar_unat |
206 |
| - ;; |
207 |
| - ld8 r26 = [r2],-8 // r26 <- jmpbuf.ar_rnat |
208 |
| - ;; |
209 |
| - mov ar.rnat = r26 // write RNAT |
210 |
| - ld8 r27 = [r2] // r27 <- jmpbuf.ar_rsc |
211 |
| - ;; |
212 |
| - mov ar.rsc = r27 // write RSE control |
213 |
| - mov r2 = in0 |
214 |
| - ;; |
215 |
| - mov ar.unat = r25 // write ar.unat |
216 |
| - add r3 = 8,in0 |
217 |
| - ;; |
218 |
| - ld8.fill.nta sp = [r2],16 // r12 (sp) |
219 |
| - ld8.fill.nta gp = [r3],16 // r1 (gp) |
220 |
| - ;; |
221 |
| - ld8.nta r16 = [r2],16 // caller's unat |
222 |
| - ld8.nta r17 = [r3],16 // fpsr |
223 |
| - ;; |
224 |
| - ld8.fill.nta r4 = [r2],16 // r4 |
225 |
| - ld8.fill.nta r5 = [r3],16 // r5 |
226 |
| - ;; |
227 |
| - ld8.fill.nta r6 = [r2],16 // r6 |
228 |
| - ld8.fill.nta r7 = [r3],16 // r7 |
229 |
| - ;; |
230 |
| - mov ar.unat = r16 // restore caller's unat |
231 |
| - mov ar.fpsr = r17 // restore fpsr |
232 |
| - ;; |
233 |
| - ld8.nta r16 = [r2],16 // b0 |
234 |
| - ld8.nta r17 = [r3],16 // b1 |
235 |
| - ;; |
236 |
| - ld8.nta r18 = [r2],16 // b2 |
237 |
| - ld8.nta r19 = [r3],16 // b3 |
238 |
| - ;; |
239 |
| - ld8.nta r20 = [r2],16 // b4 |
240 |
| - ld8.nta r21 = [r3],16 // b5 |
241 |
| - ;; |
242 |
| - ld8.nta r11 = [r2],16 // ar.pfs |
243 |
| - ld8.nta r22 = [r3],72 // ar.lc |
244 |
| - ;; |
245 |
| - ld8.nta r24 = [r2],48 // pr |
246 |
| - mov b0 = r16 |
247 |
| - ;; |
248 |
| - ldf.fill.nta f2 = [r2],32 |
249 |
| - ldf.fill.nta f3 = [r3],32 |
250 |
| - mov b1 = r17 |
251 |
| - ;; |
252 |
| - ldf.fill.nta f4 = [r2],32 |
253 |
| - ldf.fill.nta f5 = [r3],32 |
254 |
| - mov b2 = r18 |
255 |
| - ;; |
256 |
| - ldf.fill.nta f16 = [r2],32 |
257 |
| - ldf.fill.nta f17 = [r3],32 |
258 |
| - mov b3 = r19 |
259 |
| - ;; |
260 |
| - ldf.fill.nta f18 = [r2],32 |
261 |
| - ldf.fill.nta f19 = [r3],32 |
262 |
| - mov b4 = r20 |
263 |
| - ;; |
264 |
| - ldf.fill.nta f20 = [r2],32 |
265 |
| - ldf.fill.nta f21 = [r3],32 |
266 |
| - mov b5 = r21 |
267 |
| - ;; |
268 |
| - ldf.fill.nta f22 = [r2],32 |
269 |
| - ldf.fill.nta f23 = [r3],32 |
270 |
| - mov ar.lc = r22 |
271 |
| - ;; |
272 |
| - ldf.fill.nta f24 = [r2],32 |
273 |
| - ldf.fill.nta f25 = [r3],32 |
274 |
| - cmp.eq p6,p7 = 0,in1 |
275 |
| - ;; |
276 |
| - ldf.fill.nta f26 = [r2],32 |
277 |
| - ldf.fill.nta f27 = [r3],32 |
278 |
| - mov ar.pfs = r11 |
279 |
| - ;; |
280 |
| - ldf.fill.nta f28 = [r2],32 |
281 |
| - ldf.fill.nta f29 = [r3],32 |
282 |
| - ;; |
283 |
| - ldf.fill.nta f30 = [r2] |
284 |
| - ldf.fill.nta f31 = [r3] |
285 |
| - (p6) mov r8 = 1 |
286 |
| - (p7) mov r8 = in1 |
287 |
| - |
288 |
| - mov pr = r24,-1 |
289 |
| - br.ret.sptk.few b0 |
290 |
| - .endp _st_md_cxt_restore |
291 |
| - |
292 |
| - /****************************************************************/ |
293 |
| - |
294 |
| - |
295 |
| - |
296 |
| - |
297 |
| - |
298 |
| - |
299 |
| - |
300 |
| - |
301 |
| - |
302 |
| -#elif defined(__i386__) |
| 10 | +#if defined(__i386__) |
303 | 11 |
|
304 | 12 | /****************************************************************/
|
305 | 13 |
|
|
0 commit comments