Rev 4921 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4349 | Serge | 1 | |
2 | |||
3 | |||
6099 | serge | 4 | #define _JBLEN 31 /* 32 GPRs - r0 */ |
5 | #define _JBTYPE unsigned long |
||
6 | #endif |
||
7 | |||
8 | |||
4921 | Serge | 9 | /* |
10 | * All callee preserved registers: |
||
11 | * v1 - v7, fp, ip, sp, lr, f4, f5, f6, f7 |
||
12 | */ |
||
13 | #define _JBLEN 23 |
||
14 | #endif |
||
15 | |||
4349 | Serge | 16 | |
4921 | Serge | 17 | #define _JBLEN 22 |
18 | #define _JBTYPE long long |
||
19 | #endif |
||
20 | |||
21 | |||
22 | #define _JBLEN 24 |
||
23 | #endif |
||
24 | |||
25 | |||
26 | /* |
||
27 | * onsstack,sigmask,sp,pc,npc,psr,g1,o0,wbcnt (sigcontext). |
||
28 | * All else recovered by under/over(flow) handling. |
||
29 | */ |
||
30 | #define _JBLEN 13 |
||
31 | #endif |
||
32 | |||
33 | |||
34 | #define _JBLEN 40 |
||
35 | #endif |
||
36 | |||
37 | |||
38 | /* All callee preserved registers: r4-r10,fp, sp, lr,r15, r32-r39 */ |
||
39 | #define _JBTYPE long long |
||
40 | #define _JBLEN 10 |
||
41 | #endif |
||
42 | |||
43 | |||
44 | |||
45 | |||
46 | /* |
||
47 | * onsstack,sigmask,sp,pc,psl,d2-d7,a2-a6, |
||
48 | * fp2-fp7 for 68881. |
||
49 | * All else recovered by under/over(flow) handling. |
||
50 | */ |
||
51 | #define _JBLEN 34 |
||
52 | #endif |
||
53 | |||
54 | |||
55 | /* |
||
56 | * D, X, Y are not saved. |
||
57 | * Only take into account the pseudo soft registers (max 32). |
||
58 | */ |
||
59 | #define _JBLEN 32 |
||
60 | #endif |
||
61 | |||
62 | |||
63 | /* 17 words for GPRs, |
||
6099 | serge | 64 | 1 word for $fpcfg.freg and 30 words for FPUs |
65 | Reserved 2 words for aligement-adjustment. When storeing double-precision |
||
66 | floating-point register into memory, the address has to be |
||
67 | double-word-aligned. |
||
68 | Check libc/machine/nds32/setjmp.S for more information. */ |
||
69 | #if __NDS32_EXT_FPU_SP__ || __NDS32_EXT_FPU_DP__ |
||
70 | #define _JBLEN 50 |
||
71 | #else |
||
72 | #define _JBLEN 18 |
||
4921 | Serge | 73 | #endif |
74 | #endif |
||
6099 | serge | 75 | |
4921 | Serge | 76 | |
77 | /* 16 regs + pc */ |
||
78 | #define _JBLEN 20 |
||
79 | #endif |
||
80 | |||
81 | |||
82 | /* |
||
83 | * onsstack,sigmask,sp,pc,npc,psr,g1,o0,wbcnt (sigcontext). |
||
84 | * All else recovered by under/over(flow) handling. |
||
85 | */ |
||
86 | #define _JBLEN 9 |
||
87 | #endif |
||
88 | |||
89 | |||
90 | # if defined(__CYGWIN__) && !defined (_JBLEN) |
||
91 | # define _JBLEN (13 * 4) |
||
92 | # elif defined(__unix__) || defined(__rtems__) |
||
93 | # define _JBLEN 9 |
||
94 | # else |
||
95 | # include "setjmp-dj.h" |
||
96 | # endif |
||
97 | #endif |
||
98 | |||
99 | |||
100 | # ifdef __CYGWIN__ |
||
101 | # define _JBTYPE long |
||
102 | # define _JBLEN 32 |
||
103 | # else |
||
104 | # define _JBTYPE long long |
||
105 | # define _JBLEN 8 |
||
106 | # endif |
||
107 | #endif |
||
108 | |||
109 | |||
110 | #define _JBLEN 35 |
||
111 | #endif |
||
112 | |||
113 | |||
114 | /* Only 8 words are currently needed. 10 gives us some slop if we need |
||
115 | to expand. */ |
||
116 | #define _JBLEN 10 |
||
117 | #endif |
||
118 | |||
119 | |||
120 | # if defined(__mips64) |
||
6099 | serge | 121 | # define _JBTYPE long long |
4921 | Serge | 122 | # endif |
123 | # ifdef __mips_soft_float |
||
124 | # define _JBLEN 11 |
||
125 | # else |
||
126 | # define _JBLEN 23 |
||
127 | # endif |
||
128 | #endif |
||
129 | |||
130 | |||
131 | #define _JBLEN 21 |
||
132 | #endif |
||
133 | |||
134 | |||
135 | #define _JBLEN 5 |
||
136 | #define _JBTYPE int |
||
137 | #endif |
||
138 | |||
139 | |||
140 | /* same as H8/300 but registers are twice as big */ |
||
141 | #define _JBLEN 5 |
||
142 | #define _JBTYPE long |
||
143 | #endif |
||
144 | |||
145 | |||
146 | /* same as H8/300 but registers are twice as big */ |
||
147 | #define _JBLEN 5 |
||
148 | #define _JBTYPE long |
||
149 | #endif |
||
150 | |||
151 | |||
152 | #define _JBLEN 4 |
||
153 | #endif |
||
154 | |||
155 | |||
156 | #if __SH5__ |
||
157 | #define _JBLEN 50 |
||
158 | #define _JBTYPE long long |
||
159 | #else |
||
160 | #define _JBLEN 20 |
||
161 | #endif /* __SH5__ */ |
||
162 | #endif |
||
163 | |||
164 | |||
165 | #define _JBLEN 28 |
||
166 | #endif |
||
167 | |||
168 | |||
169 | #ifdef __ALTIVEC__ |
||
170 | #define _JBLEN 64 |
||
171 | #else |
||
172 | #define _JBLEN 32 |
||
173 | #endif |
||
174 | #define _JBTYPE double |
||
175 | #endif |
||
176 | |||
177 | |||
178 | #define _JBLEN 20 |
||
179 | #define _JBTYPE unsigned int |
||
180 | #endif |
||
181 | |||
182 | |||
183 | /* %r30, %r2-%r18, %r27, pad, %fr12-%fr15. |
||
184 | Note space exists for the FP registers, but they are not |
||
185 | saved. */ |
||
186 | #define _JBLEN 28 |
||
187 | #endif |
||
188 | |||
189 | |||
190 | #ifdef __AM33_2__ |
||
191 | #define _JBLEN 26 |
||
192 | #else |
||
193 | /* A guess */ |
||
194 | #define _JBLEN 10 |
||
195 | #endif |
||
196 | #endif |
||
197 | |||
198 | |||
199 | /* I think our setjmp is saving 15 regs at the moment. Gives us one word |
||
200 | slop if we need to expand. */ |
||
201 | #define _JBLEN 16 |
||
202 | #endif |
||
203 | |||
204 | |||
205 | #define _JBLEN 10 |
||
206 | #endif |
||
207 | #if defined(_C3x) |
||
208 | #define _JBLEN 9 |
||
209 | #endif |
||
210 | |||
211 | |||
212 | #define _JBLEN 13 |
||
213 | #endif |
||
214 | |||
215 | |||
216 | #define _JBLEN 13 |
||
217 | #endif |
||
218 | |||
219 | |||
220 | #define _JBLEN 8 |
||
221 | #endif |
||
222 | |||
223 | |||
224 | #define _JBLEN ((64 /* GPR */ + (2*2) /* ACs */ + 18 /* CRs */) / 2) |
||
225 | #define _JBTYPE double |
||
226 | #endif |
||
227 | |||
228 | |||
229 | #define _JBLEN (68/2) /* room for 68 32-bit regs */ |
||
230 | #define _JBTYPE double |
||
231 | #endif |
||
232 | |||
233 | |||
234 | #define _JBLEN 16 |
||
235 | #endif |
||
236 | |||
237 | |||
238 | #define _JBLEN 9 |
||
239 | #endif |
||
240 | |||
241 | |||
242 | /* r6, r7, r8, r9, r10, r11, r12 (r12L, r12H), |
||
243 | * r13 (r13L, r13H), ra(raL, raH), sp(spL, spH) */ |
||
244 | #define _JBLEN 14 |
||
245 | #define _JBTYPE unsigned short |
||
246 | #endif |
||
247 | |||
248 | |||
249 | #define _JBLEN 10 |
||
250 | #endif |
||
251 | |||
252 | |||
6099 | serge | 253 | #define _JBLEN 27 |
254 | #endif |
||
255 | |||
256 | |||
4921 | Serge | 257 | #define _JBLEN 32 |
258 | #endif |
||
259 | |||
260 | |||
261 | #define _JBLEN 16 |
||
262 | #endif |
||
263 | |||
264 | |||
6099 | serge | 265 | #define _JBLEN 25 /* r13-r30,blink,lp_count,lp_start,lp_end,mlo,mhi,status32 */ |
266 | #endif |
||
267 | |||
268 | |||
4921 | Serge | 269 | /* Using a layout compatible with GCC's built-in. */ |
270 | #define _JBLEN 5 |
||
271 | #define _JBTYPE unsigned long |
||
272 | #endif |
||
273 | |||
274 | |||
275 | #define _JBLEN 16 |
||
276 | #endif |
||
277 | |||
278 | |||
279 | #define _JBLEN 50 |
||
280 | #define _JBTYPE __vector signed int |
||
281 | #endif |
||
282 | |||
283 | |||
284 | /* 4 GPRs plus SP plus PC. */ |
||
285 | #define _JBLEN 8 |
||
286 | #endif |
||
287 | |||
288 | |||
289 | /* 16 GPRs, pc, hi, lo */ |
||
290 | #define _JBLEN 19 |
||
291 | #endif |
||
292 | |||
293 | |||
294 | #define _JBLEN 18 |
||
295 | #endif |
||
296 | |||
297 | |||
6099 | serge | 298 | #define _JBLEN 64 |
299 | #endif |
||
300 | |||
301 | |||
4921 | Serge | 302 | #define _JBLEN 19 |
303 | #endif |
||
304 | |||
305 | |||
306 | #if defined(__r8c_cpu__) || defined(__m16c_cpu__) |
||
307 | #define _JBLEN (22/2) |
||
308 | #else |
||
309 | #define _JBLEN (34/2) |
||
310 | #endif |
||
311 | #define _JBTYPE unsigned short |
||
312 | #endif /* __m32c__ */ |
||
313 | |||
314 | |||
315 | #define _JBLEN 9 |
||
316 | |||
317 | |||
318 | #define _JBTYPE unsigned long |
||
319 | #else |
||
320 | #define _JBTYPE unsigned short |
||
321 | #endif |
||
322 | #endif |
||
323 | |||
324 | |||
325 | /* Three banks of registers, SP, CS, ES, PC */ |
||
326 | #define _JBLEN (8*3+8) |
||
327 | #define _JBTYPE unsigned char |
||
328 | #endif |
||
329 | |||
330 | |||
331 | * There are two versions of setjmp()/longjmp(): |
||
332 | * 1) Compiler (gcc) built-in versions. |
||
333 | * 2) Function-call versions. |
||
334 | * |
||
335 | * The built-in versions are used most of the time. When used, gcc replaces |
||
336 | * calls to setjmp()/longjmp() with inline assembly code. The built-in |
||
337 | * versions save/restore a variable number of registers. |
||
338 | |||
339 | |||
340 | * It only needs to be 12 for the function-call versions |
||
341 | * but this data structure is used by both versions. |
||
342 | */ |
||
343 | #ifdef __NIOS2__ |
||
344 | #define _JBLEN 40 |
||
345 | #define _JBTYPE unsigned long |
||
346 | #endif |
||
347 | |||
348 | |||
349 | #define _JBLEN 0x44 |
||
350 | #endif |
||
351 | |||
352 | |||
6099 | serge | 353 | /* All call-saved GP registers: r11-r19,r21,r22,r23. */ |
354 | #define _JBLEN 12 |
||
355 | #endif |
||
356 | |||
357 | |||
4921 | Serge | 358 | #ifdef _JBTYPE |
359 | typedef _JBTYPE jmp_buf[_JBLEN]; |
||
360 | #else |
||
361 | typedef int jmp_buf[_JBLEN]; |
||
362 | #endif |
||
363 | #endif |
||
364 | |||
365 | |||
4349 | Serge | 366 | |
367 | |||
4921 | Serge | 368 | #include |
369 | |||
4349 | Serge | 370 | |
4921 | Serge | 371 | extern "C" { |
372 | #endif |
||
373 | |||
374 | |||
375 | #ifdef _JBTYPE |
||
376 | typedef _JBTYPE sigjmp_buf[_JBLEN+1+((sizeof (_JBTYPE) + sizeof (sigset_t) - 1) |
||
377 | /sizeof (_JBTYPE))]; |
||
378 | #else |
||
379 | typedef int sigjmp_buf[_JBLEN+1+(sizeof (sigset_t)/sizeof (int))]; |
||
380 | #endif |
||
381 | |||
382 | |||
383 | #define _SIGMASK (_JBLEN+1) |
||
384 | |||
385 | |||
386 | # define _CYGWIN_WORKING_SIGSETJMP |
||
387 | #endif |
||
388 | |||
389 | |||
390 | #define __SIGMASK_FUNC pthread_sigmask |
||
391 | #else |
||
392 | #define __SIGMASK_FUNC sigprocmask |
||
393 | #endif |
||
394 | |||
395 | |||
6099 | serge | 396 | /* Per POSIX, siglongjmp has to be implemented as function. Cygwin |
397 | provides functions for both, siglongjmp and sigsetjmp since 2.2.0. */ |
||
398 | extern void siglongjmp (sigjmp_buf, int) __attribute__ ((__noreturn__)); |
||
399 | extern int sigsetjmp (sigjmp_buf, int); |
||
400 | #endif |
||
401 | |||
402 | |||
4921 | Serge | 403 | |
404 | |||
405 | __extension__ \ |
||
406 | ({ \ |
||
407 | sigjmp_buf *_sjbuf = &(env); \ |
||
408 | ((*_sjbuf)[_SAVEMASK] = savemask,\ |
||
409 | __SIGMASK_FUNC (SIG_SETMASK, 0, (sigset_t *)((*_sjbuf) + _SIGMASK)),\ |
||
410 | setjmp (*_sjbuf)); \ |
||
411 | }) |
||
412 | |||
413 | |||
414 | __extension__ \ |
||
415 | ({ \ |
||
416 | sigjmp_buf *_sjbuf = &(env); \ |
||
417 | ((((*_sjbuf)[_SAVEMASK]) ? \ |
||
418 | __SIGMASK_FUNC (SIG_SETMASK, (sigset_t *)((*_sjbuf) + _SIGMASK), 0)\ |
||
419 | : 0), \ |
||
420 | longjmp (*_sjbuf, val)); \ |
||
421 | }) |
||
422 | |||
423 | |||
424 | |||
425 | |||
426 | __SIGMASK_FUNC (SIG_SETMASK, 0, (sigset_t *) ((env) + _SIGMASK)),\ |
||
427 | setjmp (env)) |
||
428 | |||
429 | |||
430 | __SIGMASK_FUNC (SIG_SETMASK, (sigset_t *) ((env) + _SIGMASK), 0):0),\ |
||
431 | longjmp (env, val)) |
||
432 | |||
433 | |||
434 | |||
435 | |||
436 | are equivalent to sigsetjmp/siglongjmp when not saving the signal mask. |
||
437 | New applications should use sigsetjmp/siglongjmp instead. */ |
||
438 | #ifdef __CYGWIN__ |
||
439 | extern void _longjmp (jmp_buf, int) __attribute__ ((__noreturn__)); |
||
6099 | serge | 440 | extern int _setjmp (jmp_buf); |
441 | #else |
||
4921 | Serge | 442 | #define _setjmp(env) sigsetjmp ((env), 0) |
443 | #define _longjmp(env, val) siglongjmp ((env), (val)) |
||
444 | #endif |
||
445 | |||
446 | |||
447 | } |
||
448 | #endif |
||
449 | #endif /* __CYGWIN__ or __rtems__ */ |
||
450 |