Re: hardware float stack corruption

From: Charles Melice <mail_at_forthcad.com>
Date: Fri, 21 Oct 2005 21:01:33 +0200

----- Original Message -----
From: "Robert Campbell" <robert.charles.campbell_at_mci.com>
To: <sftalk_at_forth.com>
Sent: Friday, October 21, 2005 3:14 PM
Subject: [sftalk] hardware float stack corruption

Using google for
    "INFO: How Windows handles floating-point calculations"

The text below explains well what occurs at the time of an IO event.
I think the error could occur (but rarely) even in mode
"software-stack".

see:KeSaveFloatingPointState
    KeRestoreFloatingPointState

Charles

[...]

Win32 applications
Each thread in a Win32 application has its own execution
state that includes the general-purpose registers and the
floating-point registers. Therefore, floating-point execution
and exception handling are controlled on a per-thread basis.
This permits individual threads in a process to adjust the
behavior of the floating-point processor to use specialized
rounding or precision control and exception handling.

[...]

Device drivers
Kernel-mode drivers for Windows 2000 and its successors can
use floating-point instructions when IRQL is less than or equal
to DISPATCH_LEVEL, but must explicitly preserve the processor's
floating-point state so that the caller's floating-point context
is not changed. Driver functions must call KeSaveFloatingPointState
before performing any floating-point operations, and must call
KeRestoreFloatingPointState before returning to the caller.
These functions are documented in the Windows 2000 Driver Development
Kit (DDK).

[...]

Windows NT 3.51 and Windows 4.0 kernel-mode drivers cannot use
floating-point instructions, because kernel-mode stack switches
do not preserve the floating-point registers.
If a kernel-mode driver does use any floating-point instruction,
this may cause either corruption of the user-mode application's
numeric state or a system failure (crash).

_______

----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe" to sftalk-request_at_forth.com
For list command help, send subject "help" to sftalk-request_at_forth.com
Message archives are located at http://www.forth.com/archive/sftalk
----------------------------------------------------------------------
This list is a forum for SwiftForth users. For product support and bug
reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Fri Oct 21 2005 - 12:02:32 PDT


Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!

This archive was generated 09-Feb-2012. Archive updated nightly.