Kernel to user communication

Hi everyone,

First, I am quite new to windows driver dev, don’t be too harsh :smile:
At some point, the driver I am trying to build needs to process some data with floating point operations, and talking to a server with http requests.
So what I would need is a way to send the data the driver extracted to a user app which would perform the various operations, networking etc. and send it back to the driver. During the processing, the driver would need to wait as it is a KMDF filter driver that modifies read/write data in wdfrequests.

Is this even possible ?

And if it is, IOCTL with inverted calls a good way to go ? Or would I need to use some shared memory ? Or maybe using another method I didnt read about ?

Thanks in advance for your advices,
Axel.

Kernel mode can do floating point quite nicely, and there exist kernel level Winsock functions … google “Winsock Kernel”, there are some GitHub libraries and projects that user Kernel Winsock as well, TCP as well as UDP supported in KMDF as well as UMDF v2 flavors …

Kernel mode can do floating point quite nicely

Hmmmmm… Really? Let’s be sure we’re super clear here: Unless something has changed since the AMD64 was introduced, ordinary FPP instructions are not supported on X64 in kernel mode. You need to use SSEx instructions instead.

You can find a (15 year old) thread on this here.

Peter

1 Like

I read about floating point operations being either unsupported or complicated/not efficient.
At first I began to manually implement floating point numbers/operations but I thought it would be a bit over kill if there was a simplier way to give that work to a user mode app. Hence my question above

You can find a (15 year old) thread on this here.

OMG…

I guess it makes sense for you to lock it right on the spot before someone decides “to bring it back from the dead” and replies to some of the posts on it

Anton Bassov

@“Peter_Viscarola_(OSR)” said:

Kernel mode can do floating point quite nicely

Hmmmmm… Really? Let’s be sure we’re super clear here: Unless something has changed since the AMD64 was introduced, ordinary FPP instructions are not supported on X64 in kernel mode. You need to use SSEx instructions instead.

You can find a (15 year old) thread on this here.

Peter

Yep, we need to be super clear here, and I wasn’t to the OP … as you’ve rightly pointed out, there are differences in floating point between the X86 processor and the AMD that require someone to jump through hoops (and the thread link is good to show that) … my point had been that rather than write a service which is catching data from and returning data to a driver with all of the associated headaches that it entails to do that it would be easier just to “do the work” for kernel floating point to work; once that had been done then kernel mode can be done quite nicely.

I oversimplified, like saying “cars can travel through the air quite nicely” without mentioning over a century of aviation technology to make that statement correct …

Well…. I looked into this a bit further, and yes… times have changed in 15+ years. I learned this:

The 64-bit compiler does not use the MMX/x87 registers for floating point operations. Instead, it uses the SSE registers. x64 kernel mode code is not allowed to access the MMX/x87 registers. The compiler also takes care of properly saving and restoring the SSE state, therefore, calls to KeSaveExtendedProcessorState and KeRestoreExtendedProcessorState are unnecessary and floating point operations can be used in ISRs. Use of other extended processor features such as AVX, requires saving and restoring extended state.

From here.

So…. not NEARLY as difficult as I thought… the last time I thought about this was when I wrote that thread that I linked… and at that time you had to hand-code the SSE intrinsics. This is, obviously, no longer required.

Progress!

Thank you, Mr @craig_howard for encouraging me to investigate further.

Enter

Thank you all for your answers, very interesting to follow this discution.
I will go for manual floating point implementation then (I want it to work on both x86 and x64).