mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 11:12:58 +00:00
Change indentation - make it a bit more readable and same style everywhere.
KiCheckFPU: Change calculation of DummyArea/FxSaveArea (avoid conditional) KeSaveFloatingPointState: Allocate NonPagedPool for the saved state because function can be called only at IRQL >= DISPATCH svn path=/trunk/; revision=18286
This commit is contained in:
parent
7d6d579a40
commit
2446ae0fd7
1 changed files with 286 additions and 299 deletions
|
@ -80,13 +80,9 @@ KiTagWordFxsaveToFnsave(PFXSAVE_FORMAT FxSave)
|
||||||
case 0x0000:
|
case 0x0000:
|
||||||
if (FpReg->Significand[0] == 0 && FpReg->Significand[1] == 0 &&
|
if (FpReg->Significand[0] == 0 && FpReg->Significand[1] == 0 &&
|
||||||
FpReg->Significand[2] == 0 && FpReg->Significand[3] == 0)
|
FpReg->Significand[2] == 0 && FpReg->Significand[3] == 0)
|
||||||
{
|
|
||||||
Tag = 1; /* Zero */
|
Tag = 1; /* Zero */
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
Tag = 2; /* Special */
|
Tag = 2; /* Special */
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x7fff:
|
case 0x7fff:
|
||||||
|
@ -95,13 +91,9 @@ KiTagWordFxsaveToFnsave(PFXSAVE_FORMAT FxSave)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (FpReg->Significand[3] & 0x00008000)
|
if (FpReg->Significand[3] & 0x00008000)
|
||||||
{
|
|
||||||
Tag = 0; /* Valid */
|
Tag = 0; /* Valid */
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
Tag = 2; /* Special */
|
Tag = 2; /* Special */
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,8 +126,8 @@ KiFnsaveToFxsaveFormat(PFXSAVE_FORMAT FxSave, CONST PFNSAVE_FORMAT FnSave)
|
||||||
FxSave->MXCsr = 0;
|
FxSave->MXCsr = 0;
|
||||||
FxSave->MXCsrMask = MxcsrFeatureMask;
|
FxSave->MXCsrMask = MxcsrFeatureMask;
|
||||||
memset(FxSave->Reserved3, 0, sizeof(FxSave->Reserved3) +
|
memset(FxSave->Reserved3, 0, sizeof(FxSave->Reserved3) +
|
||||||
sizeof(FxSave->Reserved4)); /* XXX - doesnt zero Align16Byte because
|
sizeof(FxSave->Reserved4)); /* Don't zero Align16Byte because Context->ExtendedRegisters
|
||||||
Context->ExtendedRegisters is only 512 bytes, not 520 */
|
is only 512 bytes, not 520 */
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
memcpy(FxSave->RegisterArea + (i * 16), FnSave->RegisterArea + (i * 10), 10);
|
memcpy(FxSave->RegisterArea + (i * 16), FnSave->RegisterArea + (i * 10), 10);
|
||||||
|
@ -284,11 +276,7 @@ KiCheckFPU(VOID)
|
||||||
FxsrSupport = 1;
|
FxsrSupport = 1;
|
||||||
|
|
||||||
/* we need a 16 byte aligned FX_SAVE_AREA */
|
/* we need a 16 byte aligned FX_SAVE_AREA */
|
||||||
FxSaveArea = (PFX_SAVE_AREA)DummyArea;
|
FxSaveArea = (PFX_SAVE_AREA)(((ULONG_PTR)DummyArea + 0xf) & (~0x0f));
|
||||||
if ((ULONG_PTR)FxSaveArea & 0x0f)
|
|
||||||
{
|
|
||||||
FxSaveArea = (PFX_SAVE_AREA)(((ULONG_PTR)FxSaveArea + 0x10) & (~0x0f));
|
|
||||||
}
|
|
||||||
|
|
||||||
Ke386SetCr4(Ke386GetCr4() | X86_CR4_OSFXSR);
|
Ke386SetCr4(Ke386GetCr4() | X86_CR4_OSFXSR);
|
||||||
memset(&FxSaveArea->U.FxArea, 0, sizeof(FxSaveArea->U.FxArea));
|
memset(&FxSaveArea->U.FxArea, 0, sizeof(FxSaveArea->U.FxArea));
|
||||||
|
@ -322,7 +310,7 @@ KeSaveFloatingPointState(OUT PKFLOATING_SAVE Save)
|
||||||
{
|
{
|
||||||
char *FpState;
|
char *FpState;
|
||||||
|
|
||||||
ASSERT_IRQL(DISPATCH_LEVEL); /* FIXME: is this removed for non-debug builds? I hope not! */
|
ASSERT_IRQL(DISPATCH_LEVEL);
|
||||||
|
|
||||||
/* check if we are doing software emulation */
|
/* check if we are doing software emulation */
|
||||||
if (!HardwareMathSupport)
|
if (!HardwareMathSupport)
|
||||||
|
@ -330,7 +318,7 @@ KeSaveFloatingPointState(OUT PKFLOATING_SAVE Save)
|
||||||
return STATUS_ILLEGAL_FLOAT_CONTEXT;
|
return STATUS_ILLEGAL_FLOAT_CONTEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
FpState = ExAllocatePool(PagedPool, FPU_STATE_SIZE);
|
FpState = ExAllocatePool(NonPagedPool, FPU_STATE_SIZE);
|
||||||
if (NULL == FpState)
|
if (NULL == FpState)
|
||||||
{
|
{
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
@ -577,4 +565,3 @@ KiHandleFpuFault(PKTRAP_FRAME Tf, ULONG ExceptionNr)
|
||||||
|
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue