2002-06-28 07:58:38 +08:00
|
|
|
|
|
|
|
_BEGIN_STD_C
|
|
|
|
|
2014-12-13 05:14:06 +08:00
|
|
|
#if defined(__or1k__) || defined(__or1knd__)
|
2014-07-18 02:43:05 +08:00
|
|
|
#define _JBLEN 31 /* 32 GPRs - r0 */
|
|
|
|
#define _JBTYPE unsigned long
|
|
|
|
#endif
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
#if defined(__arm__) || defined(__thumb__)
|
|
|
|
/*
|
|
|
|
* All callee preserved registers:
|
|
|
|
* v1 - v7, fp, ip, sp, lr, f4, f5, f6, f7
|
|
|
|
*/
|
|
|
|
#define _JBLEN 23
|
|
|
|
#endif
|
|
|
|
|
2012-09-27 04:06:50 +08:00
|
|
|
#if defined(__aarch64__)
|
|
|
|
#define _JBLEN 22
|
|
|
|
#define _JBTYPE long long
|
|
|
|
#endif
|
|
|
|
|
2004-10-26 01:53:19 +08:00
|
|
|
#if defined(__AVR__)
|
|
|
|
#define _JBLEN 24
|
|
|
|
#endif
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
#ifdef __sparc__
|
|
|
|
/*
|
|
|
|
* onsstack,sigmask,sp,pc,npc,psr,g1,o0,wbcnt (sigcontext).
|
|
|
|
* All else recovered by under/over(flow) handling.
|
|
|
|
*/
|
|
|
|
#define _JBLEN 13
|
|
|
|
#endif
|
|
|
|
|
2006-11-09 03:26:43 +08:00
|
|
|
#ifdef __BFIN__
|
|
|
|
#define _JBLEN 40
|
|
|
|
#endif
|
|
|
|
|
2012-02-22 06:34:31 +08:00
|
|
|
#ifdef __epiphany__
|
|
|
|
/* All callee preserved registers: r4-r10,fp, sp, lr,r15, r32-r39 */
|
|
|
|
#define _JBTYPE long long
|
|
|
|
#define _JBLEN 10
|
|
|
|
#endif
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
/* necv70 was 9 as well. */
|
|
|
|
|
2009-12-18 03:24:22 +08:00
|
|
|
#if defined(__m68k__) || defined(__mc68000__)
|
2000-02-18 03:39:52 +08:00
|
|
|
/*
|
|
|
|
* onsstack,sigmask,sp,pc,psl,d2-d7,a2-a6,
|
|
|
|
* fp2-fp7 for 68881.
|
|
|
|
* All else recovered by under/over(flow) handling.
|
|
|
|
*/
|
|
|
|
#define _JBLEN 34
|
|
|
|
#endif
|
|
|
|
|
2002-07-24 23:44:24 +08:00
|
|
|
#if defined(__mc68hc11__) || defined(__mc68hc12__) || defined(__mc68hc1x__)
|
|
|
|
/*
|
|
|
|
* D, X, Y are not saved.
|
|
|
|
* Only take into account the pseudo soft registers (max 32).
|
|
|
|
*/
|
|
|
|
#define _JBLEN 32
|
|
|
|
#endif
|
|
|
|
|
2013-07-10 03:06:47 +08:00
|
|
|
#ifdef __nds32__
|
2014-12-15 21:32:17 +08:00
|
|
|
/* 17 words for GPRs,
|
|
|
|
1 word for $fpcfg.freg and 30 words for FPUs
|
|
|
|
Reserved 2 words for aligement-adjustment. When storeing double-precision
|
|
|
|
floating-point register into memory, the address has to be
|
|
|
|
double-word-aligned.
|
|
|
|
Check libc/machine/nds32/setjmp.S for more information. */
|
|
|
|
#if __NDS32_EXT_FPU_SP__ || __NDS32_EXT_FPU_DP__
|
|
|
|
#define _JBLEN 50
|
|
|
|
#else
|
2013-07-10 03:06:47 +08:00
|
|
|
#define _JBLEN 18
|
|
|
|
#endif
|
2014-12-15 21:32:17 +08:00
|
|
|
#endif
|
2013-07-10 03:06:47 +08:00
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
#if defined(__Z8001__) || defined(__Z8002__)
|
|
|
|
/* 16 regs + pc */
|
|
|
|
#define _JBLEN 20
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef _AM29K
|
|
|
|
/*
|
|
|
|
* onsstack,sigmask,sp,pc,npc,psr,g1,o0,wbcnt (sigcontext).
|
|
|
|
* All else recovered by under/over(flow) handling.
|
|
|
|
*/
|
|
|
|
#define _JBLEN 9
|
|
|
|
#endif
|
|
|
|
|
2013-04-23 17:42:25 +08:00
|
|
|
#ifdef __i386__
|
|
|
|
# if defined(__CYGWIN__) && !defined (_JBLEN)
|
|
|
|
# define _JBLEN (13 * 4)
|
|
|
|
# elif defined(__unix__) || defined(__rtems__)
|
|
|
|
# define _JBLEN 9
|
2016-03-31 17:12:00 +08:00
|
|
|
# elif defined(__iamcu__)
|
|
|
|
/* Intel MCU jmp_buf only covers callee-saved registers. */
|
|
|
|
# define _JBLEN 6
|
2013-04-23 17:42:25 +08:00
|
|
|
# else
|
|
|
|
# include "setjmp-dj.h"
|
|
|
|
# endif
|
2000-02-18 03:39:52 +08:00
|
|
|
#endif
|
|
|
|
|
2007-08-29 05:56:50 +08:00
|
|
|
#ifdef __x86_64__
|
2013-04-23 17:42:25 +08:00
|
|
|
# ifdef __CYGWIN__
|
|
|
|
# define _JBTYPE long
|
|
|
|
# define _JBLEN 32
|
|
|
|
# else
|
|
|
|
# define _JBTYPE long long
|
|
|
|
# define _JBLEN 8
|
|
|
|
# endif
|
2007-08-29 05:56:50 +08:00
|
|
|
#endif
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
#ifdef __i960__
|
|
|
|
#define _JBLEN 35
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __M32R__
|
|
|
|
/* Only 8 words are currently needed. 10 gives us some slop if we need
|
|
|
|
to expand. */
|
|
|
|
#define _JBLEN 10
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __mips__
|
2014-11-28 16:47:39 +08:00
|
|
|
# if defined(__mips64)
|
2013-11-27 03:58:19 +08:00
|
|
|
# define _JBTYPE long long
|
|
|
|
# endif
|
|
|
|
# ifdef __mips_soft_float
|
|
|
|
# define _JBLEN 11
|
|
|
|
# else
|
|
|
|
# define _JBLEN 23
|
|
|
|
# endif
|
2001-03-09 05:39:32 +08:00
|
|
|
#endif
|
2000-02-18 03:39:52 +08:00
|
|
|
|
|
|
|
#ifdef __m88000__
|
|
|
|
#define _JBLEN 21
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __H8300__
|
|
|
|
#define _JBLEN 5
|
2004-06-23 06:11:54 +08:00
|
|
|
#define _JBTYPE int
|
2000-02-18 03:39:52 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __H8300H__
|
|
|
|
/* same as H8/300 but registers are twice as big */
|
|
|
|
#define _JBLEN 5
|
|
|
|
#define _JBTYPE long
|
|
|
|
#endif
|
|
|
|
|
2004-06-23 05:54:52 +08:00
|
|
|
#if defined (__H8300S__) || defined (__H8300SX__)
|
2000-02-18 03:39:52 +08:00
|
|
|
/* same as H8/300 but registers are twice as big */
|
|
|
|
#define _JBLEN 5
|
|
|
|
#define _JBTYPE long
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __H8500__
|
|
|
|
#define _JBLEN 4
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __sh__
|
2002-02-08 15:11:13 +08:00
|
|
|
#if __SH5__
|
|
|
|
#define _JBLEN 50
|
|
|
|
#define _JBTYPE long long
|
|
|
|
#else
|
2000-02-18 03:39:52 +08:00
|
|
|
#define _JBLEN 20
|
2002-02-08 15:11:13 +08:00
|
|
|
#endif /* __SH5__ */
|
2000-02-18 03:39:52 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __v800
|
|
|
|
#define _JBLEN 28
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __PPC__
|
2002-04-20 03:16:22 +08:00
|
|
|
#ifdef __ALTIVEC__
|
|
|
|
#define _JBLEN 64
|
|
|
|
#else
|
2000-02-18 03:39:52 +08:00
|
|
|
#define _JBLEN 32
|
2002-04-20 03:16:22 +08:00
|
|
|
#endif
|
2000-02-18 03:39:52 +08:00
|
|
|
#define _JBTYPE double
|
|
|
|
#endif
|
|
|
|
|
2009-09-28 Michael Eager <eager@eagercon.com>
* configure.host: Add microblaze.
* libc/include/machine/ieeefp.h [MICROBLAZE]: Define __IEEE_BIG_ENDIAN.
* libc/include/machine/setjmp.h [MICROBLAZE]: Define _JBLEN, _JBTYPE.
* libc/include/sys/config.h [MICROBLAZE]: Define _REENT_SMALL,
_UNIX98_THREAD_MUTEX_ATTRIBUTES.
* libc/include/sys/types.h: Treat XMK like rtems, define
PTHREAD_MUTEX_NORMAL, PTHREAD_MUTEX_ERRORCHECK, PTHREAD_MUTEX_RECURSIVE,
PTHREAD_MUTEX_DEFAULT, PTHREAD_STACK_MIN, define stuct pthread_attr_s.
* libc/machine/configure.in: Add microblaze.
* libc/machine/configure: Add microblaze (not regenerated).
* libc/machine/microblaze/configure.in: NEW.
* libc/machine/microblaze/configure: Generate.
* libc/machine/microblaze/Makefile.am: NEW.
* libc/machine/microblaze/Makefile.in: Generate.
* libc/machine/microblaze/{abort.c, strcmp.c, strcpy.c, strlen.c,
mallocr.c, longjmp.S, setjmp.S}: NEW.
* libc/stdlib/mallocr.c [MICROBLAZE]: Don't declare sbrk prototype,
mALLOc(): return malloc value.
2009-09-29 00:42:21 +08:00
|
|
|
#ifdef __MICROBLAZE__
|
|
|
|
#define _JBLEN 20
|
|
|
|
#define _JBTYPE unsigned int
|
|
|
|
#endif
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
#ifdef __hppa__
|
|
|
|
/* %r30, %r2-%r18, %r27, pad, %fr12-%fr15.
|
|
|
|
Note space exists for the FP registers, but they are not
|
|
|
|
saved. */
|
|
|
|
#define _JBLEN 28
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(__mn10300__) || defined(__mn10200__)
|
2003-07-11 03:04:43 +08:00
|
|
|
#ifdef __AM33_2__
|
|
|
|
#define _JBLEN 26
|
|
|
|
#else
|
2000-02-18 03:39:52 +08:00
|
|
|
/* A guess */
|
|
|
|
#define _JBLEN 10
|
|
|
|
#endif
|
2003-07-11 03:04:43 +08:00
|
|
|
#endif
|
2000-02-18 03:39:52 +08:00
|
|
|
|
|
|
|
#ifdef __v850
|
|
|
|
/* I think our setjmp is saving 15 regs at the moment. Gives us one word
|
|
|
|
slop if we need to expand. */
|
|
|
|
#define _JBLEN 16
|
|
|
|
#endif
|
|
|
|
|
2004-02-03 00:59:53 +08:00
|
|
|
#if defined(_C4x)
|
|
|
|
#define _JBLEN 10
|
|
|
|
#endif
|
|
|
|
#if defined(_C3x)
|
|
|
|
#define _JBLEN 9
|
|
|
|
#endif
|
|
|
|
|
2010-10-09 10:33:30 +08:00
|
|
|
#ifdef __TMS320C6X__
|
|
|
|
#define _JBLEN 13
|
|
|
|
#endif
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
#ifdef __TIC80__
|
|
|
|
#define _JBLEN 13
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __D10V__
|
|
|
|
#define _JBLEN 8
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __D30V__
|
|
|
|
#define _JBLEN ((64 /* GPR */ + (2*2) /* ACs */ + 18 /* CRs */) / 2)
|
|
|
|
#define _JBTYPE double
|
|
|
|
#endif
|
|
|
|
|
2002-06-19 05:20:28 +08:00
|
|
|
#ifdef __frv__
|
|
|
|
#define _JBLEN (68/2) /* room for 68 32-bit regs */
|
|
|
|
#define _JBTYPE double
|
|
|
|
#endif
|
|
|
|
|
2009-04-23 03:52:49 +08:00
|
|
|
#ifdef __moxie__
|
|
|
|
#define _JBLEN 16
|
|
|
|
#endif
|
|
|
|
|
2004-10-06 03:44:24 +08:00
|
|
|
#ifdef __CRX__
|
|
|
|
#define _JBLEN 9
|
|
|
|
#endif
|
|
|
|
|
2010-12-03 03:30:47 +08:00
|
|
|
#if (defined(__CR16__) || defined(__CR16C__) ||defined(__CR16CP__))
|
|
|
|
/* r6, r7, r8, r9, r10, r11, r12 (r12L, r12H),
|
|
|
|
* r13 (r13L, r13H), ra(raL, raH), sp(spL, spH) */
|
|
|
|
#define _JBLEN 14
|
|
|
|
#define _JBTYPE unsigned short
|
|
|
|
#endif
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
#ifdef __fr30__
|
|
|
|
#define _JBLEN 10
|
|
|
|
#endif
|
|
|
|
|
2015-09-05 01:17:53 +08:00
|
|
|
#ifdef __FT32__
|
|
|
|
#define _JBLEN 27
|
|
|
|
#endif
|
|
|
|
|
2003-06-10 23:32:27 +08:00
|
|
|
#ifdef __iq2000__
|
|
|
|
#define _JBLEN 32
|
|
|
|
#endif
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
#ifdef __mcore__
|
|
|
|
#define _JBLEN 16
|
|
|
|
#endif
|
|
|
|
|
2015-10-24 02:24:50 +08:00
|
|
|
#ifdef __arc__
|
|
|
|
#define _JBLEN 25 /* r13-r30,blink,lp_count,lp_start,lp_end,mlo,mhi,status32 */
|
|
|
|
#endif
|
|
|
|
|
2001-11-12 Hans-Peter Nilsson <hp@bitrange.com>
* libc/include/machine/ieeefp.h: Add support for mmix target.
* libc/include/machine/setjmp.h: Ditto.
* configure.host: Ditto.
* libc/sys/mmixware/Makefile.am, libc/sys/mmixware/_exit.c,
libc/sys/mmixware/access.c, libc/sys/mmixware/aclocal.m4,
libc/sys/mmixware/chmod.c, libc/sys/mmixware/chown.c,
libc/sys/mmixware/close.c, libc/sys/mmixware/configure.in,
libc/sys/mmixware/creat.c, libc/sys/mmixware/crt0.c,
libc/sys/mmixware/execv.c, libc/sys/mmixware/execve.c,
libc/sys/mmixware/fork.c, libc/sys/mmixware/fstat.c,
libc/sys/mmixware/getpid.c, libc/sys/mmixware/gettime.c,
libc/sys/mmixware/isatty.c, libc/sys/mmixware/kill.c,
libc/sys/mmixware/lseek.c, libc/sys/mmixware/open.c,
libc/sys/mmixware/pipe.c, libc/sys/mmixware/read.c,
libc/sys/mmixware/sbrk.c, libc/sys/mmixware/setjmp.S,
libc/sys/mmixware/stat.c, libc/sys/mmixware/sys/syscall.h,
libc/sys/mmixware/time.c, libc/sys/mmixware/times.c,
libc/sys/mmixware/unlink.c, libc/sys/mmixware/utime.c,
libc/sys/mmixware/wait.c, libc/sys/mmixware/write.c: New files.
* libc/sys/mmixware/configure, libc/sys/mmixware/Makefile.in,
libc/sys/mmixware/aclocal.m4: Generate.
2001-11-13 05:04:41 +08:00
|
|
|
#ifdef __MMIX__
|
|
|
|
/* Using a layout compatible with GCC's built-in. */
|
|
|
|
#define _JBLEN 5
|
|
|
|
#define _JBTYPE unsigned long
|
|
|
|
#endif
|
|
|
|
|
2005-12-14 06:57:31 +08:00
|
|
|
#ifdef __mt__
|
2005-07-06 21:14:10 +08:00
|
|
|
#define _JBLEN 16
|
|
|
|
#endif
|
|
|
|
|
2006-08-17 05:39:43 +08:00
|
|
|
#ifdef __SPU__
|
|
|
|
#define _JBLEN 50
|
2006-12-19 00:48:03 +08:00
|
|
|
#define _JBTYPE __vector signed int
|
2006-08-17 05:39:43 +08:00
|
|
|
#endif
|
|
|
|
|
2001-12-23 06:47:58 +08:00
|
|
|
#ifdef __xstormy16__
|
|
|
|
/* 4 GPRs plus SP plus PC. */
|
|
|
|
#define _JBLEN 8
|
|
|
|
#endif
|
|
|
|
|
2007-11-08 05:42:24 +08:00
|
|
|
#ifdef __mep__
|
|
|
|
/* 16 GPRs, pc, hi, lo */
|
|
|
|
#define _JBLEN 19
|
|
|
|
#endif
|
|
|
|
|
2005-01-27 Hans-Peter Nilsson <hp@axis.com>
* configure.host: Add support for cris-*-* and crisv32-*-*.
* libc/include/machine/ieeefp.h: Ditto.
* libc/include/machine/setjmp.h: Ditto.
* libc/machine/cris/configure.in, libc/machine/cris/Makefile.am,
libc/machine/cris/libcdtor.c, libc/machine/cris/setjmp.c,
libc/machine/cris/memmove.c, libc/machine/cris/memcpy.c,
libc/machine/cris/memset.c, libc/machine/cris/include/pthread.h,
libc/machine/cris/sys/signal.h, libc/machine/cris/sys/fcntl.h,
libc/machine/cris/sys/errno.h, libc/machine/cris/aclocal.m4,
libc/machine/cris/configure, libc/machine/cris/Makefile.in: New
files.
2005-01-28 07:54:46 +08:00
|
|
|
#ifdef __CRIS__
|
|
|
|
#define _JBLEN 18
|
|
|
|
#endif
|
|
|
|
|
2015-10-08 22:46:34 +08:00
|
|
|
#ifdef __ia64
|
|
|
|
#define _JBLEN 64
|
|
|
|
#endif
|
|
|
|
|
2008-12-12 04:05:38 +08:00
|
|
|
#ifdef __lm32__
|
|
|
|
#define _JBLEN 19
|
|
|
|
#endif
|
|
|
|
|
2005-08-11 04:35:13 +08:00
|
|
|
#ifdef __m32c__
|
|
|
|
#if defined(__r8c_cpu__) || defined(__m16c_cpu__)
|
|
|
|
#define _JBLEN (22/2)
|
|
|
|
#else
|
|
|
|
#define _JBLEN (34/2)
|
|
|
|
#endif
|
|
|
|
#define _JBTYPE unsigned short
|
|
|
|
#endif /* __m32c__ */
|
|
|
|
|
2013-05-14 05:39:51 +08:00
|
|
|
#ifdef __MSP430__
|
|
|
|
#define _JBLEN 9
|
|
|
|
|
|
|
|
#ifdef __MSP430X_LARGE__
|
|
|
|
#define _JBTYPE unsigned long
|
|
|
|
#else
|
|
|
|
#define _JBTYPE unsigned short
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2011-11-29 14:33:49 +08:00
|
|
|
#ifdef __RL78__
|
|
|
|
/* Three banks of registers, SP, CS, ES, PC */
|
|
|
|
#define _JBLEN (8*3+8)
|
|
|
|
#define _JBTYPE unsigned char
|
|
|
|
#endif
|
|
|
|
|
2013-05-07 02:23:09 +08:00
|
|
|
/*
|
|
|
|
* There are two versions of setjmp()/longjmp():
|
|
|
|
* 1) Compiler (gcc) built-in versions.
|
|
|
|
* 2) Function-call versions.
|
|
|
|
*
|
|
|
|
* The built-in versions are used most of the time. When used, gcc replaces
|
|
|
|
* calls to setjmp()/longjmp() with inline assembly code. The built-in
|
|
|
|
* versions save/restore a variable number of registers.
|
|
|
|
|
|
|
|
* _JBLEN is set to 40 to be ultra-safe with the built-in versions.
|
|
|
|
* It only needs to be 12 for the function-call versions
|
|
|
|
* but this data structure is used by both versions.
|
|
|
|
*/
|
|
|
|
#ifdef __NIOS2__
|
|
|
|
#define _JBLEN 40
|
|
|
|
#define _JBTYPE unsigned long
|
|
|
|
#endif
|
|
|
|
|
2009-10-26 18:05:23 +08:00
|
|
|
#ifdef __RX__
|
|
|
|
#define _JBLEN 0x44
|
|
|
|
#endif
|
|
|
|
|
2015-01-22 02:27:47 +08:00
|
|
|
#ifdef __VISIUM__
|
|
|
|
/* All call-saved GP registers: r11-r19,r21,r22,r23. */
|
|
|
|
#define _JBLEN 12
|
|
|
|
#endif
|
|
|
|
|
2017-07-27 16:44:22 +08:00
|
|
|
#ifdef __riscv
|
|
|
|
#define _JBTYPE long
|
|
|
|
#ifdef __riscv_32e
|
|
|
|
#define _JBLEN ((4*sizeof(long))/sizeof(long))
|
|
|
|
#else
|
|
|
|
#define _JBLEN ((14*sizeof(long) + 12*sizeof(double))/sizeof(long))
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
#ifdef _JBLEN
|
|
|
|
#ifdef _JBTYPE
|
|
|
|
typedef _JBTYPE jmp_buf[_JBLEN];
|
|
|
|
#else
|
|
|
|
typedef int jmp_buf[_JBLEN];
|
|
|
|
#endif
|
2004-04-09 02:42:46 +08:00
|
|
|
#endif
|
2000-02-18 03:39:52 +08:00
|
|
|
|
2002-06-28 07:58:38 +08:00
|
|
|
_END_STD_C
|
|
|
|
|
2017-08-07 05:40:43 +08:00
|
|
|
#if (defined(__CYGWIN__) || defined(__rtems__)) && __POSIX_VISIBLE
|
2000-02-18 03:39:52 +08:00
|
|
|
#include <signal.h>
|
|
|
|
|
2002-06-28 07:58:38 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
/* POSIX sigsetjmp/siglongjmp macros */
|
2009-05-28 02:54:58 +08:00
|
|
|
#ifdef _JBTYPE
|
2013-03-01 00:42:21 +08:00
|
|
|
typedef _JBTYPE sigjmp_buf[_JBLEN+1+((sizeof (_JBTYPE) + sizeof (sigset_t) - 1)
|
|
|
|
/sizeof (_JBTYPE))];
|
2009-05-28 02:54:58 +08:00
|
|
|
#else
|
|
|
|
typedef int sigjmp_buf[_JBLEN+1+(sizeof (sigset_t)/sizeof (int))];
|
|
|
|
#endif
|
2000-02-18 03:39:52 +08:00
|
|
|
|
|
|
|
#define _SAVEMASK _JBLEN
|
|
|
|
#define _SIGMASK (_JBLEN+1)
|
|
|
|
|
2001-08-14 22:36:58 +08:00
|
|
|
#ifdef __CYGWIN__
|
|
|
|
# define _CYGWIN_WORKING_SIGSETJMP
|
|
|
|
#endif
|
|
|
|
|
2008-01-15 17:41:06 +08:00
|
|
|
#ifdef _POSIX_THREADS
|
|
|
|
#define __SIGMASK_FUNC pthread_sigmask
|
|
|
|
#else
|
|
|
|
#define __SIGMASK_FUNC sigprocmask
|
|
|
|
#endif
|
|
|
|
|
2015-07-21 23:31:02 +08:00
|
|
|
#ifdef __CYGWIN__
|
|
|
|
/* Per POSIX, siglongjmp has to be implemented as function. Cygwin
|
|
|
|
provides functions for both, siglongjmp and sigsetjmp since 2.2.0. */
|
|
|
|
extern void siglongjmp (sigjmp_buf, int) __attribute__ ((__noreturn__));
|
|
|
|
extern int sigsetjmp (sigjmp_buf, int);
|
|
|
|
#endif
|
|
|
|
|
2005-03-18 17:46:30 +08:00
|
|
|
#if defined(__GNUC__)
|
|
|
|
|
|
|
|
#define sigsetjmp(env, savemask) \
|
2006-10-12 03:20:31 +08:00
|
|
|
__extension__ \
|
2005-03-18 17:46:30 +08:00
|
|
|
({ \
|
|
|
|
sigjmp_buf *_sjbuf = &(env); \
|
|
|
|
((*_sjbuf)[_SAVEMASK] = savemask,\
|
2008-01-15 17:41:06 +08:00
|
|
|
__SIGMASK_FUNC (SIG_SETMASK, 0, (sigset_t *)((*_sjbuf) + _SIGMASK)),\
|
2005-03-18 17:46:30 +08:00
|
|
|
setjmp (*_sjbuf)); \
|
|
|
|
})
|
|
|
|
|
|
|
|
#define siglongjmp(env, val) \
|
2006-10-12 03:20:31 +08:00
|
|
|
__extension__ \
|
2005-03-18 17:46:30 +08:00
|
|
|
({ \
|
|
|
|
sigjmp_buf *_sjbuf = &(env); \
|
|
|
|
((((*_sjbuf)[_SAVEMASK]) ? \
|
2008-01-15 17:41:06 +08:00
|
|
|
__SIGMASK_FUNC (SIG_SETMASK, (sigset_t *)((*_sjbuf) + _SIGMASK), 0)\
|
2005-03-18 17:46:30 +08:00
|
|
|
: 0), \
|
|
|
|
longjmp (*_sjbuf, val)); \
|
|
|
|
})
|
|
|
|
|
|
|
|
#else /* !__GNUC__ */
|
|
|
|
|
2001-08-14 22:36:58 +08:00
|
|
|
#define sigsetjmp(env, savemask) ((env)[_SAVEMASK] = savemask,\
|
2008-01-15 17:41:06 +08:00
|
|
|
__SIGMASK_FUNC (SIG_SETMASK, 0, (sigset_t *) ((env) + _SIGMASK)),\
|
2000-02-18 03:39:52 +08:00
|
|
|
setjmp (env))
|
|
|
|
|
2001-08-14 22:36:58 +08:00
|
|
|
#define siglongjmp(env, val) ((((env)[_SAVEMASK])?\
|
2008-01-15 17:41:06 +08:00
|
|
|
__SIGMASK_FUNC (SIG_SETMASK, (sigset_t *) ((env) + _SIGMASK), 0):0),\
|
2000-02-18 03:39:52 +08:00
|
|
|
longjmp (env, val))
|
|
|
|
|
2005-03-18 17:46:30 +08:00
|
|
|
#endif
|
|
|
|
|
2008-06-22 02:48:45 +08:00
|
|
|
/* POSIX _setjmp/_longjmp, maintained for XSI compatibility. These
|
2008-01-15 17:41:06 +08:00
|
|
|
are equivalent to sigsetjmp/siglongjmp when not saving the signal mask.
|
|
|
|
New applications should use sigsetjmp/siglongjmp instead. */
|
2008-06-22 02:48:45 +08:00
|
|
|
#ifdef __CYGWIN__
|
2015-07-21 23:31:02 +08:00
|
|
|
extern void _longjmp (jmp_buf, int) __attribute__ ((__noreturn__));
|
|
|
|
extern int _setjmp (jmp_buf);
|
2008-06-22 02:48:45 +08:00
|
|
|
#else
|
2008-01-15 17:41:06 +08:00
|
|
|
#define _setjmp(env) sigsetjmp ((env), 0)
|
|
|
|
#define _longjmp(env, val) siglongjmp ((env), (val))
|
2008-06-22 02:48:45 +08:00
|
|
|
#endif
|
2008-01-15 17:41:06 +08:00
|
|
|
|
2002-06-28 07:58:38 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2017-08-07 05:40:43 +08:00
|
|
|
#endif /* (__CYGWIN__ or __rtems__) and __POSIX_VISIBLE */
|