]>
Commit | Line | Data |
---|---|---|
e9ce8d39 A |
1 | /* |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
734aad71 A |
6 | * This file contains Original Code and/or Modifications of Original Code |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. Please obtain a copy of the License at | |
10 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
11 | * file. | |
12 | * | |
13 | * The Original Code and all software distributed under the License are | |
14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
e9ce8d39 A |
15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
734aad71 A |
17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
18 | * Please see the License for the specific language governing rights and | |
19 | * limitations under the License. | |
e9ce8d39 A |
20 | * |
21 | * @APPLE_LICENSE_HEADER_END@ | |
22 | */ | |
5b2abdfb A |
23 | #ifndef _BSD_SETJMP_H |
24 | #define _BSD_SETJMP_H | |
25 | ||
ad3c9f2a A |
26 | #include <sys/cdefs.h> |
27 | ||
28 | #if defined(__x86_64__) | |
29 | /* | |
30 | * _JBLEN is number of ints required to save the following: | |
31 | * rflags, rip, rbp, rsp, rbx, r12, r13, r14, r15... these are 8 bytes each | |
32 | * mxcsr, fp control word, sigmask... these are 4 bytes each | |
33 | * add 16 ints for future expansion needs... | |
34 | */ | |
35 | #define _JBLEN ((9 * 2) + 3 + 16) | |
36 | typedef int jmp_buf[_JBLEN]; | |
37 | typedef int sigjmp_buf[_JBLEN + 1]; | |
38 | ||
39 | #elif defined(__i386__) | |
40 | ||
41 | /* | |
42 | * _JBLEN is number of ints required to save the following: | |
43 | * eax, ebx, ecx, edx, edi, esi, ebp, esp, ss, eflags, eip, | |
44 | * cs, de, es, fs, gs == 16 ints | |
45 | * onstack, mask = 2 ints | |
46 | */ | |
47 | ||
48 | #define _JBLEN (18) | |
49 | typedef int jmp_buf[_JBLEN]; | |
50 | typedef int sigjmp_buf[_JBLEN + 1]; | |
51 | ||
52 | #elif defined(__arm__) | |
53 | ||
54 | #include <machine/signal.h> | |
55 | ||
56 | /* | |
57 | * _JBLEN is number of ints required to save the following: | |
58 | * r4-r8, r10, fp, sp, lr, sig == 10 register_t sized | |
59 | * s16-s31 == 16 register_t sized + 1 int for FSTMX | |
60 | * 1 extra int for future use | |
61 | */ | |
62 | #define _JBLEN (10 + 16 + 2) | |
63 | #define _JBLEN_MAX _JBLEN | |
64 | ||
65 | typedef int jmp_buf[_JBLEN]; | |
66 | typedef int sigjmp_buf[_JBLEN + 1]; | |
67 | ||
68 | #else | |
69 | # error Undefined platform for setjmp | |
70 | #endif | |
71 | ||
72 | __BEGIN_DECLS | |
73 | extern int setjmp(jmp_buf); | |
74 | extern void longjmp(jmp_buf, int) __dead2; | |
75 | ||
76 | #ifndef _ANSI_SOURCE | |
77 | int _setjmp(jmp_buf); | |
78 | void _longjmp(jmp_buf, int) __dead2; | |
79 | int sigsetjmp(sigjmp_buf, int); | |
80 | void siglongjmp(sigjmp_buf, int) __dead2; | |
81 | #endif /* _ANSI_SOURCE */ | |
82 | ||
83 | #if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) | |
84 | void longjmperror(void); | |
85 | #endif /* neither ANSI nor POSIX */ | |
86 | __END_DECLS | |
5b2abdfb A |
87 | |
88 | #endif /* _BSD_SETJMP_H */ |