1 | /**
|
---|
2 | * This file has no copyright assigned and is placed in the Public Domain.
|
---|
3 | * This file is part of the mingw-w64 runtime package.
|
---|
4 | * No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
---|
5 | */
|
---|
6 | #ifndef _INC_SETJMP
|
---|
7 | #define _INC_SETJMP
|
---|
8 |
|
---|
9 | #include <crtdefs.h>
|
---|
10 |
|
---|
11 | #pragma pack(push,_CRT_PACKING)
|
---|
12 |
|
---|
13 | #ifndef NULL
|
---|
14 | #ifdef __cplusplus
|
---|
15 | #ifndef _WIN64
|
---|
16 | #define NULL 0
|
---|
17 | #else
|
---|
18 | #define NULL 0LL
|
---|
19 | #endif /* W64 */
|
---|
20 | #else
|
---|
21 | #define NULL ((void *)0)
|
---|
22 | #endif
|
---|
23 | #endif
|
---|
24 |
|
---|
25 | #ifdef __cplusplus
|
---|
26 | extern "C" {
|
---|
27 | #endif
|
---|
28 |
|
---|
29 | #if (defined(_X86_) && !defined(__x86_64))
|
---|
30 |
|
---|
31 | #define _JBLEN 16
|
---|
32 | #define _JBTYPE int
|
---|
33 |
|
---|
34 | typedef struct __JUMP_BUFFER {
|
---|
35 | unsigned long Ebp;
|
---|
36 | unsigned long Ebx;
|
---|
37 | unsigned long Edi;
|
---|
38 | unsigned long Esi;
|
---|
39 | unsigned long Esp;
|
---|
40 | unsigned long Eip;
|
---|
41 | unsigned long Registration;
|
---|
42 | unsigned long TryLevel;
|
---|
43 | unsigned long Cookie;
|
---|
44 | unsigned long UnwindFunc;
|
---|
45 | unsigned long UnwindData[6];
|
---|
46 | } _JUMP_BUFFER;
|
---|
47 |
|
---|
48 | #elif defined(__ia64__)
|
---|
49 |
|
---|
50 | typedef _CRT_ALIGN(16) struct _SETJMP_FLOAT128 {
|
---|
51 | __MINGW_EXTENSION __int64 LowPart;
|
---|
52 | __MINGW_EXTENSION __int64 HighPart;
|
---|
53 | } SETJMP_FLOAT128;
|
---|
54 |
|
---|
55 | #define _JBLEN 33
|
---|
56 | typedef SETJMP_FLOAT128 _JBTYPE;
|
---|
57 |
|
---|
58 | typedef struct __JUMP_BUFFER {
|
---|
59 |
|
---|
60 | unsigned long iAReserved[6];
|
---|
61 |
|
---|
62 | unsigned long Registration;
|
---|
63 | unsigned long TryLevel;
|
---|
64 | unsigned long Cookie;
|
---|
65 | unsigned long UnwindFunc;
|
---|
66 |
|
---|
67 | unsigned long UnwindData[6];
|
---|
68 |
|
---|
69 | SETJMP_FLOAT128 FltS0;
|
---|
70 | SETJMP_FLOAT128 FltS1;
|
---|
71 | SETJMP_FLOAT128 FltS2;
|
---|
72 | SETJMP_FLOAT128 FltS3;
|
---|
73 | SETJMP_FLOAT128 FltS4;
|
---|
74 | SETJMP_FLOAT128 FltS5;
|
---|
75 | SETJMP_FLOAT128 FltS6;
|
---|
76 | SETJMP_FLOAT128 FltS7;
|
---|
77 | SETJMP_FLOAT128 FltS8;
|
---|
78 | SETJMP_FLOAT128 FltS9;
|
---|
79 | SETJMP_FLOAT128 FltS10;
|
---|
80 | SETJMP_FLOAT128 FltS11;
|
---|
81 | SETJMP_FLOAT128 FltS12;
|
---|
82 | SETJMP_FLOAT128 FltS13;
|
---|
83 | SETJMP_FLOAT128 FltS14;
|
---|
84 | SETJMP_FLOAT128 FltS15;
|
---|
85 | SETJMP_FLOAT128 FltS16;
|
---|
86 | SETJMP_FLOAT128 FltS17;
|
---|
87 | SETJMP_FLOAT128 FltS18;
|
---|
88 | SETJMP_FLOAT128 FltS19;
|
---|
89 | __MINGW_EXTENSION __int64 FPSR;
|
---|
90 | __MINGW_EXTENSION __int64 StIIP;
|
---|
91 | __MINGW_EXTENSION __int64 BrS0;
|
---|
92 | __MINGW_EXTENSION __int64 BrS1;
|
---|
93 | __MINGW_EXTENSION __int64 BrS2;
|
---|
94 | __MINGW_EXTENSION __int64 BrS3;
|
---|
95 | __MINGW_EXTENSION __int64 BrS4;
|
---|
96 | __MINGW_EXTENSION __int64 IntS0;
|
---|
97 | __MINGW_EXTENSION __int64 IntS1;
|
---|
98 | __MINGW_EXTENSION __int64 IntS2;
|
---|
99 | __MINGW_EXTENSION __int64 IntS3;
|
---|
100 | __MINGW_EXTENSION __int64 RsBSP;
|
---|
101 | __MINGW_EXTENSION __int64 RsPFS;
|
---|
102 | __MINGW_EXTENSION __int64 ApUNAT;
|
---|
103 | __MINGW_EXTENSION __int64 ApLC;
|
---|
104 | __MINGW_EXTENSION __int64 IntSp;
|
---|
105 | __MINGW_EXTENSION __int64 IntNats;
|
---|
106 | __MINGW_EXTENSION __int64 Preds;
|
---|
107 |
|
---|
108 | } _JUMP_BUFFER;
|
---|
109 |
|
---|
110 | #elif defined(__x86_64)
|
---|
111 |
|
---|
112 | typedef _CRT_ALIGN(16) struct _SETJMP_FLOAT128 {
|
---|
113 | __MINGW_EXTENSION unsigned __int64 Part[2];
|
---|
114 | } SETJMP_FLOAT128;
|
---|
115 |
|
---|
116 | #define _JBLEN 16
|
---|
117 | typedef SETJMP_FLOAT128 _JBTYPE;
|
---|
118 |
|
---|
119 | typedef struct _JUMP_BUFFER {
|
---|
120 | __MINGW_EXTENSION unsigned __int64 Frame;
|
---|
121 | __MINGW_EXTENSION unsigned __int64 Rbx;
|
---|
122 | __MINGW_EXTENSION unsigned __int64 Rsp;
|
---|
123 | __MINGW_EXTENSION unsigned __int64 Rbp;
|
---|
124 | __MINGW_EXTENSION unsigned __int64 Rsi;
|
---|
125 | __MINGW_EXTENSION unsigned __int64 Rdi;
|
---|
126 | __MINGW_EXTENSION unsigned __int64 R12;
|
---|
127 | __MINGW_EXTENSION unsigned __int64 R13;
|
---|
128 | __MINGW_EXTENSION unsigned __int64 R14;
|
---|
129 | __MINGW_EXTENSION unsigned __int64 R15;
|
---|
130 | __MINGW_EXTENSION unsigned __int64 Rip;
|
---|
131 | unsigned long MxCsr;
|
---|
132 | unsigned short FpCsr;
|
---|
133 | unsigned short Spare;
|
---|
134 | SETJMP_FLOAT128 Xmm6;
|
---|
135 | SETJMP_FLOAT128 Xmm7;
|
---|
136 | SETJMP_FLOAT128 Xmm8;
|
---|
137 | SETJMP_FLOAT128 Xmm9;
|
---|
138 | SETJMP_FLOAT128 Xmm10;
|
---|
139 | SETJMP_FLOAT128 Xmm11;
|
---|
140 | SETJMP_FLOAT128 Xmm12;
|
---|
141 | SETJMP_FLOAT128 Xmm13;
|
---|
142 | SETJMP_FLOAT128 Xmm14;
|
---|
143 | SETJMP_FLOAT128 Xmm15;
|
---|
144 | } _JUMP_BUFFER;
|
---|
145 |
|
---|
146 | #elif defined(_ARM_)
|
---|
147 |
|
---|
148 | #define _JBLEN 28
|
---|
149 | #define _JBTYPE int
|
---|
150 |
|
---|
151 | typedef struct __JUMP_BUFFER {
|
---|
152 | unsigned long Frame;
|
---|
153 | unsigned long R4;
|
---|
154 | unsigned long R5;
|
---|
155 | unsigned long R6;
|
---|
156 | unsigned long R7;
|
---|
157 | unsigned long R8;
|
---|
158 | unsigned long R9;
|
---|
159 | unsigned long R10;
|
---|
160 | unsigned long R11;
|
---|
161 | unsigned long Sp;
|
---|
162 | unsigned long Pc;
|
---|
163 | unsigned long Fpscr;
|
---|
164 | unsigned long long D[8];
|
---|
165 | } _JUMP_BUFFER;
|
---|
166 |
|
---|
167 | #elif defined(_ARM64_)
|
---|
168 |
|
---|
169 | #define _JBLEN 24
|
---|
170 | #define _JBTYPE unsigned __int64
|
---|
171 |
|
---|
172 | typedef struct __JUMP_BUFFER {
|
---|
173 | unsigned __int64 Frame;
|
---|
174 | unsigned __int64 Reserved;
|
---|
175 | unsigned __int64 X19;
|
---|
176 | unsigned __int64 X20;
|
---|
177 | unsigned __int64 X21;
|
---|
178 | unsigned __int64 X22;
|
---|
179 | unsigned __int64 X23;
|
---|
180 | unsigned __int64 X24;
|
---|
181 | unsigned __int64 X25;
|
---|
182 | unsigned __int64 X26;
|
---|
183 | unsigned __int64 X27;
|
---|
184 | unsigned __int64 X28;
|
---|
185 | unsigned __int64 Fp;
|
---|
186 | unsigned __int64 Lr;
|
---|
187 | unsigned __int64 Sp;
|
---|
188 | unsigned long Fpcr;
|
---|
189 | unsigned long Fpsr;
|
---|
190 | double D[8];
|
---|
191 | } _JUMP_BUFFER;
|
---|
192 |
|
---|
193 | #else
|
---|
194 |
|
---|
195 | #define _JBLEN 1
|
---|
196 | #define _JBTYPE int
|
---|
197 |
|
---|
198 | #endif
|
---|
199 |
|
---|
200 | #ifndef _JMP_BUF_DEFINED
|
---|
201 | typedef _JBTYPE jmp_buf[_JBLEN];
|
---|
202 | #define _JMP_BUF_DEFINED
|
---|
203 | #endif
|
---|
204 |
|
---|
205 | _CRTIMP __MINGW_ATTRIB_NORETURN __attribute__ ((__nothrow__)) void __cdecl longjmp(jmp_buf _Buf,int _Value);
|
---|
206 |
|
---|
207 | void * __cdecl __attribute__ ((__nothrow__)) mingw_getsp (void);
|
---|
208 |
|
---|
209 | #pragma push_macro("__has_builtin")
|
---|
210 | #ifndef __has_builtin
|
---|
211 | #define __has_builtin(x) 0
|
---|
212 | #endif
|
---|
213 |
|
---|
214 | #if !defined(USE_NO_MINGW_SETJMP_TWO_ARGS)
|
---|
215 | # ifdef _UCRT
|
---|
216 | # ifdef _WIN64
|
---|
217 | # define _setjmp __intrinsic_setjmpex
|
---|
218 | # else
|
---|
219 | # define _setjmp __intrinsic_setjmp
|
---|
220 | # endif
|
---|
221 | # elif defined(__aarch64__)
|
---|
222 | /* ARM64 msvcrt.dll lacks _setjmp, only has _setjmpex. */
|
---|
223 | # define _setjmp _setjmpex
|
---|
224 | # endif
|
---|
225 | # ifndef _INC_SETJMPEX
|
---|
226 | # if defined(_X86_) || defined(__i386__)
|
---|
227 | # define setjmp(BUF) _setjmp3((BUF), NULL)
|
---|
228 | # elif defined(_ARM_) || defined(__arm__) || ((defined(_ARM64_) || defined(__aarch64__)) && (!defined(__SEH__) || !__has_builtin(__builtin_sponentry)))
|
---|
229 | # define setjmp(BUF) __mingw_setjmp((BUF))
|
---|
230 | # define longjmp __mingw_longjmp
|
---|
231 | int __cdecl __attribute__ ((__nothrow__,__returns_twice__)) __mingw_setjmp(jmp_buf _Buf);
|
---|
232 | __MINGW_ATTRIB_NORETURN __attribute__ ((__nothrow__)) void __mingw_longjmp(jmp_buf _Buf,int _Value);
|
---|
233 | # elif defined(__SEH__)
|
---|
234 | # if defined(__aarch64__) || defined(_ARM64_)
|
---|
235 | # define setjmp(BUF) _setjmp((BUF), __builtin_sponentry())
|
---|
236 | # elif (__MINGW_GCC_VERSION < 40702) && !defined(__clang__)
|
---|
237 | # define setjmp(BUF) _setjmp((BUF), mingw_getsp())
|
---|
238 | # else
|
---|
239 | # define setjmp(BUF) _setjmp((BUF), __builtin_frame_address (0))
|
---|
240 | # endif
|
---|
241 | # else
|
---|
242 | # define setjmp(BUF) _setjmp((BUF), NULL)
|
---|
243 | # endif
|
---|
244 | int __cdecl __attribute__ ((__nothrow__,__returns_twice__)) _setjmp(jmp_buf _Buf, void *_Ctx);
|
---|
245 | int __cdecl __attribute__ ((__nothrow__,__returns_twice__)) _setjmp3(jmp_buf _Buf, void *_Ctx);
|
---|
246 | # else
|
---|
247 | # undef setjmp
|
---|
248 | # ifdef __SEH__
|
---|
249 | # if (__MINGW_GCC_VERSION < 40702) && !defined(__clang__)
|
---|
250 | # define setjmp(BUF) _setjmpex((BUF), mingw_getsp())
|
---|
251 | # define setjmpex(BUF) _setjmpex((BUF), mingw_getsp())
|
---|
252 | # else
|
---|
253 | # define setjmp(BUF) _setjmpex((BUF), __builtin_frame_address (0))
|
---|
254 | # define setjmpex(BUF) _setjmpex((BUF), __builtin_frame_address (0))
|
---|
255 | # endif
|
---|
256 | # else
|
---|
257 | # define setjmp(BUF) _setjmpex((BUF), NULL)
|
---|
258 | # define setjmpex(BUF) _setjmpex((BUF), NULL)
|
---|
259 | # endif
|
---|
260 | int __cdecl __attribute__ ((__nothrow__,__returns_twice__)) _setjmpex(jmp_buf _Buf,void *_Ctx);
|
---|
261 | # endif
|
---|
262 |
|
---|
263 | #else
|
---|
264 |
|
---|
265 | # if !defined(_INC_SETJMPEX)
|
---|
266 | # define setjmp _setjmp
|
---|
267 | # endif
|
---|
268 |
|
---|
269 | int __cdecl __attribute__ ((__nothrow__,__returns_twice__)) setjmp(jmp_buf _Buf);
|
---|
270 | #endif
|
---|
271 |
|
---|
272 | #pragma pop_macro("__has_builtin")
|
---|
273 |
|
---|
274 | #ifdef __cplusplus
|
---|
275 | }
|
---|
276 | #endif
|
---|
277 |
|
---|
278 | #pragma pack(pop)
|
---|
279 | #endif
|
---|