33#ifndef EXCEPTION_EXIT_UNWIND
34#define EXCEPTION_EXIT_UNWIND 4
37#ifndef EXCEPTION_UNWINDING
38#define EXCEPTION_UNWINDING 2
56int _SEHIsTrampoline(_SEHTrampoline_t * trampoline_)
58 return trampoline_->STR_MovEcx == 0xb9 && trampoline_->STR_Jmp == 0xe9;
64 return (
int)(trampoline_ + 1) + trampoline_->STR_Function;
70 return trampoline_->STR_Closure;
102 "call %c[RtlUnwind]\n"
107 "eax",
"ebx",
"ecx",
"edx",
"esi",
"edi",
"flags",
"memory"
114 void *
filter = trylevel->ST_Filter;
116 __SEH_EXCEPT_RET
ret;
127 if(_SEHIsTrampoline((_SEHTrampoline_t *)
filter))
137 "call *%[filter]\n\t"
142 "edx",
"flags",
"memory"
149void _SEH2Finally(_SEH2Frame_t * frame,
volatile _SEH2TryLevel_t * trylevel)
151 if(trylevel->ST_Filter ==
NULL && trylevel->ST_Body !=
NULL)
153 void *
body = trylevel->ST_Body;
156 if(_SEHIsTrampoline((_SEHTrampoline_t *)
body))
162 __asm__ __volatile__(
"call *%1" : :
"c" (
context),
"r" (
body) :
"eax",
"edx",
"flags",
"memory");
199 volatile _SEH2TryLevel_t * trylevel;
208 for(trylevel = frame->SF_TopTryLevel; trylevel && trylevel != dsttrylevel; trylevel = trylevel->ST_Next)
210 frame->SF_TopTryLevel = trylevel->ST_Next;
218void _SEH2Handle(_SEH2Frame_t * frame,
volatile _SEH2TryLevel_t * trylevel)
220 volatile _SEH2HandleTryLevel_t * fulltrylevel =
CONTAINING_RECORD(trylevel, _SEH2HandleTryLevel_t, SHT_Common);
224 frame->SF_TopTryLevel = fulltrylevel->SHT_Common.ST_Next;
228 fulltrylevel->SHT_Common.ST_Body,
229 fulltrylevel->SHT_Esp,
230 fulltrylevel->SHT_Ebp,
231 fulltrylevel->SHT_Ebx,
232 fulltrylevel->SHT_Esi,
233 fulltrylevel->SHT_Edi
246 _SEH2Frame_t * frame;
259 volatile _SEH2TryLevel_t * trylevel;
267 for(trylevel = frame->SF_TopTryLevel; trylevel !=
NULL; trylevel = trylevel->ST_Next)
292 frame->SF_TopTryLevel = trylevel;
@ ExceptionContinueSearch
@ ExceptionCollidedUnwind
@ ExceptionContinueExecution
FORCEINLINE _SEH2Registration_t *__cdecl _SEH2CurrentRegistration(void)
#define EXCEPTION_EXIT_UNWIND
static __SEH_EXCEPT_RET _SEH2Except(_SEH2Frame_t *frame, volatile _SEH2TryLevel_t *trylevel, struct _EXCEPTION_POINTERS *ep)
FORCEINLINE void __cdecl __SEH2LeaveFrame(void)
static void _SEH2LocalUnwind(_SEH2Frame_t *, volatile _SEH2TryLevel_t *)
int __cdecl __SEH2FrameHandler(struct _EXCEPTION_RECORD *, void *, struct _CONTEXT *, void *)
struct __SEH2UnwindFrame _SEH2UnwindFrame_t
int __cdecl _SEH2EnterFrameAndTrylevel(_SEH2Frame_t *frame, volatile _SEH2TryLevel_t *trylevel)
static DECLSPEC_NORETURN void _SEH2Handle(_SEH2Frame_t *frame, volatile _SEH2TryLevel_t *trylevel)
FORCEINLINE void * _SEHFunctionFromTrampoline(_SEHTrampoline_t *trampoline_)
int __cdecl __SEH2UnwindHandler(struct _EXCEPTION_RECORD *, void *, struct _CONTEXT *, void *)
void __cdecl _SEH2EnterFrame(_SEH2Frame_t *frame)
void __cdecl _SEH2Return(void)
FORCEINLINE void * _SEHClosureFromTrampoline(_SEHTrampoline_t *trampoline_)
int __cdecl _SEH2UnwindHandler(struct _EXCEPTION_RECORD *ExceptionRecord, void *EstablisherFrame, struct _CONTEXT *ContextRecord, void *DispatcherContext)
static void _SEH2Finally(_SEH2Frame_t *frame, volatile _SEH2TryLevel_t *trylevel)
#define EXCEPTION_UNWINDING
DECLSPEC_NORETURN int __SEH2Handle(void *, void *, void *, void *, void *, void *)
void __cdecl _SEH2LeaveFrame(void)
int __cdecl _SEH2FrameHandler(struct _EXCEPTION_RECORD *ExceptionRecord, void *EstablisherFrame, struct _CONTEXT *ContextRecord, void *DispatcherContext)
FORCEINLINE void __cdecl __SEH2EnterFrame(_SEH2Registration_t *frame)
FORCEINLINE void _SEH2GlobalUnwind(void *target)
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
GLuint GLenum GLsizei GLsizei GLint GLint GLboolean packed
PPC_QUAL void __writefsdword(const unsigned long Offset, const unsigned long Data)
PPC_QUAL unsigned long __readfsdword(const unsigned long Offset)
NTSYSAPI VOID NTAPI RtlUnwind(_In_opt_ PVOID TargetFrame, _In_opt_ PVOID TargetIp, _In_opt_ PEXCEPTION_RECORD ExceptionRecord, _In_ PVOID ReturnValue)
_IRQL_requires_same_ _In_ PVOID EstablisherFrame
_IRQL_requires_same_ _In_ PVOID _Inout_ struct _CONTEXT * ContextRecord
#define DECLSPEC_NORETURN
_IRQL_requires_same_ _In_ PVOID _Inout_ struct _CONTEXT _In_ PVOID DispatcherContext
__asm__(".p2align 4, 0x90\n" ".seh_proc __seh2_global_filter_func\n" "__seh2_global_filter_func:\n" "\tsub %rbp, %rax\n" "\tpush %rbp\n" "\t.seh_pushreg %rbp\n" "\tsub $32, %rsp\n" "\t.seh_stackalloc 32\n" "\t.seh_endprologue\n" "\tsub %rax, %rdx\n" "\tmov %rdx, %rbp\n" "\tjmp *%r8\n" "__seh2_global_filter_func_exit:\n" "\t.p2align 4\n" "\tadd $32, %rsp\n" "\tpop %rbp\n" "\tret\n" "\t.seh_endproc")
static const void * body(MD5_CTX *ctx, const void *data, unsigned long size)
PEXCEPTION_RECORD ExceptionRecord
volatile _SEH2TryLevel_t * SUF_TargetTryLevel
_SEH2Registration_t SUF_Registration
unsigned char * STR_Closure
unsigned char * STR_Function
#define CONTAINING_RECORD(address, type, field)