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