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:
Gregor Anich 2005-10-05 23:30:39 +00:00
parent 7d6d579a40
commit 2446ae0fd7

View file

@ -80,13 +80,9 @@ KiTagWordFxsaveToFnsave(PFXSAVE_FORMAT FxSave)
case 0x0000:
if (FpReg->Significand[0] == 0 && FpReg->Significand[1] == 0 &&
FpReg->Significand[2] == 0 && FpReg->Significand[3] == 0)
{
Tag = 1; /* Zero */
}
else
{
Tag = 2; /* Special */
}
break;
case 0x7fff:
@ -95,13 +91,9 @@ KiTagWordFxsaveToFnsave(PFXSAVE_FORMAT FxSave)
default:
if (FpReg->Significand[3] & 0x00008000)
{
Tag = 0; /* Valid */
}
else
{
Tag = 2; /* Special */
}
break;
}
}
@ -134,8 +126,8 @@ KiFnsaveToFxsaveFormat(PFXSAVE_FORMAT FxSave, CONST PFNSAVE_FORMAT FnSave)
FxSave->MXCsr = 0;
FxSave->MXCsrMask = MxcsrFeatureMask;
memset(FxSave->Reserved3, 0, sizeof(FxSave->Reserved3) +
sizeof(FxSave->Reserved4)); /* XXX - doesnt zero Align16Byte because
Context->ExtendedRegisters is only 512 bytes, not 520 */
sizeof(FxSave->Reserved4)); /* Don't zero Align16Byte because Context->ExtendedRegisters
is only 512 bytes, not 520 */
for (i = 0; i < 8; i++)
{
memcpy(FxSave->RegisterArea + (i * 16), FnSave->RegisterArea + (i * 10), 10);
@ -284,11 +276,7 @@ KiCheckFPU(VOID)
FxsrSupport = 1;
/* we need a 16 byte aligned FX_SAVE_AREA */
FxSaveArea = (PFX_SAVE_AREA)DummyArea;
if ((ULONG_PTR)FxSaveArea & 0x0f)
{
FxSaveArea = (PFX_SAVE_AREA)(((ULONG_PTR)FxSaveArea + 0x10) & (~0x0f));
}
FxSaveArea = (PFX_SAVE_AREA)(((ULONG_PTR)DummyArea + 0xf) & (~0x0f));
Ke386SetCr4(Ke386GetCr4() | X86_CR4_OSFXSR);
memset(&FxSaveArea->U.FxArea, 0, sizeof(FxSaveArea->U.FxArea));
@ -322,7 +310,7 @@ KeSaveFloatingPointState(OUT PKFLOATING_SAVE Save)
{
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 */
if (!HardwareMathSupport)
@ -330,7 +318,7 @@ KeSaveFloatingPointState(OUT PKFLOATING_SAVE Save)
return STATUS_ILLEGAL_FLOAT_CONTEXT;
}
FpState = ExAllocatePool(PagedPool, FPU_STATE_SIZE);
FpState = ExAllocatePool(NonPagedPool, FPU_STATE_SIZE);
if (NULL == FpState)
{
return STATUS_INSUFFICIENT_RESOURCES;
@ -577,4 +565,3 @@ KiHandleFpuFault(PKTRAP_FRAME Tf, ULONG ExceptionNr)
return STATUS_UNSUCCESSFUL;
}