does vsnprintf take float data type ?

vsnprintf converts arg_list into a buffer,
if i have “%f”, “%e” as the format, will it work ?

I don’t know; as floating point operations are not exactly the kernel’s
bread and butter, hard to say, but if you are doing any actual floating
point operations (I don’t know, but I can’t imagine that vcnprintf would
qualify), be sure to read the two links below, for there are restrictions on
what you can and cannot do, especially on 32-bit platforms.

http://msdn.microsoft.com/en-us/library/ff565388(v=vs.85).aspx (Using
Floating Point or MMX in a WDM Driver)

http://msdn.microsoft.com/en-us/library/ff545910(v=vs.85).aspx (Floating
Point Support for 64-bit Drivers)

Good luck,

mm

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@hotmail.com
Sent: Sunday, January 30, 2011 11:34 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] does vsnprintf take float data type ?

vsnprintf converts arg_list into a buffer,
if i have “%f”, “%e” as the format, will it work ?


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

I don’t think you can actually use floats in kernel, but you can make it work in a simple way by putting numbers into another scale.

For example, if you need to store result of devision of 5 / 2 you can multiply 5 to 10, and store resulted 25 in int,

i.e.,

50 / 2 = 25

Of course you have to keep in mind that 25 is actually tenths of 2.5 when doing your further calculations.

You can use floating point math in the kernel, with some caveats.

See the wdk docs that I posted previously.

mm

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@shcherbyna.com
Sent: Tuesday, February 01, 2011 8:51 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] does vsnprintf take float data type ?

I don’t think you can actually use floats in kernel, but you can make it
work in a simple way by putting numbers into another scale.

For example, if you need to store result of devision of 5 / 2 you can
multiply 5 to 10, and store resulted 25 in int,

i.e.,

50 / 2 = 25

Of course you have to keep in mind that 25 is actually tenths of 2.5 when
doing your further calculations.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

xxxxx@shcherbyna.com wrote:

I don’t think you can actually use floats in kernel,…

Of course you can. You simply have to surround your uses of floating
point with KeSaveFloatingPointState and KeRestoreFloatingPointState.
That doesn’t mean, however, that printf in the kernel can handle
floats. I don’t know that.

…but you can make it work in a simple way by putting numbers into another scale.

However, this is often a very good strategy.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

You don’t need to use those on x64.

Mm
On Feb 1, 2011 1:45 PM, “Tim Roberts” wrote:
> xxxxx@shcherbyna.com wrote:
>> I don’t think you can actually use floats in kernel,…
>
> Of course you can. You simply have to surround your uses of floating
> point with KeSaveFloatingPointState and KeRestoreFloatingPointState.
> That doesn’t mean, however, that printf in the kernel can handle
> floats. I don’t know that.
>
>> …but you can make it work in a simple way by putting numbers into
another scale.
>
> However, this is often a very good strategy.
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

KeSaveFloatingPointState() and KeRestoreFloatingPointState(), that is.

The x64 kernel doesn’t use the ‘legacy’ - i. e. FPU/MMX - stack at all.

mm