NtRaiseException fixed to not clobber EAX any more, and both NtContinue and NtRaiseException no longer clobber EDX. kmode SEH works now, but there are likely some lingering bugs. This patch was made possible by the collaborative efforts of myself, kjk_hyperion, Art Yerkes, and Skywing.

svn path=/trunk/; revision=9967
This commit is contained in:
Royce Mitchell III 2004-07-02 01:36:25 +00:00
parent 6a225669b5
commit c76e499296
3 changed files with 81 additions and 49 deletions

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: catch.c,v 1.43 2004/06/23 22:31:51 ion Exp $
/* $Id: catch.c,v 1.44 2004/07/02 01:36:25 royce Exp $
*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ke/catch.c
@ -256,16 +256,27 @@ ExSystemExceptionFilter()
return FALSE;
}
VOID
FASTCALL
KeRosTrapReturn ( PKTRAP_FRAME TrapFrame, PKTRAP_FRAME PrevTrapFrame );
NTSTATUS STDCALL
NtRaiseException (IN PEXCEPTION_RECORD ExceptionRecord,
IN PCONTEXT Context,
IN BOOLEAN SearchFrames)
{
PKTRAP_FRAME TrapFrame = KeGetCurrentThread()->TrapFrame;
PKTRAP_FRAME PrevTrapFrame = (PKTRAP_FRAME)TrapFrame->Edx;
KeGetCurrentKPCR()->Tib.ExceptionList = TrapFrame->ExceptionList;
KiDispatchException(ExceptionRecord,
Context,
PsGetCurrentThread()->Tcb.TrapFrame,
(KPROCESSOR_MODE)ExGetPreviousMode(),
SearchFrames);
KeRosTrapReturn ( TrapFrame, PrevTrapFrame );
return(STATUS_SUCCESS);
}

View file

@ -630,10 +630,7 @@ KiTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr)
VOID
KeDumpStackFrames(PULONG Frame)
{
ULONG i;
DbgPrint("Frames: ");
i = 1;
while ( MmIsAddressValid(Frame) )
{
if (!KeRosPrintAddress((PVOID)Frame[1]))
@ -641,15 +638,15 @@ KeDumpStackFrames(PULONG Frame)
DbgPrint("<%X>", (PVOID)Frame[1]);
}
Frame = (PULONG)Frame[0];
i++;
DbgPrint(" ");
}
DbgPrint("\n");
}
VOID STDCALL
KeRosDumpStackFrames ( PULONG Frame, ULONG FrameCount )
{
ULONG i;
ULONG i=0;
DbgPrint("Frames: ");
if ( !Frame )
@ -657,7 +654,6 @@ KeRosDumpStackFrames ( PULONG Frame, ULONG FrameCount )
__asm__("mov %%ebp, %%ebx" : "=b" (Frame) : );
Frame = (PULONG)Frame[0]; // step out of KeRosDumpStackFrames
}
i = 1;
while ( MmIsAddressValid(Frame) && i++ < FrameCount )
{
if (!KeRosPrintAddress((PVOID)Frame[1]))
@ -667,6 +663,7 @@ KeRosDumpStackFrames ( PULONG Frame, ULONG FrameCount )
Frame = (PULONG)Frame[0];
DbgPrint(" ");
}
DbgPrint("\n");
}
static void set_system_call_gate(unsigned int sel, unsigned int func)
@ -759,3 +756,31 @@ KeRaiseUserException(IN NTSTATUS ExceptionCode)
Thread->Teb->ExceptionCode = ExceptionCode;
return((NTSTATUS)OldEip);
}
VOID
FASTCALL
KeRosTrapReturn ( PKTRAP_FRAME TrapFrame, PKTRAP_FRAME PrevTrapFrame );
/*
* @implemented
*/
NTSTATUS STDCALL
NtRaiseException (
IN PEXCEPTION_RECORD ExceptionRecord,
IN PCONTEXT Context,
IN BOOLEAN SearchFrames)
{
PKTRAP_FRAME TrapFrame = KeGetCurrentThread()->TrapFrame;
PKTRAP_FRAME PrevTrapFrame = (PKTRAP_FRAME)TrapFrame->Edx;
KeGetCurrentKPCR()->Tib.ExceptionList = TrapFrame->ExceptionList;
KiDispatchException(ExceptionRecord,
Context,
PsGetCurrentThread()->Tcb.TrapFrame,
(KPROCESSOR_MODE)ExGetPreviousMode(),
SearchFrames);
KeRosTrapReturn ( TrapFrame, PrevTrapFrame );
return(STATUS_SUCCESS);
}

View file

@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: debug.c,v 1.11 2003/07/21 21:36:01 dwelch Exp $
/* $Id: debug.c,v 1.12 2004/07/02 01:36:25 royce Exp $
*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ps/debug.c
@ -69,11 +69,7 @@ KeContextToTrapFrame(PCONTEXT Context,
TrapFrame->Eax = Context->Eax;
TrapFrame->Ebx = Context->Ebx;
TrapFrame->Ecx = Context->Ecx;
/*
* Edx is used in the TrapFrame to hold the old trap frame pointer
* so we don't want to overwrite it here
*/
/* TrapFrame->Edx = Context->Edx; */
TrapFrame->Edx = Context->Edx;
TrapFrame->Esi = Context->Esi;
TrapFrame->Edi = Context->Edi;
}