2002-06-28 07:58:38 +08:00
|
|
|
|
|
|
|
_BEGIN_STD_C
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
|
|
|
#if defined(__CYGWIN__) && !defined (_JBLEN)
|
|
|
|
#define _JBLEN (13 * 4)
|
|
|
|
#elif defined (__i386__)
|
2002-12-11 03:46:49 +08:00
|
|
|
#if defined(__unix__) || defined(__rtems__)
|
|
|
|
# define _JBLEN 9
|
2000-02-18 03:39:52 +08:00
|
|
|
#else
|
|
|
|
#include "setjmp-dj.h"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2007-08-29 05:56:50 +08:00
|
|
|
#ifdef __x86_64__
|
|
|
|
#define _JBTYPE long long
|
|
|
|
#define _JBLEN 8
|
|
|
|
#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__
|
2001-03-09 05:39:32 +08:00
|
|
|
#ifdef __mips64
|
|
|
|
#define _JBTYPE long long
|
2002-08-08 01:07:42 +08:00
|
|
|
#endif
|
|
|
|
#ifdef __mips_soft_float
|
2000-02-18 03:39:52 +08:00
|
|
|
#define _JBLEN 11
|
2002-08-08 01:07:42 +08:00
|
|
|
#else
|
|
|
|
#define _JBLEN 23
|
2000-02-18 03:39:52 +08:00
|
|
|
#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
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
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__ */
|
|
|
|
|
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
|
|
|
|
|
2009-10-26 18:05:23 +08:00
|
|
|
#ifdef __RX__
|
|
|
|
#define _JBLEN 0x44
|
|
|
|
#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
|
|
|
|
|
2000-05-31 01:18:05 +08:00
|
|
|
#if defined(__CYGWIN__) || defined(__rtems__)
|
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
|
|
|
|
typedef _JBTYPE sigjmp_buf[_JBLEN+1+(sizeof (sigset_t)/sizeof (_JBTYPE))];
|
|
|
|
#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
|
|
|
|
|
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__
|
|
|
|
extern void _longjmp(jmp_buf, int);
|
|
|
|
extern int _setjmp(jmp_buf);
|
|
|
|
#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
|
2000-05-31 01:18:05 +08:00
|
|
|
#endif /* __CYGWIN__ or __rtems__ */
|