X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/59e0d9fe772464b93d835d2a2964457702469a43..ad3c9f2af814c84582fdd1649e49ec4f68572c5a:/include/setjmp.h diff --git a/include/setjmp.h b/include/setjmp.h index 8726872..8e6b4a8 100644 --- a/include/setjmp.h +++ b/include/setjmp.h @@ -3,8 +3,6 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in @@ -25,6 +23,66 @@ #ifndef _BSD_SETJMP_H #define _BSD_SETJMP_H -#include +#include + +#if defined(__x86_64__) +/* + * _JBLEN is number of ints required to save the following: + * rflags, rip, rbp, rsp, rbx, r12, r13, r14, r15... these are 8 bytes each + * mxcsr, fp control word, sigmask... these are 4 bytes each + * add 16 ints for future expansion needs... + */ +#define _JBLEN ((9 * 2) + 3 + 16) +typedef int jmp_buf[_JBLEN]; +typedef int sigjmp_buf[_JBLEN + 1]; + +#elif defined(__i386__) + +/* + * _JBLEN is number of ints required to save the following: + * eax, ebx, ecx, edx, edi, esi, ebp, esp, ss, eflags, eip, + * cs, de, es, fs, gs == 16 ints + * onstack, mask = 2 ints + */ + +#define _JBLEN (18) +typedef int jmp_buf[_JBLEN]; +typedef int sigjmp_buf[_JBLEN + 1]; + +#elif defined(__arm__) + +#include + +/* + * _JBLEN is number of ints required to save the following: + * r4-r8, r10, fp, sp, lr, sig == 10 register_t sized + * s16-s31 == 16 register_t sized + 1 int for FSTMX + * 1 extra int for future use + */ +#define _JBLEN (10 + 16 + 2) +#define _JBLEN_MAX _JBLEN + +typedef int jmp_buf[_JBLEN]; +typedef int sigjmp_buf[_JBLEN + 1]; + +#else +# error Undefined platform for setjmp +#endif + +__BEGIN_DECLS +extern int setjmp(jmp_buf); +extern void longjmp(jmp_buf, int) __dead2; + +#ifndef _ANSI_SOURCE +int _setjmp(jmp_buf); +void _longjmp(jmp_buf, int) __dead2; +int sigsetjmp(sigjmp_buf, int); +void siglongjmp(sigjmp_buf, int) __dead2; +#endif /* _ANSI_SOURCE */ + +#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) +void longjmperror(void); +#endif /* neither ANSI nor POSIX */ +__END_DECLS #endif /* _BSD_SETJMP_H */