Export (0) Print
Expand All
Expand Minimize

KeSaveFloatingPointState routine

The KeSaveFloatingPointState routine saves the nonvolatile floating-point context so the caller can carry out floating-point operations.

Syntax


NTSTATUS KeSaveFloatingPointState(
  _Out_  PKFLOATING_SAVE FloatSave
);

Parameters

FloatSave [out]

Pointer to a caller-allocated resident buffer, which must be at least sizeof(KFLOATING_SAVE).

Return value

KeSaveFloatingPointState returns STATUS_SUCCESS if it saved the current thread's floating-point context and set up a fresh floating-point context for the caller. Otherwise, it returns one of the following error status codes.

Return codeDescription
STATUS_ILLEGAL_FLOAT_CONTEXT

The system is configured to use floating-point emulation, rather than doing floating-point operations in the processors.

STATUS_INSUFFICIENT_RESOURCES

KeSaveFloatingPointState could not allocate sufficient memory to save the current thread's floating-point context.

 

Remarks

A successful call to KeSaveFloatingPointState allows the caller to carry out floating-point operations of its own, but such a caller must restore the previous nonvolatile floating-point context as soon as its floating-point operations are done. Any routine that calls KeSaveFloatingPointState must call KeRestoreFloatingPointState before that routine returns control.

If the call to KeSaveFloatingPointState is successful, the data at FloatSave is opaque to the caller. The caller should not release the memory that it allocated for this data until after the call to KeRestoreFloatingPointState.

In Windows Vista and earlier versions of Windows, a KeSaveFloatingPointState call and the corresponding KeRestoreFloatingPointState call must occur in a guarded region. That is, the KeEnterGuardedRegion routine must be called before KeSaveFloatingPointState is called, and the KeLeaveGuardedRegion routine must be called after KeRestoreFloatingPointState is called. No such requirement exists in Windows 7 and later versions of Windows.

For performance reasons, drivers should avoid doing any floating-point operations unless absolutely necessary. The overhead of saving and restoring the current thread's nonvolatile floating-point state degrades the performance of any driver that does floating-point operations.

Requirements

Version

Available starting with Windows 2000.

Header

Wdm.h (include Wdm.h, Ntddk.h, or Ntifs.h)

Library

Ntoskrnl.lib

IRQL

<= DISPATCH_LEVEL

DDI compliance rules

IrqlKeDispatchLte, HwStorPortProhibitedDDIs

See also

KeEnterGuardedRegion
KeGetCurrentThread
KeLeaveGuardedRegion
KeRestoreFloatingPointState
PsCreateSystemThread

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft