4 #if defined(__or1k__) || defined(__or1knd__)
6 * r1, r2, r9, r14, r16 .. r30, SR.
9 #define _JBTYPE unsigned long
12 #if defined(__arm__) || defined(__thumb__)
14 * All callee preserved registers:
16 * r4 - r10, fp, sp, lr
17 * VFP registers (architectural support dependent):
21 #define _JBTYPE long long
24 #if defined(__aarch64__)
26 #define _JBTYPE long long
35 * onsstack,sigmask,sp,pc,npc,psr,g1,o0,wbcnt (sigcontext).
36 * All else recovered by under/over(flow) handling.
46 /* All callee preserved registers: r4-r10,fp, sp, lr,r15, r32-r39 */
47 #define _JBTYPE long long
51 /* necv70 was 9 as well. */
53 #if defined(__m68k__) || defined(__mc68000__)
55 * onsstack,sigmask,sp,pc,psl,d2-d7,a2-a6,
57 * All else recovered by under/over(flow) handling.
62 #if defined(__mc68hc11__) || defined(__mc68hc12__) || defined(__mc68hc1x__)
64 * D, X, Y are not saved.
65 * Only take into account the pseudo soft registers (max 32).
72 1 word for $fpcfg.freg and 30 words for FPUs
73 Reserved 2 words for aligement-adjustment. When storeing double-precision
74 floating-point register into memory, the address has to be
76 Check libc/machine/nds32/setjmp.S for more information. */
77 #if __NDS32_EXT_FPU_SP__ || __NDS32_EXT_FPU_DP__
84 #if defined(__Z8001__) || defined(__Z8002__)
91 * onsstack,sigmask,sp,pc,npc,psr,g1,o0,wbcnt (sigcontext).
92 * All else recovered by under/over(flow) handling.
98 # if defined(__CYGWIN__) && !defined (_JBLEN)
99 # define _JBLEN (13 * 4)
100 # elif defined(__unix__) || defined(__rtems__)
102 # elif defined(__iamcu__)
103 /* Intel MCU jmp_buf only covers callee-saved registers. */
106 # include "setjmp-dj.h"
112 # define _JBTYPE long
115 # define _JBTYPE long long
125 /* Only 8 words are currently needed. 10 gives us some slop if we need
131 # if defined(__mips64)
132 # define _JBTYPE long long
134 # ifdef __mips_soft_float
151 /* same as H8/300 but registers are twice as big */
156 #if defined (__H8300S__) || defined (__H8300SX__)
157 /* same as H8/300 but registers are twice as big */
169 #define _JBTYPE long long
193 #define _JBTYPE double
196 #ifdef __MICROBLAZE__
198 #define _JBTYPE unsigned int
202 /* %r30, %r2-%r18, %r27, pad, %fr12-%fr15.
203 Note space exists for the FP registers, but they are not
208 #if defined(__mn10300__) || defined(__mn10200__)
218 /* I think our setjmp is saving 15 regs at the moment. Gives us one word
219 slop if we need to expand. */
243 #define _JBLEN ((64 /* GPR */ + (2*2) /* ACs */ + 18 /* CRs */) / 2)
244 #define _JBTYPE double
248 #define _JBLEN (68/2) /* room for 68 32-bit regs */
249 #define _JBTYPE double
260 #if (defined(__CR16__) || defined(__CR16C__) ||defined(__CR16CP__))
261 /* r6, r7, r8, r9, r10, r11, r12 (r12L, r12H),
262 * r13 (r13L, r13H), ra(raL, raH), sp(spL, spH) */
264 #define _JBTYPE unsigned short
284 #define _JBLEN 25 /* r13-r30,blink,lp_count,lp_start,lp_end,status32,r58,r59 */
288 /* r14-r27,sp,ilink,r30,blink */
290 #ifdef __ARC64_ARCH64__
291 #define _JBTYPE long long
292 #else /* __ARC64_ARCH32__ */
295 #endif /* __ARC64__ */
298 /* Using a layout compatible with GCC's built-in. */
300 #define _JBTYPE unsigned long
309 #define _JBTYPE __vector signed int
313 /* 4 GPRs plus SP plus PC. */
318 #if __XTENSA_WINDOWED_ABI__
320 /* The jmp_buf structure for Xtensa windowed ABI holds the following
321 (where "proc" is the procedure that calls setjmp): 4-12 registers
322 from the window of proc, the 4 words from the save area at proc's $sp
323 (in case a subsequent alloca in proc moves $sp), and the return
324 address within proc. Everything else is saved on the stack in the
325 normal save areas. The jmp_buf structure is:
330 void *return_address;
333 See the setjmp code for details. */
335 /* sizeof(struct jmp_buf) */
338 #else /* __XTENSA_CALL0_ABI__ */
340 /* a0, a1, a12, a13, a14, a15 */
343 #endif /* __XTENSA_CALL0_ABI__ */
344 #endif /* __XTENSA__ */
347 /* 16 GPRs, pc, hi, lo */
364 #if defined(__r8c_cpu__) || defined(__m16c_cpu__)
365 #define _JBLEN (22/2)
367 #define _JBLEN (34/2)
369 #define _JBTYPE unsigned short
370 #endif /* __m32c__ */
375 #ifdef __MSP430X_LARGE__
376 #define _JBTYPE unsigned long
378 #define _JBTYPE unsigned short
383 /* Three banks of registers, SP, CS, ES, PC */
384 #define _JBLEN (8*3+8)
385 #define _JBTYPE unsigned char
389 * There are two versions of setjmp()/longjmp():
390 * 1) Compiler (gcc) built-in versions.
391 * 2) Function-call versions.
393 * The built-in versions are used most of the time. When used, gcc replaces
394 * calls to setjmp()/longjmp() with inline assembly code. The built-in
395 * versions save/restore a variable number of registers.
397 * _JBLEN is set to 40 to be ultra-safe with the built-in versions.
398 * It only needs to be 12 for the function-call versions
399 * but this data structure is used by both versions.
403 #define _JBTYPE unsigned long
408 #define _JBTYPE unsigned int
416 /* All call-saved GP registers: r11-r19,r21,r22,r23. */
421 /* _JBTYPE using long long to make sure the alignment is align to 8 byte,
422 otherwise in rv32imafd, store/restore FPR may mis-align. */
423 #define _JBTYPE long long
425 #define _JBLEN ((4*sizeof(long))/sizeof(long))
427 #define _JBLEN ((14*sizeof(long) + 12*sizeof(double))/sizeof(long))
432 #define _JBTYPE unsigned long
433 #if defined(__CK801__)
435 #elif defined(__CK802__)
444 typedef _JBTYPE
jmp_buf[_JBLEN
];
446 typedef int jmp_buf[_JBLEN
];
452 #if (defined(__CYGWIN__) || defined(__rtems__)) && __POSIX_VISIBLE
459 /* POSIX sigsetjmp/siglongjmp macros */
461 typedef _JBTYPE sigjmp_buf
[_JBLEN
+1+((sizeof (_JBTYPE
) + sizeof (sigset_t
) - 1)
464 typedef int sigjmp_buf
[_JBLEN
+1+(sizeof (sigset_t
)/sizeof (int))];
467 #define _SAVEMASK _JBLEN
468 #define _SIGMASK (_JBLEN+1)
471 # define _CYGWIN_WORKING_SIGSETJMP
474 #ifdef _POSIX_THREADS
475 #define __SIGMASK_FUNC pthread_sigmask
477 #define __SIGMASK_FUNC sigprocmask
481 /* Per POSIX, siglongjmp has to be implemented as function. Cygwin
482 provides functions for both, siglongjmp and sigsetjmp since 2.2.0. */
483 extern void siglongjmp (sigjmp_buf
, int) __attribute__ ((__noreturn__
));
484 extern int sigsetjmp (sigjmp_buf
, int);
487 #if defined(__GNUC__)
489 #define sigsetjmp(env, savemask) \
492 sigjmp_buf *_sjbuf = &(env); \
493 ((*_sjbuf)[_SAVEMASK] = savemask,\
494 __SIGMASK_FUNC (SIG_SETMASK, 0, (sigset_t *)((*_sjbuf) + _SIGMASK)),\
498 #define siglongjmp(env, val) \
501 sigjmp_buf *_sjbuf = &(env); \
502 ((((*_sjbuf)[_SAVEMASK]) ? \
503 __SIGMASK_FUNC (SIG_SETMASK, (sigset_t *)((*_sjbuf) + _SIGMASK), 0)\
505 longjmp (*_sjbuf, val)); \
508 #else /* !__GNUC__ */
510 #define sigsetjmp(env, savemask) ((env)[_SAVEMASK] = savemask,\
511 __SIGMASK_FUNC (SIG_SETMASK, 0, (sigset_t *) ((env) + _SIGMASK)),\
514 #define siglongjmp(env, val) ((((env)[_SAVEMASK])?\
515 __SIGMASK_FUNC (SIG_SETMASK, (sigset_t *) ((env) + _SIGMASK), 0):0),\
520 /* POSIX _setjmp/_longjmp, maintained for XSI compatibility. These
521 are equivalent to sigsetjmp/siglongjmp when not saving the signal mask.
522 New applications should use sigsetjmp/siglongjmp instead. */
524 extern void _longjmp (jmp_buf, int) __attribute__ ((__noreturn__
));
525 extern int _setjmp (jmp_buf);
527 #define _setjmp(env) sigsetjmp ((env), 0)
528 #define _longjmp(env, val) siglongjmp ((env), (val))
534 #endif /* (__CYGWIN__ or __rtems__) and __POSIX_VISIBLE */