From e7584f9a3e47cf22129728876d290ec6166f1de3 Mon Sep 17 00:00:00 2001 From: "KJK::Hyperion" Date: Wed, 12 Nov 2008 20:39:18 +0000 Subject: [PATCH] modified include/reactos/libs/pseh/pseh2.h modified lib/pseh/framebased-gcchack.c modified lib/pseh/i386/framebased-gcchack.S Implemented _SEH2_YIELD and _SEH2_LEAVE - 2.0 equivalents of _SEH_YIELD and _SEH_LEAVE, naturally svn path=/trunk/; revision=37318 --- reactos/include/reactos/libs/pseh/pseh2.h | 12 ++++++++++++ reactos/lib/pseh/framebased-gcchack.c | 9 +++++++++ reactos/lib/pseh/i386/framebased-gcchack.S | 5 +++++ 3 files changed, 26 insertions(+) diff --git a/reactos/include/reactos/libs/pseh/pseh2.h b/reactos/include/reactos/libs/pseh/pseh2.h index 4e24d334c8a..f980dbca5a0 100644 --- a/reactos/include/reactos/libs/pseh/pseh2.h +++ b/reactos/include/reactos/libs/pseh/pseh2.h @@ -340,6 +340,17 @@ _SEHTryLevel_t; #define _SEH2_GetExceptionPointers() ((struct _EXCEPTION_POINTERS *)_SEHExceptionPointers) #define _SEH2_GetExceptionCode() ((_SEHFrameP)->SF_Code) +#define _SEH2_YIELD(STMT_) \ + for(;;) \ + { \ + if(!_SEHScopeKind) \ + _SEH2Return(); \ + \ + STMT_; \ + } + +#define _SEH2_LEAVE goto _SEHEndTry + __SEH_END_SCOPE_CHAIN; #ifdef __cplusplus @@ -349,6 +360,7 @@ extern "C" extern void __cdecl _SEH2EnterFrame(_SEHFrame_t *); extern void __cdecl _SEH2LeaveFrame(void); +extern void __cdecl _SEH2Return(void); #ifdef __cplusplus } diff --git a/reactos/lib/pseh/framebased-gcchack.c b/reactos/lib/pseh/framebased-gcchack.c index caeb24fe798..0294113e39c 100644 --- a/reactos/lib/pseh/framebased-gcchack.c +++ b/reactos/lib/pseh/framebased-gcchack.c @@ -29,6 +29,8 @@ #include +extern _SEHRegistration_t * __cdecl _SEH2CurrentRegistration(void); + extern int __SEH2Except(void *, void *, void *); extern void __SEH2Finally(void *, void *); @@ -156,4 +158,11 @@ void __cdecl _SEH2LeaveFrame() ); } +extern +void __cdecl _SEH2Return(void) +{ + _SEH2LocalUnwind(CONTAINING_RECORD(_SEH2CurrentRegistration(), _SEHFrame_t, SF_Registration), NULL); + _SEH2LeaveFrame(); +} + /* EOF */ diff --git a/reactos/lib/pseh/i386/framebased-gcchack.S b/reactos/lib/pseh/i386/framebased-gcchack.S index 81747c0dd13..ce36cf93c47 100644 --- a/reactos/lib/pseh/i386/framebased-gcchack.S +++ b/reactos/lib/pseh/i386/framebased-gcchack.S @@ -21,6 +21,11 @@ .text .intel_syntax noprefix +.globl __SEH2CurrentRegistration +__SEH2CurrentRegistration: + mov eax, [fs:0] + ret + .globl ___SEH2Except ___SEH2Except: mov eax, [esp+4]