Answer the question
In order to leave comments, you need to log in
Double in kernel-mode (WinXp)?
There is a need to actively use real numbers in the driver.
Here msdn.microsoft.com/en-us/library/windows/hardware/... (v=vs.85).aspx write this way:
KFLOATING_SAVE saveData;
NTSTATUS status;
double floatValue;
status = KeSaveFloatingPointState(&saveData);
if (NT_SUCCESS(status)) {
floatValue = 1.0;
KeRestoreFloatingPointState(&saveData);
}
Answer the question
In order to leave comments, you need to log in
There is a misunderstanding :-), I'll try to clarify the situation
In general, each thread has its own "context" (stored in _KTHREAD::StateSaveArea), which includes, among other things, the state of the FPU (as well as MMX, SSE and others) registers. You can’t get away from this, and when the context is switched, all this state is saved and reloaded with new values.
But given that
1. All those vector extensions/floating points have quite a lot of fairly large registers
2. The vast majority of "kernel" code don't need them anyway
3. Switching from usermode to kernel and back should be as fast as possible
then it was decided that the nuclear workers would not peel off to roll the sun by hand. In other words, when switching to kernel mode and back, only general-purpose integer registers (well, flags, segment registers, etc.) are reloaded. In order not to spoil the calculation results of the user part of the thread, which had the imprudence to call (directly or indirectly) your code, you need to save it before modifying the FP context, and restore it before returning to the user mode. You can store the results anywhere (including in the device extension).
Due to the specifics of the topic, I would recommend contacting wasm.ru with such a question.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question