mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
[NTOS][RTL] Initialize MxCsr where missing
This commit is contained in:
parent
a82e46e521
commit
39f11249ff
5 changed files with 19 additions and 7 deletions
|
@ -600,6 +600,9 @@ BaseInitializeContext(IN PCONTEXT Context,
|
|||
/* Set the EFLAGS */
|
||||
Context->EFlags = 0x3000 | EFLAGS_INTERRUPT_MASK; /* IOPL 3 */
|
||||
|
||||
/* Set MXCSR */
|
||||
Context->MxCsr = INITIAL_MXCSR;
|
||||
|
||||
if (ContextType == 1) /* For Threads */
|
||||
{
|
||||
Context->Rip = (ULONG_PTR)BaseThreadStartup;
|
||||
|
|
|
@ -56,7 +56,7 @@ KeContextToTrapFrame(IN PCONTEXT Context,
|
|||
}
|
||||
|
||||
/* Handle floating point registers */
|
||||
if ((ContextFlags & CONTEXT_FLOATING_POINT))
|
||||
if (ContextFlags & CONTEXT_FLOATING_POINT)
|
||||
{
|
||||
TrapFrame->MxCsr = Context->MxCsr;
|
||||
TrapFrame->Xmm0 = Context->Xmm0;
|
||||
|
@ -207,9 +207,9 @@ KeTrapFrameToContext(IN PKTRAP_FRAME TrapFrame,
|
|||
}
|
||||
|
||||
/* Handle floating point registers */
|
||||
if ((ContextFlags & CONTEXT_FLOATING_POINT) &&
|
||||
((TrapFrame->SegCs & MODE_MASK) != KernelMode))
|
||||
if (ContextFlags & CONTEXT_FLOATING_POINT)
|
||||
{
|
||||
Context->MxCsr = TrapFrame->MxCsr;
|
||||
Context->Xmm0 = TrapFrame->Xmm0;
|
||||
Context->Xmm1 = TrapFrame->Xmm1;
|
||||
Context->Xmm2 = TrapFrame->Xmm2;
|
||||
|
|
|
@ -375,7 +375,7 @@ KiRestoreProcessorControlState(PKPROCESSOR_STATE ProcessorState)
|
|||
// __ltr(&ProcessorState->SpecialRegisters.Tr);
|
||||
__lidt(&ProcessorState->SpecialRegisters.Idtr.Limit);
|
||||
|
||||
// __ldmxcsr(&ProcessorState->SpecialRegisters.MxCsr); // FIXME
|
||||
_mm_setcsr(ProcessorState->SpecialRegisters.MxCsr);
|
||||
// ProcessorState->SpecialRegisters.DebugControl
|
||||
// ProcessorState->SpecialRegisters.LastBranchToRip
|
||||
// ProcessorState->SpecialRegisters.LastBranchFromRip
|
||||
|
@ -417,7 +417,7 @@ KiSaveProcessorControlState(OUT PKPROCESSOR_STATE ProcessorState)
|
|||
__str(&ProcessorState->SpecialRegisters.Tr);
|
||||
__sidt(&ProcessorState->SpecialRegisters.Idtr.Limit);
|
||||
|
||||
// __stmxcsr(&ProcessorState->SpecialRegisters.MxCsr);
|
||||
ProcessorState->SpecialRegisters.MxCsr = _mm_getcsr();
|
||||
// ProcessorState->SpecialRegisters.DebugControl =
|
||||
// ProcessorState->SpecialRegisters.LastBranchToRip =
|
||||
// ProcessorState->SpecialRegisters.LastBranchFromRip =
|
||||
|
|
|
@ -152,6 +152,9 @@ KiInitializePcr(IN PKIPCR Pcr,
|
|||
Pcr->Prcb.ProcessorState.SpecialRegisters.KernelDr6 = 0;
|
||||
Pcr->Prcb.ProcessorState.SpecialRegisters.KernelDr7 = 0;
|
||||
|
||||
/* Initialize MXCSR (all exceptions masked) */
|
||||
Pcr->Prcb.MxCsr = INITIAL_MXCSR;
|
||||
|
||||
/* Set the Current Thread */
|
||||
Pcr->Prcb.CurrentThread = IdleThread;
|
||||
|
||||
|
@ -231,6 +234,9 @@ KiInitializeCpu(PKIPCR Pcr)
|
|||
Pat = (PAT_WB << 0) | (PAT_WC << 8) | (PAT_UCM << 16) | (PAT_UC << 24) |
|
||||
(PAT_WB << 32) | (PAT_WC << 40) | (PAT_UCM << 48) | (PAT_UC << 56);
|
||||
__writemsr(MSR_PAT, Pat);
|
||||
|
||||
/* Initialize MXCSR */
|
||||
_mm_setcsr(INITIAL_MXCSR);
|
||||
}
|
||||
|
||||
VOID
|
||||
|
|
|
@ -23,7 +23,7 @@ NTAPI
|
|||
RtlInitializeContext(
|
||||
_Reserved_ HANDLE ProcessHandle,
|
||||
_Out_ PCONTEXT ThreadContext,
|
||||
_In_ PVOID ThreadStartParam OPTIONAL,
|
||||
_In_opt_ PVOID ThreadStartParam,
|
||||
_In_ PTHREAD_START_ROUTINE ThreadStartAddress,
|
||||
_In_ PINITIAL_TEB StackBase)
|
||||
{
|
||||
|
@ -66,10 +66,13 @@ RtlInitializeContext(
|
|||
ThreadContext->SegSs = KGDT64_R3_DATA | RPL_MASK;
|
||||
}
|
||||
|
||||
ThreadContext->MxCsr = INITIAL_MXCSR;
|
||||
|
||||
/* Only the basic Context is initialized */
|
||||
ThreadContext->ContextFlags = CONTEXT_CONTROL |
|
||||
CONTEXT_INTEGER |
|
||||
CONTEXT_SEGMENTS;
|
||||
CONTEXT_SEGMENTS |
|
||||
CONTEXT_FLOATING_POINT;
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue