Author: hyperion
Date: Mon Dec 29 22:00:45 2008
New Revision: 38460
URL:
http://svn.reactos.org/svn/reactos?rev=38460&view=rev
Log:
modified lib/pseh/framebased-gcchack.c
modified lib/pseh/i386/framebased-gcchack.S
Correctly handle exceptions thrown during unwinding
Renamed some internal routines to more appropriate names
Modified:
trunk/reactos/lib/pseh/framebased-gcchack.c
trunk/reactos/lib/pseh/i386/framebased-gcchack.S
Modified: trunk/reactos/lib/pseh/framebased-gcchack.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/pseh/framebased-gcchac…
==============================================================================
--- trunk/reactos/lib/pseh/framebased-gcchack.c [iso-8859-1] (original)
+++ trunk/reactos/lib/pseh/framebased-gcchack.c [iso-8859-1] Mon Dec 29 22:00:45 2008
@@ -40,7 +40,7 @@
extern DECLSPEC_NORETURN int __SEH2Handle(void *, void *, void *);
extern int __cdecl __SEH2FrameHandler(struct _EXCEPTION_RECORD *, void *, struct _CONTEXT
*, void *);
-extern int __cdecl __SEH2NestedHandler(struct _EXCEPTION_RECORD *, void *, struct
_CONTEXT *, void *);
+extern int __cdecl __SEH2UnwindHandler(struct _EXCEPTION_RECORD *, void *, struct
_CONTEXT *, void *);
FORCEINLINE
_SEH2Registration_t * __cdecl _SEH2CurrentRegistration(void)
@@ -134,8 +134,18 @@
}
}
-extern
-int __cdecl _SEH2NestedHandler
+typedef struct __SEH2UnwindFrame
+{
+ _SEH2Registration_t SUF_Registration;
+ _SEH2Frame_t * SUF_Frame;
+ volatile _SEH2TryLevel_t * SUF_TargetTryLevel;
+}
+_SEH2UnwindFrame_t;
+
+static void _SEH2LocalUnwind(_SEH2Frame_t *, volatile _SEH2TryLevel_t *);
+
+extern
+int __cdecl _SEH2UnwindHandler
(
struct _EXCEPTION_RECORD * ExceptionRecord,
void * EstablisherFrame,
@@ -144,25 +154,33 @@
)
{
if(ExceptionRecord->ExceptionFlags & (EXCEPTION_EXIT_UNWIND |
EXCEPTION_UNWINDING))
- return ExceptionContinueSearch;
-
- *((void **)DispatcherContext) = EstablisherFrame;
- return ExceptionCollidedUnwind;
+ {
+ _SEH2UnwindFrame_t * unwindframe = CONTAINING_RECORD(EstablisherFrame,
_SEH2UnwindFrame_t, SUF_Registration);
+ _SEH2LocalUnwind(unwindframe->SUF_Frame, unwindframe->SUF_TargetTryLevel);
+ *((void **)DispatcherContext) = EstablisherFrame;
+ return ExceptionCollidedUnwind;
+ }
+
+ return ExceptionContinueSearch;
}
static
void _SEH2LocalUnwind(_SEH2Frame_t * frame, volatile _SEH2TryLevel_t * dsttrylevel)
{
volatile _SEH2TryLevel_t * trylevel;
- _SEH2Registration_t nestedframe;
-
- nestedframe.SER_Handler = &__SEH2NestedHandler;
- __SEH2EnterFrame(&nestedframe);
+ _SEH2UnwindFrame_t unwindframe;
+
+ unwindframe.SUF_Frame = frame;
+ unwindframe.SUF_TargetTryLevel = dsttrylevel;
+
+ unwindframe.SUF_Registration.SER_Handler = &__SEH2UnwindHandler;
+ __SEH2EnterFrame(&unwindframe.SUF_Registration);
for(trylevel = frame->SF_TopTryLevel; trylevel && trylevel != dsttrylevel;
trylevel = trylevel->ST_Next)
+ {
+ frame->SF_TopTryLevel = trylevel->ST_Next;
_SEH2Finally(frame, trylevel);
-
- frame->SF_TopTryLevel = dsttrylevel;
+ }
__SEH2LeaveFrame();
}
Modified: trunk/reactos/lib/pseh/i386/framebased-gcchack.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/pseh/i386/framebased-g…
==============================================================================
--- trunk/reactos/lib/pseh/i386/framebased-gcchack.S [iso-8859-1] (original)
+++ trunk/reactos/lib/pseh/i386/framebased-gcchack.S [iso-8859-1] Mon Dec 29 22:00:45
2008
@@ -40,14 +40,14 @@
jmp __SEH2FrameHandler
.endfunc
-.func __SEH2NestedHandler
-.globl ___SEH2NestedHandler
-___SEH2NestedHandler:
+.func __SEH2UnwindHandler
+.globl ___SEH2UnwindHandler
+___SEH2UnwindHandler:
-.extern __SEH2NestedHandler
+.extern __SEH2UnwindHandler
cld
- jmp __SEH2NestedHandler
+ jmp __SEH2UnwindHandler
.endfunc
// EOF