21#if defined(__clang__) && !defined(_SEH3$_FRAME_ALL_NONVOLATILES)
22#define _SEH3$_FRAME_ALL_NONVOLATILES 1
64#ifdef _SEH3$_FRAME_ALL_NONVOLATILES
74#if defined(__cplusplus)
75 #define _SEH3$_except_handler _SEH3$_CPP_except_handler
76 #define _SEH3$_AutoCleanup _SEH3$_CPP_AutoCleanup
78 #define _SEH3$_except_handler _SEH3$_C_except_handler
79 #define _SEH3$_AutoCleanup _SEH3$_C_AutoCleanup
97 asm volatile (
"movl %k[NewHead], %%fs:0"
98 : : [NewHead]
"ir" (RegistrationFrame->
Next) :
"memory");
103void _SEH3$_UnregisterTryLevel(
107 asm volatile (
"movl %%fs:0, %k[RegistrationFrame]"
108 : [RegistrationFrame]
"=r" (RegistrationFrame) : );
126#define _SEH3$_AUTO_CLEANUP __attribute__((cleanup(_SEH3$_AutoCleanup)))
131_SEH3$_RegisterFrameWithNonVolatiles(
139_SEH3$_RegisterTryLevelWithNonVolatiles(
148#define _SEH3$_EnforceFramePointer() asm volatile ("#\n" : : "m"(*(char*)__builtin_alloca(4)) : "%esp", "memory")
151#define _SEH3$_ASM_GOTO(...)
153#define _SEH3$_RegisterFrame_(_TrylevelFrame, _DataTable) \
155 (_TrylevelFrame)->Handler = (void*)_SEH3$_except_handler; \
156 (_TrylevelFrame)->TryLevel = 0; \
157 int result = _SEH3$_RegisterFrameWithNonVolatiles(_TrylevelFrame, _DataTable, __builtin_alloca(0)); \
158 if (__builtin_expect(result != 0, 0)) \
160 if (result == 1) goto _SEH3$_l_FilterOrFinally; \
161 if (result == 2) goto _SEH3$_l_HandlerTarget; \
162 goto _SEH3$_l_BeforeFilterOrFinally; \
166#define _SEH3$_RegisterTryLevel_(_TrylevelFrame, _DataTable) \
168 (_TrylevelFrame)->TryLevel = _SEH3$_TryLevel; \
169 int result = _SEH3$_RegisterTryLevelWithNonVolatiles(_TrylevelFrame, _DataTable, __builtin_alloca(0)); \
170 if (__builtin_expect(result != 0, 0)) \
172 if (result == 1) goto _SEH3$_l_FilterOrFinally; \
173 if (result == 2) goto _SEH3$_l_HandlerTarget; \
174 goto _SEH3$_l_BeforeFilterOrFinally; \
178#define _SEH3$_SCARE_GCC()
183#define _SEH3$_EnforceFramePointer() asm volatile ("#\n" : : "m"(*(char*)__builtin_alloca(0)) : "%esp", "memory")
185#define _SEH3$_ASM_GOTO(...) asm goto ("#\n" : : : "memory" : __VA_ARGS__)
188#define _SEH3$_CALL_WRAPPER(_Function, _TrylevelFrame, _DataTable) \
189 asm goto ("leal %0, %%eax\n\t" \
190 "leal %1, %%edx\n\t" \
191 "call " #_Function "WithStackLayout" \
193 : "m" (*(_TrylevelFrame)), "m" (*(_DataTable)), "c" (__builtin_alloca(0)), "p" (_SEH3$_RegisterFrameWithNonVolatiles) \
194 : "eax", "edx", "memory" \
195 : _SEH3$_l_BeforeTry, _SEH3$_l_HandlerTarget, _SEH3$_l_OnException, _SEH3$_l_BeforeFilterOrFinally, _SEH3$_l_FilterOrFinally)
198#define _SEH3$_CALL_WRAPPER(_Function, _TrylevelFrame, _DataTable) \
199 asm goto ("leal %0, %%eax\n\t" \
200 "leal %1, %%edx\n\t" \
203 : "m" (*(_TrylevelFrame)), "m" (*(_DataTable)), "p" (_SEH3$_RegisterFrameWithNonVolatiles) \
204 : "eax", "edx", "ecx", "memory" \
205 : _SEH3$_l_BeforeTry, _SEH3$_l_HandlerTarget, _SEH3$_l_OnException, _SEH3$_l_BeforeFilterOrFinally, _SEH3$_l_FilterOrFinally)
209#define _SEH3$_RegisterFrame_(_TrylevelFrame, _DataTable) \
211 (_TrylevelFrame)->Handler = (void*)_SEH3$_except_handler; \
212 (_TrylevelFrame)->TryLevel = 0; \
213 _SEH3$_CALL_WRAPPER(__SEH3$_RegisterFrame, _TrylevelFrame, _DataTable); \
217#define _SEH3$_RegisterTryLevel_(_TrylevelFrame, _DataTable) \
219 (_TrylevelFrame)->TryLevel = _SEH3$_TryLevel; \
220 _SEH3$_CALL_WRAPPER(__SEH3$_RegisterTryLevel, _TrylevelFrame, _DataTable); \
225#define _SEH3$_SCARE_GCC() \
227 _SEH3$_ASM_GOTO(_SEH3$_l_BeforeTry, _SEH3$_l_HandlerTarget, _SEH3$_l_OnException, _SEH3$_l_BeforeFilterOrFinally, _SEH3$_l_FilterOrFinally); \
228 asm volatile ("#" : "=a"(plabel) : "p"(&&_SEH3$_l_BeforeTry), "p"(&&_SEH3$_l_HandlerTarget), "p"(&&_SEH3$_l_OnException), "p"(&&_SEH3$_l_FilterOrFinally) \
229 : "ebx", "ecx", "edx", "esi", "edi", "flags", "memory" ); \
230 goto _SEH3$_l_OnException;
235#if defined(__cplusplus) || defined(__clang__)
244#define _SEH3$_DECLARE_CLEANUP_FUNC(_Name)
245#define _SEH3$_DEFINE_CLEANUP_FUNC(_Name)
246#define _SEH3$_DECLARE_FILTER_FUNC(_Name)
247#define _SEH3$_DEFINE_DUMMY_FINALLY(_Name)
250#define _SEH3$_NESTED_FUNC_RETURN(_Result) \
252 asm volatile ("movl %[FixedEsp], %%esp\n\tret" \
253 : : "a" (_Result), [FixedEsp] "m" (_SEH3$_TrylevelFrame.AllocaFrame) : "ebx", "ecx", "edx", "esi", "edi", "flags", "memory")
256#define _SEH3$_DEFINE_FILTER_FUNC(_Name, expression) \
259 asm volatile ("#\n" : : : "eax", "ebx", "ecx", "edx", "esi", "edi", "flags", "memory"); \
260 _SEH3$_NESTED_FUNC_RETURN((expression)); \
263#define _SEH3$_FINALLY_FUNC_OPEN(_Name) \
265 asm volatile ("#\n" : : : "eax", "ebx", "ecx", "edx", "esi", "edi", "flags", "memory"); \
268 for (; ; (void)({_SEH3$_NESTED_FUNC_RETURN(0); 0;}))
270#define _SEH3$_FILTER(_Filter, _FilterExpression) (&&_SEH3$_l_FilterOrFinally)
271#define _SEH3$_FINALLY(_Finally) (&&_SEH3$_l_FilterOrFinally)
273#define _SEH3$_DECLARE_EXCEPT_INTRINSICS()
276#define _abnormal_termination() (_SEH3$_TrylevelFrame.ExceptionPointers != 0)
277#define _exception_code() (_SEH3$_TrylevelFrame.ExceptionCode)
278#define _exception_info() (_SEH3$_TrylevelFrame.ExceptionPointers)
287#define _SEH3$_DECLARE_EXCEPT_INTRINSICS() \
288 inline __attribute__((always_inline, gnu_inline)) \
289 unsigned long _exception_code() { return _SEH3$_TrylevelFrame.ExceptionCode; }
299#define _SEH3$_DECLARE_FILTER_FUNC(_Name) \
300 auto _SEH3$FILTER_RESULT __fastcall _Name(int Action)
302#define _SEH3$_NESTED_FUNC_OPEN(_Name) \
303 _SEH3$FILTER_RESULT __fastcall _Name(int Action) \
306 if (Action == 0) { _SEH3$FILTER_RESULT seh3$result; seh3$result.Value = (int)&_SEH3$_TrylevelFrame; return seh3$result; }
308#define _SEH3$_DEFINE_FILTER_FUNC(_Name, expression) \
309 _SEH3$_NESTED_FUNC_OPEN(_Name) \
311_Pragma("GCC diagnostic push") \
312_Pragma("GCC diagnostic ignored \"-Wshadow\"") \
313 inline __attribute__((always_inline, gnu_inline)) \
314 unsigned long _exception_code() { return _SEH3$_TrylevelFrame.ExceptionCode; } \
315 inline __attribute__((always_inline, gnu_inline)) \
316 void * _exception_info() { return _SEH3$_TrylevelFrame.ExceptionPointers; } \
317_Pragma("GCC diagnostic pop") \
320 { _SEH3$FILTER_RESULT seh3$result; seh3$result.Value = (expression); return seh3$result; } \
323#define _SEH3$_FINALLY_FUNC_OPEN(_Name) \
324 _SEH3$_NESTED_FUNC_OPEN(_Name) \
326 inline __attribute__((always_inline, gnu_inline)) \
327 int _abnormal_termination() { return (_SEH3$_TrylevelFrame.ExceptionPointers != 0); } \
331 for (; ; (void)({ _SEH3$FILTER_RESULT seh3$result; seh3$result.Value = 0; return seh3$result; 0;}))
333#define _SEH3$_FILTER(_Filter, _FilterExpression) \
334 (__builtin_constant_p(_FilterExpression) ? (void*)(unsigned long)(unsigned char)(unsigned long)(_FilterExpression) : _Filter)
336#define _SEH3$_FINALLY(_Finally) (_Finally)
338#define _SEH3$_DEFINE_DUMMY_FINALLY(_Name) \
339 auto inline __attribute__((always_inline,gnu_inline)) int _Name(int Action) { (void)Action; return 0; }
341#define _SEH3$_DECLARE_CLEANUP_FUNC(_Name) \
342 auto inline __attribute__((always_inline,gnu_inline)) void _Name(volatile SEH3$_REGISTRATION_FRAME *p)
344#define _SEH3$_DEFINE_CLEANUP_FUNC(_Name) \
345 _SEH3$_DECLARE_CLEANUP_FUNC(_Name) \
349 if (_SEH3$_TryLevel == 0) _SEH3$_UnregisterFrame(&_SEH3$_TrylevelFrame); \
350 else _SEH3$_UnregisterTryLevel(&_SEH3$_TrylevelFrame); \
353 _SEH3$_FinallyFunction(1); \
361 _SEH3$_PreventInlining(); \
365 __label__ _SEH3$_l_BeforeTry; \
366 __label__ _SEH3$_l_DoTry; \
367 __label__ _SEH3$_l_AfterTry; \
368 __label__ _SEH3$_l_EndTry; \
369 __label__ _SEH3$_l_HandlerTarget; \
370 __label__ _SEH3$_l_OnException; \
371 __label__ _SEH3$_l_BeforeFilterOrFinally; \
372 __label__ _SEH3$_l_FilterOrFinally; \
373 (void)&&_SEH3$_l_OnException; \
374 (void)&&_SEH3$_l_BeforeFilterOrFinally; \
375 (void)&&_SEH3$_l_FilterOrFinally; \
379 _SEH3$_PreviousTryLevel = _SEH3$_InnerTryLevel, \
380 _SEH3$_TryLevel = _SEH3$_PreviousTryLevel + 1, \
384 _SEH3$_DECLARE_CLEANUP_FUNC(_SEH3$_AutoCleanup); \
387 volatile SEH3$_REGISTRATION_FRAME _SEH3$_AUTO_CLEANUP _SEH3$_TrylevelFrame; \
389 goto _SEH3$_l_BeforeTry; \
391 __label__ _SEH3$_l_Leave; \
394 _SEH3$_InnerTryLevel = _SEH3$_TryLevel, \
397 _SEH3$_l_Leave: (void)0; \
398 goto _SEH3$_l_AfterTry; \
399 goto _SEH3$_l_Leave; \
405#define _SEH3_EXCEPT(...) \
408 _SEH3$_l_AfterTry: (void)0; \
409 goto _SEH3$_l_EndTry; \
411 _SEH3$_l_BeforeTry: (void)0; \
412 _SEH3$_ASM_GOTO(_SEH3$_l_OnException); \
415 _SEH3$_DECLARE_FILTER_FUNC(_SEH3$_FilterFunction); \
418 static const SEH3$_SCOPE_TABLE __attribute__((section(".xdata$x"))) _SEH3$_ScopeTable = { (unsigned)(_SEH3$_TryLevel - 1), _SEH3$_FILTER(&_SEH3$_FilterFunction, (__VA_ARGS__)), &&_SEH3$_l_HandlerTarget }; \
421 if (_SEH3$_TryLevel == 0) _SEH3$_RegisterFrame_(&_SEH3$_TrylevelFrame, &_SEH3$_ScopeTable); \
422 else _SEH3$_RegisterTryLevel_(&_SEH3$_TrylevelFrame, &_SEH3$_ScopeTable); \
425 _SEH3$_DEFINE_DUMMY_FINALLY(_SEH3$_FinallyFunction) \
428 _SEH3$_DECLARE_EXCEPT_INTRINSICS(); \
430 goto _SEH3$_l_DoTry; \
432 _SEH3$_l_BeforeFilterOrFinally: (void)0; \
434 _SEH3$_EnforceFramePointer(); \
436 _SEH3$_l_FilterOrFinally: (void)0; \
438 _SEH3$_DEFINE_FILTER_FUNC(_SEH3$_FilterFunction, (__VA_ARGS__)) \
440 _SEH3$_l_HandlerTarget: (void)0; \
441 _SEH3$_EnforceFramePointer(); \
446 asm volatile ("#\n"); \
450#define _SEH3_FINALLY \
453 _SEH3$_l_AfterTry: (void)0; \
455 _SEH3$_TrylevelFrame.ExceptionPointers = 0; \
457 goto _SEH3$_l_EndTry; \
459 _SEH3$_l_BeforeTry: (void)0; \
460 _SEH3$_ASM_GOTO(_SEH3$_l_OnException); \
463 _SEH3$_DECLARE_FILTER_FUNC(_SEH3$_FinallyFunction); \
466 static const SEH3$_SCOPE_TABLE __attribute__((section(".xdata$x"))) _SEH3$_ScopeTable = { (unsigned)(_SEH3$_TryLevel - 1), _SEH3$_FINALLY(&_SEH3$_FinallyFunction), 0 }; \
469 if (_SEH3$_TryLevel == 0) _SEH3$_RegisterFrame_(&_SEH3$_TrylevelFrame, &_SEH3$_ScopeTable); \
470 else _SEH3$_RegisterTryLevel_(&_SEH3$_TrylevelFrame, &_SEH3$_ScopeTable); \
471 _SEH3$_TrylevelFrame.ExceptionPointers = (PSEH3$_EXCEPTION_POINTERS)1; \
473 goto _SEH3$_l_DoTry; \
475 _SEH3$_l_HandlerTarget: (void)0; \
476 _SEH3$_EnforceFramePointer(); \
478 _SEH3$_l_BeforeFilterOrFinally: (void)0; \
479 _SEH3$_EnforceFramePointer(); \
480 _SEH3$_l_FilterOrFinally: (void)0; \
481 _SEH3$_FINALLY_FUNC_OPEN(_SEH3$_FinallyFunction)
486 goto _SEH3$_l_EndTry; \
488 _SEH3$_l_OnException: (void)0; \
490 _SEH3$_SCARE_GCC(); \
492 _SEH3$_l_EndTry:(void)0; \
493 _SEH3$_ASM_GOTO(_SEH3$_l_OnException); \
496 _SEH3$_DEFINE_CLEANUP_FUNC(_SEH3$_AutoCleanup); \
501#define _SEH3_LEAVE goto _SEH3$_l_Leave
503#define _SEH3_VOLATILE volatile
510 _setjmp3(env, 2, (const void*)_SEH3$_longjmp_unwind, _SEH3$_TryLevel)
static LPCWSTR LPCWSTR LPCWSTR env
GLuint GLuint GLsizei count
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
_IRQL_requires_same_ _In_ PVOID EstablisherFrame
_IRQL_requires_same_ _In_ PVOID _Inout_ struct _CONTEXT * ContextRecord
_IRQL_requires_same_ _In_ PVOID _Inout_ struct _CONTEXT _In_ PVOID DispatcherContext
#define _abnormal_termination()
#define _exception_code()
#define _exception_info()
int __cdecl _SEH3$_except_handler(struct _EXCEPTION_RECORD *ExceptionRecord, PSEH3$_REGISTRATION_FRAME EstablisherFrame, struct _CONTEXT *ContextRecord, void *DispatcherContext)
struct _SEH3$_SCOPE_TABLE SEH3$_SCOPE_TABLE
struct _SEH3$_EXCEPTION_POINTERS SEH3$_EXCEPTION_POINTERS
int const SEH3$_SCOPE_TABLE void * AllocaFrame
struct __SEH3$FILTER_RESULT _SEH3$FILTER_RESULT
struct _SEH3$_REGISTRATION_FRAME SEH3$_REGISTRATION_FRAME
int const SEH3$_SCOPE_TABLE * ScopeTable
void __stdcall _SEH3$_longjmp_unwind(_JUMP_BUFFER *_Buf)
int _setjmp3(jmp_buf env, int count,...)
struct _SEH3$_REGISTRATION_FRAME * PSEH3$_REGISTRATION_FRAME
struct _SEH3$_EXCEPTION_POINTERS * PSEH3$_EXCEPTION_POINTERS
struct _SEH3$_SCOPE_TABLE * PSEH3$_SCOPE_TABLE
struct _CONTEXT * ContextRecord
struct _EXCEPTION_RECORD * ExceptionRecord
PSEH3$_EXCEPTION_POINTERS volatile ExceptionPointers
struct _SEH3$_REGISTRATION_FRAME * EndOfChain
PSEH3$_SCOPE_TABLE ScopeTable
unsigned long ExceptionCode
struct _SEH3$_REGISTRATION_FRAME * Next
unsigned long EnclosingLevel
static unsigned int block