[CMAKE]
[reactos.git] / include / crt / setjmp.h
1 /**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the w64 mingw-runtime package.
4 * No warranty is given; refer to the file DISCLAIMER 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 #ifdef __cplusplus
14 extern "C" {
15 #endif
16
17 #if (defined(_X86_) && !defined(__x86_64))
18
19 #define _JBLEN 16
20 #define _JBTYPE int
21
22 typedef struct __JUMP_BUFFER {
23 unsigned long Ebp;
24 unsigned long Ebx;
25 unsigned long Edi;
26 unsigned long Esi;
27 unsigned long Esp;
28 unsigned long Eip;
29 unsigned long Registration;
30 unsigned long TryLevel;
31 unsigned long Cookie;
32 unsigned long UnwindFunc;
33 unsigned long UnwindData[6];
34 } _JUMP_BUFFER;
35
36 #elif defined(__ia64__)
37
38 typedef _CRT_ALIGN(16) struct _SETJMP_FLOAT128 {
39 __MINGW_EXTENSION __int64 LowPart;
40 __MINGW_EXTENSION __int64 HighPart;
41 } SETJMP_FLOAT128;
42
43 #define _JBLEN 33
44 typedef SETJMP_FLOAT128 _JBTYPE;
45
46 typedef struct __JUMP_BUFFER {
47
48 unsigned long iAReserved[6];
49
50 unsigned long Registration;
51 unsigned long TryLevel;
52 unsigned long Cookie;
53 unsigned long UnwindFunc;
54
55 unsigned long UnwindData[6];
56
57 SETJMP_FLOAT128 FltS0;
58 SETJMP_FLOAT128 FltS1;
59 SETJMP_FLOAT128 FltS2;
60 SETJMP_FLOAT128 FltS3;
61 SETJMP_FLOAT128 FltS4;
62 SETJMP_FLOAT128 FltS5;
63 SETJMP_FLOAT128 FltS6;
64 SETJMP_FLOAT128 FltS7;
65 SETJMP_FLOAT128 FltS8;
66 SETJMP_FLOAT128 FltS9;
67 SETJMP_FLOAT128 FltS10;
68 SETJMP_FLOAT128 FltS11;
69 SETJMP_FLOAT128 FltS12;
70 SETJMP_FLOAT128 FltS13;
71 SETJMP_FLOAT128 FltS14;
72 SETJMP_FLOAT128 FltS15;
73 SETJMP_FLOAT128 FltS16;
74 SETJMP_FLOAT128 FltS17;
75 SETJMP_FLOAT128 FltS18;
76 SETJMP_FLOAT128 FltS19;
77 __MINGW_EXTENSION __int64 FPSR;
78 __MINGW_EXTENSION __int64 StIIP;
79 __MINGW_EXTENSION __int64 BrS0;
80 __MINGW_EXTENSION __int64 BrS1;
81 __MINGW_EXTENSION __int64 BrS2;
82 __MINGW_EXTENSION __int64 BrS3;
83 __MINGW_EXTENSION __int64 BrS4;
84 __MINGW_EXTENSION __int64 IntS0;
85 __MINGW_EXTENSION __int64 IntS1;
86 __MINGW_EXTENSION __int64 IntS2;
87 __MINGW_EXTENSION __int64 IntS3;
88 __MINGW_EXTENSION __int64 RsBSP;
89 __MINGW_EXTENSION __int64 RsPFS;
90 __MINGW_EXTENSION __int64 ApUNAT;
91 __MINGW_EXTENSION __int64 ApLC;
92 __MINGW_EXTENSION __int64 IntSp;
93 __MINGW_EXTENSION __int64 IntNats;
94 __MINGW_EXTENSION __int64 Preds;
95
96 } _JUMP_BUFFER;
97
98 #elif defined(__x86_64)
99
100 typedef _CRT_ALIGN(16) struct _SETJMP_FLOAT128 {
101 __MINGW_EXTENSION unsigned __int64 Part[2];
102 } SETJMP_FLOAT128;
103
104 #define _JBLEN 16
105 typedef SETJMP_FLOAT128 _JBTYPE;
106
107 typedef struct _JUMP_BUFFER {
108 __MINGW_EXTENSION unsigned __int64 Frame;
109 __MINGW_EXTENSION unsigned __int64 Rbx;
110 __MINGW_EXTENSION unsigned __int64 Rsp;
111 __MINGW_EXTENSION unsigned __int64 Rbp;
112 __MINGW_EXTENSION unsigned __int64 Rsi;
113 __MINGW_EXTENSION unsigned __int64 Rdi;
114 __MINGW_EXTENSION unsigned __int64 R12;
115 __MINGW_EXTENSION unsigned __int64 R13;
116 __MINGW_EXTENSION unsigned __int64 R14;
117 __MINGW_EXTENSION unsigned __int64 R15;
118 __MINGW_EXTENSION unsigned __int64 Rip;
119 __MINGW_EXTENSION unsigned __int64 Spare;
120 SETJMP_FLOAT128 Xmm6;
121 SETJMP_FLOAT128 Xmm7;
122 SETJMP_FLOAT128 Xmm8;
123 SETJMP_FLOAT128 Xmm9;
124 SETJMP_FLOAT128 Xmm10;
125 SETJMP_FLOAT128 Xmm11;
126 SETJMP_FLOAT128 Xmm12;
127 SETJMP_FLOAT128 Xmm13;
128 SETJMP_FLOAT128 Xmm14;
129 SETJMP_FLOAT128 Xmm15;
130 } _JUMP_BUFFER;
131
132 #endif
133
134 #ifndef _JMP_BUF_DEFINED
135 typedef _JBTYPE jmp_buf[_JBLEN];
136 #define _JMP_BUF_DEFINED
137 #endif
138
139 #ifdef _MSC_VER
140 int __cdecl __MINGW_NOTHROW setjmp(jmp_buf _Buf);
141 #else
142 #ifdef USE_MINGW_SETJMP_TWO_ARGS
143 #ifndef _INC_SETJMPEX
144 #if defined(__x86_64)
145 # define mingw_getsp() \
146 ({ void* value; __asm__ __volatile__("movq %%rsp, %[value]" : [value] "=r" (value)); value; })
147 #elif defined(_X86_)
148 # define mingw_getsp() \
149 ({ void* value; __asm__ __volatile__("movl %%esp, %[value]" : [value] "=r" (value)); value; })
150 #endif
151 #define setjmp(BUF) _setjmp((BUF),mingw_getsp())
152 int __cdecl __MINGW_NOTHROW _setjmp(jmp_buf _Buf,void *_Ctx);
153 #else
154 #undef setjmp
155 #define setjmp(BUF) _setjmpex((BUF),mingw_getsp())
156 #define setjmpex(BUF) _setjmpex((BUF),mingw_getsp())
157 int __cdecl __MINGW_NOTHROW _setjmpex(jmp_buf _Buf,void *_Ctx);
158 #endif
159 #else
160 #ifndef _INC_SETJMPEX
161 #define setjmp _setjmp
162 #endif
163 int __cdecl __MINGW_NOTHROW setjmp(jmp_buf _Buf);
164 #endif
165 #endif
166
167 __declspec(noreturn) __MINGW_NOTHROW void __cdecl ms_longjmp(jmp_buf _Buf,int _Value)/* throw(...)*/;
168 __declspec(noreturn) __MINGW_NOTHROW void __cdecl longjmp(jmp_buf _Buf,int _Value);
169
170 #ifdef __cplusplus
171 }
172 #endif
173
174 #pragma pack(pop)
175 #endif