STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
setjmp.h
Go to the documentation of this file.
1 //
2 // setjmp.h
3 //
4 // Copyright (c) Microsoft Corporation. All rights reserved.
5 //
6 // The C Standard Library <setjmp.h> header.
7 //
8 #pragma once
9 #define _INC_SETJMP
10 
11 #include <vcruntime.h>
12 
13 #ifdef _M_CEE
14  // The reason why simple setjmp won't work here is that there may
15  // be case when CLR stubs are on the stack e.g. function call just
16  // after jitting, and not unwinding CLR will result in bad state of
17  // CLR which then can AV or do something very bad.
18  #include <setjmpex.h>
19 #endif
20 
22 
23 
24 
25 // Definitions specific to particular setjmp implementations.
26 #if defined _M_IX86
27 
28  #define _JBLEN 16
29  #define _JBTYPE int
30 
31  typedef struct __JUMP_BUFFER
32  {
33  unsigned long Ebp;
34  unsigned long Ebx;
35  unsigned long Edi;
36  unsigned long Esi;
37  unsigned long Esp;
38  unsigned long Eip;
39  unsigned long Registration;
40  unsigned long TryLevel;
41  unsigned long Cookie;
42  unsigned long UnwindFunc;
43  unsigned long UnwindData[6];
44  } _JUMP_BUFFER;
45 
46 #elif defined _M_X64
47 
48  typedef struct _VCRT_ALIGN(16) _SETJMP_FLOAT128
49  {
50  unsigned __int64 Part[2];
51  } SETJMP_FLOAT128;
52 
53  #define _JBLEN 16
54  typedef SETJMP_FLOAT128 _JBTYPE;
55 
56  typedef struct _JUMP_BUFFER
57  {
58  unsigned __int64 Frame;
59  unsigned __int64 Rbx;
60  unsigned __int64 Rsp;
61  unsigned __int64 Rbp;
62  unsigned __int64 Rsi;
63  unsigned __int64 Rdi;
64  unsigned __int64 R12;
65  unsigned __int64 R13;
66  unsigned __int64 R14;
67  unsigned __int64 R15;
68  unsigned __int64 Rip;
69  unsigned long MxCsr;
70  unsigned short FpCsr;
71  unsigned short Spare;
72 
73  SETJMP_FLOAT128 Xmm6;
74  SETJMP_FLOAT128 Xmm7;
75  SETJMP_FLOAT128 Xmm8;
76  SETJMP_FLOAT128 Xmm9;
77  SETJMP_FLOAT128 Xmm10;
78  SETJMP_FLOAT128 Xmm11;
79  SETJMP_FLOAT128 Xmm12;
80  SETJMP_FLOAT128 Xmm13;
81  SETJMP_FLOAT128 Xmm14;
82  SETJMP_FLOAT128 Xmm15;
83  } _JUMP_BUFFER;
84 
85 #elif defined _M_ARM
86 
87  #define _JBLEN 28
88  #define _JBTYPE int
89 
90  typedef struct _JUMP_BUFFER
91  {
92  unsigned long Frame;
93 
94  unsigned long R4;
95  unsigned long R5;
96  unsigned long R6;
97  unsigned long R7;
98  unsigned long R8;
99  unsigned long R9;
100  unsigned long R10;
101  unsigned long R11;
102 
103  unsigned long Sp;
104  unsigned long Pc;
105  unsigned long Fpscr;
106  unsigned long long D[8]; // D8-D15 VFP/NEON regs
107  } _JUMP_BUFFER;
108 
109 #elif defined _M_ARM64
110 
111  #define _JBLEN 24
112  #define _JBTYPE unsigned __int64
113 
114  typedef struct _JUMP_BUFFER {
115  unsigned __int64 Frame;
116  unsigned __int64 Reserved;
117  unsigned __int64 X19; // x19 -- x28: callee saved registers
118  unsigned __int64 X20;
119  unsigned __int64 X21;
120  unsigned __int64 X22;
121  unsigned __int64 X23;
122  unsigned __int64 X24;
123  unsigned __int64 X25;
124  unsigned __int64 X26;
125  unsigned __int64 X27;
126  unsigned __int64 X28;
127  unsigned __int64 Fp; // x29 frame pointer
128  unsigned __int64 Lr; // x30 link register
129  unsigned __int64 Sp; // x31 stack pointer
130  unsigned __int32 Fpcr; // fp control register
131  unsigned __int32 Fpsr; // fp status register
132 
133  double D[8]; // D8-D15 FP regs
134  } _JUMP_BUFFER;
135 
136 
137 
138 #endif
139 
140 
141 
142 // Define the buffer type for holding the state information
143 #ifndef _JMP_BUF_DEFINED
144  #define _JMP_BUF_DEFINED
145  typedef _JBTYPE jmp_buf[_JBLEN];
146 #endif
147 
148 
149 
150 #ifndef _INC_SETJMPEX
151  #define setjmp _setjmp
152 #endif
153 
154 
155 
156 // Function prototypes
157 int __cdecl setjmp(
159  );
160 
161 #ifdef __cplusplus
162  #pragma warning(push)
163  #pragma warning(disable:4987) // Nonstandard extension used
164  __declspec(noreturn) void __cdecl longjmp(
165  _In_ jmp_buf _Buf,
166  _In_ int _Value
167  ) throw(...);
168  #pragma warning(pop)
169 #else
170  __declspec(noreturn) void __cdecl longjmp(
171  _In_ jmp_buf _Buf,
172  _In_ int _Value
173  );
174 #endif
175 
176 
#define _Out_
Definition: sal.h:342
#define setjmp
Definition: setjmp.h:151
#define _VCRT_ALIGN(x)
Definition: vcruntime.h:177
Definition: regex:1539
#define _CRT_BEGIN_C_HEADER
Definition: vcruntime.h:73
_JBTYPE jmp_buf[_JBLEN]
Definition: setjmp.h:145
#define _In_
Definition: sal.h:305
#define _CRT_END_C_HEADER
Definition: vcruntime.h:76
_CRT_BEGIN_C_HEADER typedef void(__CRTDECL *unexpected_handler)()
_In_ int _Value
Definition: setjmp.h:173
__declspec(noreturn) void __cdecl longjmp(_In_ jmp_buf _Buf
Cancels the currently executing task. This function can be called from within the body of a task to a...
Definition: ppltasks.h:131