- floating point?
- Posted by usfinecats on August 25th, 2005
I need to do 2 floating point calculations in my driver, what library do I
link with
to resolve ftlused and ftol2 ?
--
Gak -
Finecats
- Posted by Don Burn on August 25th, 2005
First if at all possible don't do this. If you must then look at "Using
Floating Point or MMX in a WDM Driver" in the current DDK. Finally, how are
you building things, since these unresolves should not occur.
--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply
"usfinecats" <usfinecats@nospam.nospam> wrote in message
news:1E66DE9F-771C-4B7C-9910-E690230FCF29@microsoft.com...
- Posted by Caz Yokoyama[MSFT] on August 26th, 2005
Because kernel does not save FP registers on thread switching, you have to
use KeSave/RestoreFloatingPointStatus when you use FP calculation.
Saving and restoring of 8 byte x (8 FP registerss + 8 MMX registers) are
too expensive on each thread switching .
If I want to use FP calculation, I first think how much of precision I
need. Most of the time, the precision stays in 3-4 significant figures in
10e8 range. If your calculation stays in that range, you may be possible to
use 32 bit integer calculation with pseudo decimal point.
- Posted by Baker on August 30th, 2005
Hi,
You can try to use two API keSaveFloatingPointState and
KeRestoreFloatingPointSatae to save and restore the state of the the math
coprocessor for the current CPU. The APIs msut be paired.
For example:
KFLOATING_SAVE pfbuffer;
KeSaveFloatingPointState(&pfbuffer);
<anything you want with floating-point calculations...>
KeRestoreFloatingPointState(&pfbuffer);
Because saving and restoring state information will result in heavy
overloading, you avoid use FP in kernel-mode as possible as you can.
Best Regards,
Baker Chang
"usfinecats" wrote:
- Posted by usfinecats on August 30th, 2005
Ended up with a fixed point solution to this. I only need a few sig. digits
and was able to scale things up to get them, The recipricol was a bit
tricky, but that too was solved. Thanks all
--
Gak -
Finecats
"Baker" wrote: