[NTOS]: We don't actually need wrappers for NtContinue/NtRaiseException. These are now fully portable C code, so move them appropriately.

svn path=/trunk/; revision=45145
This commit is contained in:
Sir Richard 2010-01-19 08:41:03 +00:00
parent 94d748c642
commit 7bd79bce9e
4 changed files with 84 additions and 90 deletions

View file

@ -950,6 +950,12 @@ KiContinue(
IN PKTRAP_FRAME TrapFrame
);
VOID
FASTCALL
KiServiceExit(
IN PKTRAP_FRAME TrapFrame
);
VOID
FASTCALL
KiServiceExit2(

View file

@ -1,9 +1,10 @@
/*
* PROJECT: ReactOS Kernel
* LICENSE: GPL - See COPYING in the top level directory
* LICENSE: BSD - See COPYING.ARM in the top level directory
* FILE: ntoskrnl/ke/except.c
* PURPOSE: Platform independent exception handling
* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
* PROGRAMMERS: ReactOS Portable Systems Group
* Alex Ionescu (alex.ionescu@reactos.org)
*/
/* INCLUDES ******************************************************************/
@ -164,4 +165,79 @@ KiRaiseException(IN PEXCEPTION_RECORD ExceptionRecord,
return STATUS_SUCCESS;
}
/* SYSTEM CALLS ***************************************************************/
NTSTATUS
NTAPI
NtRaiseException(IN PEXCEPTION_RECORD ExceptionRecord,
IN PCONTEXT Context,
IN BOOLEAN FirstChance)
{
NTSTATUS Status;
PKTHREAD Thread;
PKTRAP_FRAME TrapFrame;
/* Get trap frame and link previous one*/
Thread = KeGetCurrentThread();
TrapFrame = Thread->TrapFrame;
Thread->TrapFrame = (PKTRAP_FRAME)TrapFrame->Edx;
/* Set exception list */
KeGetPcr()->Tib.ExceptionList = TrapFrame->ExceptionList;
/* Raise the exception */
Status = KiRaiseException(ExceptionRecord,
Context,
NULL,
TrapFrame,
FirstChance);
if (NT_SUCCESS(Status))
{
/* It was handled, so exit restoring all state */
KiServiceExit2(TrapFrame);
}
else
{
/* Exit with error */
KiServiceExit(TrapFrame, Status);
}
/* We don't actually make it here */
return Status;
}
NTSTATUS
NTAPI
NtContinue(IN PCONTEXT Context,
IN BOOLEAN TestAlert)
{
PKTHREAD Thread;
NTSTATUS Status;
PKTRAP_FRAME TrapFrame;
/* Get trap frame and link previous one*/
Thread = KeGetCurrentThread();
TrapFrame = Thread->TrapFrame;
Thread->TrapFrame = (PKTRAP_FRAME)TrapFrame->Edx;
/* Continue from this point on */
Status = KiContinue(Context, NULL, TrapFrame);
if (NT_SUCCESS(Status))
{
/* Check if alert was requested */
if (TestAlert) KeTestAlertThread(Thread->PreviousMode);
/* Exit to new trap frame */
KiServiceExit2(TrapFrame);
}
else
{
/* Exit with an error */
KiServiceExit(TrapFrame, Status);
}
/* We don't actually make it here */
return Status;
}
/* EOF */

View file

@ -393,23 +393,6 @@ GENERATE_TRAP_HANDLER KiCallbackReturn, 1
GENERATE_TRAP_HANDLER KiRaiseAssertion, 1
GENERATE_TRAP_HANDLER KiDebugService, 1
.func NtRaiseException@12
_NtRaiseException@12:
/* Call C code */
mov ecx, [esp+4]
mov edx, [esp+8]
or edx, [esp+12]
jmp @NtRaiseExceptionHandler@8
.endfunc
.func NtContinue@8
_NtContinue@8:
/* Call C code */
mov ecx, [esp+4]
mov edx, [esp+8]
jmp @NtContinueHandler@8
.endfunc
/* HARDWARE TRAP HANDLERS ****************************************************/
GENERATE_TRAP_HANDLER KiTrap00

View file

@ -1691,77 +1691,6 @@ KiDebugServiceHandler(IN PKTRAP_FRAME TrapFrame)
KiDebugHandler(TrapFrame, TrapFrame->Eax, TrapFrame->Ecx, TrapFrame->Edx);
}
VOID
FASTCALL
NtRaiseExceptionHandler(IN PEXCEPTION_RECORD ExceptionRecord,
IN PCONTEXT Context)
{
BOOLEAN FirstChance;
NTSTATUS Status;
PKTHREAD Thread;
PKTRAP_FRAME TrapFrame;
/* Fixup parameters */
FirstChance = (ULONG_PTR)Context & 1;
Context = (PVOID)((ULONG_PTR)Context & ~1);
/* Get trap frame and link previous one*/
Thread = KeGetCurrentThread();
TrapFrame = Thread->TrapFrame;
Thread->TrapFrame = (PKTRAP_FRAME)TrapFrame->Edx;
/* Set exception list */
KeGetPcr()->Tib.ExceptionList = TrapFrame->ExceptionList;
/* Raise the exception */
Status = KiRaiseException(ExceptionRecord,
Context,
NULL,
TrapFrame,
FirstChance);
if (NT_SUCCESS(Status))
{
/* It was handled, so exit restoring all state */
KiServiceExit2(TrapFrame);
}
else
{
/* Exit with error */
KiServiceExit(TrapFrame, Status);
}
}
VOID
FASTCALL
NtContinueHandler(IN PCONTEXT Context,
IN BOOLEAN TestAlert)
{
PKTHREAD Thread;
NTSTATUS Status;
PKTRAP_FRAME TrapFrame;
/* Get trap frame and link previous one*/
Thread = KeGetCurrentThread();
TrapFrame = Thread->TrapFrame;
Thread->TrapFrame = (PKTRAP_FRAME)TrapFrame->Edx;
/* Continue from this point on */
Status = KiContinue(Context, NULL, TrapFrame);
if (NT_SUCCESS(Status))
{
/* Check if alert was requested */
if (TestAlert) KeTestAlertThread(Thread->PreviousMode);
/* Exit to new trap frame */
KiServiceExit2(TrapFrame);
}
else
{
/* Exit with an error */
KiServiceExit(TrapFrame, Status);
}
}
/* HARDWARE INTERRUPTS ********************************************************/
/*