mirror of
https://github.com/reactos/reactos.git
synced 2025-01-05 22:12:46 +00:00
- Canceled my last changes.
svn path=/trunk/; revision=11847
This commit is contained in:
parent
7eacfe074f
commit
4ed81178eb
3 changed files with 18 additions and 54 deletions
|
@ -78,9 +78,6 @@ KiFloatingSaveAreaToFxSaveArea(PFX_SAVE_AREA FxSaveArea, CONST FLOATING_SAVE_ARE
|
|||
BOOL
|
||||
KiContextToFxSaveArea(PFX_SAVE_AREA FxSaveArea, PCONTEXT Context);
|
||||
|
||||
VOID
|
||||
KiClearFloatingPointState(BOOLEAN Save);
|
||||
|
||||
#endif /* !__ASM__ */
|
||||
|
||||
#endif /* __NTOSKRNL_INCLUDE_INTERNAL_I386_FPU_H */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: fpu.c,v 1.18 2004/11/27 16:12:26 hbirr Exp $
|
||||
/* $Id: fpu.c,v 1.19 2004/11/27 23:50:26 hbirr Exp $
|
||||
*
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team
|
||||
|
@ -403,44 +403,6 @@ KeRestoreFloatingPointState(IN PKFLOATING_SAVE Save)
|
|||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
VOID
|
||||
KiClearFloatingPointState(BOOLEAN Save)
|
||||
{
|
||||
PKTHREAD CurrentThread;
|
||||
PFX_SAVE_AREA FxSaveArea;
|
||||
|
||||
ASSERT(KeGetCurrentIrql() >= DISPATCH_LEVEL);
|
||||
|
||||
CurrentThread = KeGetCurrentThread();
|
||||
|
||||
if (CurrentThread->NpxState & NPX_STATE_DIRTY)
|
||||
{
|
||||
if (Save)
|
||||
{
|
||||
FxSaveArea = (PFX_SAVE_AREA)((char *)CurrentThread->InitialStack - sizeof (FX_SAVE_AREA));
|
||||
if (FxsrSupport)
|
||||
{
|
||||
asm volatile("fxsave %0" : : "m"(FxSaveArea->U.FxArea));
|
||||
}
|
||||
else
|
||||
{
|
||||
asm volatile("fnsave %0" : : "m"(FxSaveArea->U.FnArea));
|
||||
}
|
||||
CurrentThread->NpxState = NPX_STATE_VALID;
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentThread->NpxState = NPX_STATE_INVALID;
|
||||
}
|
||||
Ke386SetCr0(Ke386GetCr0() | X86_CR0_TS);
|
||||
}
|
||||
if (KeGetCurrentKPCR()->PrcbData.NpxThread == CurrentThread)
|
||||
{
|
||||
KeGetCurrentKPCR()->PrcbData.NpxThread = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
KiHandleFpuFault(PKTRAP_FRAME Tf, ULONG ExceptionNr)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: w32call.c,v 1.19 2004/11/27 16:12:26 hbirr Exp $
|
||||
/* $Id: w32call.c,v 1.20 2004/11/27 23:50:27 hbirr Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -45,7 +45,6 @@ typedef struct _NTW32CALL_SAVED_STATE
|
|||
PKTRAP_FRAME SavedTrapFrame;
|
||||
PVOID SavedCallbackStack;
|
||||
PVOID SavedExceptionStack;
|
||||
BYTE SavedNpxState;
|
||||
} NTW32CALL_SAVED_STATE, *PNTW32CALL_SAVED_STATE;
|
||||
|
||||
typedef struct
|
||||
|
@ -84,7 +83,6 @@ NtCallbackReturn (PVOID Result,
|
|||
PKTRAP_FRAME SavedTrapFrame;
|
||||
PVOID SavedCallbackStack;
|
||||
PVOID SavedExceptionStack;
|
||||
BYTE SavedNpxState;
|
||||
|
||||
Thread = PsGetCurrentThread();
|
||||
if (Thread->Tcb.CallbackStack == NULL)
|
||||
|
@ -107,7 +105,7 @@ NtCallbackReturn (PVOID Result,
|
|||
SavedTrapFrame = State->SavedTrapFrame;
|
||||
SavedCallbackStack = State->SavedCallbackStack;
|
||||
SavedExceptionStack = State->SavedExceptionStack;
|
||||
SavedNpxState = State->SavedNpxState;
|
||||
|
||||
/*
|
||||
* Copy the callback status and the callback result to NtW32Call
|
||||
*/
|
||||
|
@ -129,14 +127,20 @@ NtCallbackReturn (PVOID Result,
|
|||
* Restore the old stack.
|
||||
*/
|
||||
KeRaiseIrql(HIGH_LEVEL, &oldIrql);
|
||||
KiClearFloatingPointState(FALSE);
|
||||
Thread->Tcb.NpxState = SavedNpxState;
|
||||
if ((Thread->Tcb.NpxState & NPX_STATE_VALID) &&
|
||||
ETHREAD_TO_KTHREAD(Thread) != KeGetCurrentKPCR()->PrcbData.NpxThread)
|
||||
{
|
||||
memcpy((char*)InitialStack - sizeof(FX_SAVE_AREA),
|
||||
(char*)Thread->Tcb.InitialStack - sizeof(FX_SAVE_AREA),
|
||||
sizeof(FX_SAVE_AREA));
|
||||
}
|
||||
Thread->Tcb.InitialStack = InitialStack;
|
||||
Thread->Tcb.StackBase = StackBase;
|
||||
Thread->Tcb.StackLimit = StackLimit;
|
||||
Thread->Tcb.TrapFrame = SavedTrapFrame;
|
||||
Thread->Tcb.CallbackStack = SavedCallbackStack;
|
||||
KeGetCurrentKPCR()->TSS->Esp0 = (ULONG)SavedExceptionStack;
|
||||
Ke386SetCr0(Ke386GetCr0() | X86_CR0_TS); /* set TS */
|
||||
KeStackSwitchAndRet((PVOID)(OldStack + 1));
|
||||
|
||||
/* Should never return. */
|
||||
|
@ -239,7 +243,6 @@ PsAllocateCallbackStack(ULONG StackSize)
|
|||
}
|
||||
return(NULL);
|
||||
}
|
||||
DPRINT1("KernelStack %x\n", KernelStack);
|
||||
return(KernelStack);
|
||||
}
|
||||
|
||||
|
@ -311,15 +314,17 @@ NtW32Call (IN ULONG RoutineIndex,
|
|||
SavedState.SavedTrapFrame = Thread->Tcb.TrapFrame;
|
||||
SavedState.SavedCallbackStack = Thread->Tcb.CallbackStack;
|
||||
SavedState.SavedExceptionStack = (PVOID)KeGetCurrentKPCR()->TSS->Esp0;
|
||||
|
||||
KiClearFloatingPointState(TRUE);
|
||||
|
||||
SavedState.SavedNpxState = Thread->Tcb.NpxState;
|
||||
if ((Thread->Tcb.NpxState & NPX_STATE_VALID) &&
|
||||
ETHREAD_TO_KTHREAD(Thread) != KeGetCurrentKPCR()->PrcbData.NpxThread)
|
||||
{
|
||||
memcpy((char*)NewStack + StackSize - sizeof(FX_SAVE_AREA),
|
||||
(char*)SavedState.SavedInitialStack - sizeof(FX_SAVE_AREA),
|
||||
sizeof(FX_SAVE_AREA));
|
||||
}
|
||||
Thread->Tcb.InitialStack = Thread->Tcb.StackBase = (char*)NewStack + StackSize;
|
||||
Thread->Tcb.StackLimit = (ULONG)NewStack;
|
||||
Thread->Tcb.KernelStack = (char*)NewStack + StackSize - sizeof(KTRAP_FRAME) - sizeof(FX_SAVE_AREA);
|
||||
KeGetCurrentKPCR()->TSS->Esp0 = (ULONG)Thread->Tcb.InitialStack - sizeof(FX_SAVE_AREA);
|
||||
Thread->Tcb.NpxState = NPX_STATE_INVALID;
|
||||
KePushAndStackSwitchAndSysRet((ULONG)&SavedState, Thread->Tcb.KernelStack);
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue