Naive implementation of Ke(Save/Restore)FloatingPointState

svn path=/trunk/; revision=6024
This commit is contained in:
Gé van Geldorp 2003-09-09 14:50:19 +00:00
parent f7cd42043b
commit 216280ce74
3 changed files with 40 additions and 7 deletions

View file

@ -1,4 +1,5 @@
/*
/* $Id: fpu.c,v 1.9 2003/09/09 14:50:19 gvg Exp $
*
* ReactOS kernel
* Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team
*
@ -72,3 +73,35 @@ KiCheckFPU(VOID)
__asm__(".byte 0xDB, 0xE4\n\t");
HardwareMathSupport = 1;
}
/* This is a rather naive implementation of Ke(Save/Restore)FloatingPointState
which will not work for WDM drivers. Please feel free to improve */
#define FPU_STATE_SIZE 108
NTSTATUS STDCALL
KeSaveFloatingPointState(OUT PKFLOATING_SAVE Save)
{
VOID **FpState = (VOID **) Save;
*FpState = ExAllocatePool(PagedPool, FPU_STATE_SIZE);
if (NULL == *FpState)
{
return STATUS_INSUFFICIENT_RESOURCES;
}
__asm__("fsave %0\n\t" : /* no output */ : "m" (*FpState));
return STATUS_SUCCESS;
}
NTSTATUS STDCALL
KeRestoreFloatingPointState(IN PKFLOATING_SAVE Save)
{
VOID **FpState = (VOID **) Save;
__asm__("frstor %0\n\t" : /* no output */ : "m" (*FpState));
ExFreePool(*FpState);
return STATUS_SUCCESS;
}

View file

@ -1,4 +1,4 @@
; $Id: ntoskrnl.def,v 1.163 2003/08/27 21:28:08 dwelch Exp $
; $Id: ntoskrnl.def,v 1.164 2003/09/09 14:50:19 gvg Exp $
;
; reactos/ntoskrnl/ntoskrnl.def
;
@ -444,9 +444,9 @@ KeRemoveEntryDeviceQueue@8
KeRemoveQueue@12
KeRemoveQueueDpc@4
KeResetEvent@4
;KeRestoreFloatingPointState
KeRestoreFloatingPointState@4
KeRundownQueue@4
;KeSaveFloatingPointState
KeSaveFloatingPointState@4
KeServiceDescriptorTable DATA
KeSetAffinityThread@8
KeSetBasePriorityThread@8

View file

@ -1,4 +1,4 @@
; $Id: ntoskrnl.edf,v 1.151 2003/08/27 21:28:08 dwelch Exp $
; $Id: ntoskrnl.edf,v 1.152 2003/09/09 14:50:19 gvg Exp $
;
; reactos/ntoskrnl/ntoskrnl.def
;
@ -443,9 +443,9 @@ KeRemoveEntryDeviceQueue=KeRemoveEntryDeviceQueue@8
KeRemoveQueue=KeRemoveQueue@12
KeRemoveQueueDpc=KeRemoveQueueDpc@4
KeResetEvent=KeResetEvent@4
;KeRestoreFloatingPointState
KeRestoreFloatingPointState=KeRestoreFloatingPointState@4
KeRundownQueue=KeRundownQueue@4
;KeSaveFloatingPointState
KeSaveFloatingPointState=KeSaveFloatingPointState@4
KeServiceDescriptorTable DATA
KeSetAffinityThread@8
KeSetBasePriorityThread=KeSetBasePriorityThread@8