mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 18:52:57 +00:00
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:
parent
6a225669b5
commit
c76e499296
3 changed files with 81 additions and 49 deletions
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* 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
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: ntoskrnl/ke/catch.c
|
* FILE: ntoskrnl/ke/catch.c
|
||||||
|
@ -256,16 +256,27 @@ ExSystemExceptionFilter()
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
FASTCALL
|
||||||
|
KeRosTrapReturn ( PKTRAP_FRAME TrapFrame, PKTRAP_FRAME PrevTrapFrame );
|
||||||
|
|
||||||
NTSTATUS STDCALL
|
NTSTATUS STDCALL
|
||||||
NtRaiseException (IN PEXCEPTION_RECORD ExceptionRecord,
|
NtRaiseException (IN PEXCEPTION_RECORD ExceptionRecord,
|
||||||
IN PCONTEXT Context,
|
IN PCONTEXT Context,
|
||||||
IN BOOLEAN SearchFrames)
|
IN BOOLEAN SearchFrames)
|
||||||
{
|
{
|
||||||
|
PKTRAP_FRAME TrapFrame = KeGetCurrentThread()->TrapFrame;
|
||||||
|
PKTRAP_FRAME PrevTrapFrame = (PKTRAP_FRAME)TrapFrame->Edx;
|
||||||
|
|
||||||
|
KeGetCurrentKPCR()->Tib.ExceptionList = TrapFrame->ExceptionList;
|
||||||
|
|
||||||
KiDispatchException(ExceptionRecord,
|
KiDispatchException(ExceptionRecord,
|
||||||
Context,
|
Context,
|
||||||
PsGetCurrentThread()->Tcb.TrapFrame,
|
PsGetCurrentThread()->Tcb.TrapFrame,
|
||||||
(KPROCESSOR_MODE)ExGetPreviousMode(),
|
(KPROCESSOR_MODE)ExGetPreviousMode(),
|
||||||
SearchFrames);
|
SearchFrames);
|
||||||
|
|
||||||
|
KeRosTrapReturn ( TrapFrame, PrevTrapFrame );
|
||||||
return(STATUS_SUCCESS);
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -630,10 +630,7 @@ KiTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr)
|
||||||
VOID
|
VOID
|
||||||
KeDumpStackFrames(PULONG Frame)
|
KeDumpStackFrames(PULONG Frame)
|
||||||
{
|
{
|
||||||
ULONG i;
|
|
||||||
|
|
||||||
DbgPrint("Frames: ");
|
DbgPrint("Frames: ");
|
||||||
i = 1;
|
|
||||||
while ( MmIsAddressValid(Frame) )
|
while ( MmIsAddressValid(Frame) )
|
||||||
{
|
{
|
||||||
if (!KeRosPrintAddress((PVOID)Frame[1]))
|
if (!KeRosPrintAddress((PVOID)Frame[1]))
|
||||||
|
@ -641,15 +638,15 @@ KeDumpStackFrames(PULONG Frame)
|
||||||
DbgPrint("<%X>", (PVOID)Frame[1]);
|
DbgPrint("<%X>", (PVOID)Frame[1]);
|
||||||
}
|
}
|
||||||
Frame = (PULONG)Frame[0];
|
Frame = (PULONG)Frame[0];
|
||||||
i++;
|
|
||||||
DbgPrint(" ");
|
DbgPrint(" ");
|
||||||
}
|
}
|
||||||
|
DbgPrint("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID STDCALL
|
VOID STDCALL
|
||||||
KeRosDumpStackFrames ( PULONG Frame, ULONG FrameCount )
|
KeRosDumpStackFrames ( PULONG Frame, ULONG FrameCount )
|
||||||
{
|
{
|
||||||
ULONG i;
|
ULONG i=0;
|
||||||
|
|
||||||
DbgPrint("Frames: ");
|
DbgPrint("Frames: ");
|
||||||
if ( !Frame )
|
if ( !Frame )
|
||||||
|
@ -657,7 +654,6 @@ KeRosDumpStackFrames ( PULONG Frame, ULONG FrameCount )
|
||||||
__asm__("mov %%ebp, %%ebx" : "=b" (Frame) : );
|
__asm__("mov %%ebp, %%ebx" : "=b" (Frame) : );
|
||||||
Frame = (PULONG)Frame[0]; // step out of KeRosDumpStackFrames
|
Frame = (PULONG)Frame[0]; // step out of KeRosDumpStackFrames
|
||||||
}
|
}
|
||||||
i = 1;
|
|
||||||
while ( MmIsAddressValid(Frame) && i++ < FrameCount )
|
while ( MmIsAddressValid(Frame) && i++ < FrameCount )
|
||||||
{
|
{
|
||||||
if (!KeRosPrintAddress((PVOID)Frame[1]))
|
if (!KeRosPrintAddress((PVOID)Frame[1]))
|
||||||
|
@ -667,6 +663,7 @@ KeRosDumpStackFrames ( PULONG Frame, ULONG FrameCount )
|
||||||
Frame = (PULONG)Frame[0];
|
Frame = (PULONG)Frame[0];
|
||||||
DbgPrint(" ");
|
DbgPrint(" ");
|
||||||
}
|
}
|
||||||
|
DbgPrint("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_system_call_gate(unsigned int sel, unsigned int func)
|
static void set_system_call_gate(unsigned int sel, unsigned int func)
|
||||||
|
@ -759,3 +756,31 @@ KeRaiseUserException(IN NTSTATUS ExceptionCode)
|
||||||
Thread->Teb->ExceptionCode = ExceptionCode;
|
Thread->Teb->ExceptionCode = ExceptionCode;
|
||||||
return((NTSTATUS)OldEip);
|
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);
|
||||||
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* 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
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: ntoskrnl/ps/debug.c
|
* FILE: ntoskrnl/ps/debug.c
|
||||||
|
@ -69,11 +69,7 @@ KeContextToTrapFrame(PCONTEXT Context,
|
||||||
TrapFrame->Eax = Context->Eax;
|
TrapFrame->Eax = Context->Eax;
|
||||||
TrapFrame->Ebx = Context->Ebx;
|
TrapFrame->Ebx = Context->Ebx;
|
||||||
TrapFrame->Ecx = Context->Ecx;
|
TrapFrame->Ecx = Context->Ecx;
|
||||||
/*
|
TrapFrame->Edx = Context->Edx;
|
||||||
* 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->Esi = Context->Esi;
|
TrapFrame->Esi = Context->Esi;
|
||||||
TrapFrame->Edi = Context->Edi;
|
TrapFrame->Edi = Context->Edi;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue