Re: Floating point in kernel mode, Win2003 64-bit
From: Sergey Plotnikov (svplotnik_at_yahoo.com)
Date: 04/22/04
- Next message: Alexander Grigoriev: "Re: Floating point in kernel mode, Win2003 64-bit"
- Previous message: newsgrouper_at_discussions.microsoft.com: "Re: AVStream : failed to connect two pins by GraphEdit manually"
- In reply to: nospam_at_cristalink.com: "Re: Floating point in kernel mode, Win2003 64-bit"
- Next in thread: Alexander Grigoriev: "Re: Floating point in kernel mode, Win2003 64-bit"
- Reply: Alexander Grigoriev: "Re: Floating point in kernel mode, Win2003 64-bit"
- Reply: Ray Trent: "Re: Floating point in kernel mode, Win2003 64-bit"
- Reply: nospam_at_cristalink.com: "Re: Floating point in kernel mode, Win2003 64-bit"
- Reply: nospam_at_cristalink.com: "Re: Floating point in kernel mode, Win2003 64-bit"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 22 Apr 2004 06:01:02 -0700
I certainly don't mix up .mfh and .dfh.
You approach is correct. More precisely it looks like:
StartDevice(){
PsCreateSystemThread(...,WorkingThread,...);
}
Save(){
PSR.dfh = 0;
save fh;
}
Restore(){
Restore fh;
PSR.dfh = 1;
}
InterruptHundler(){
RequestDpc();
}
DPC(){
KeSetEvent(event) ;
}
WorkingThread(){
for(;;){
KeWaitForSingleObject(event);
Save();
a_lot_of_integer_computation(); //it may take up to several milliseconds
float_computation(); //crush is always here
Restore();
}
}
As you can see my function is called only from my thread in system context, always on PASSIVE level. But still something changes .dfh. The probability of crash is about 1/1000.
Sergey
----- nospam@cristalink.com wrote: -----
You don't mistake .mfh for .dfh, do you? .mfh indicates fh was used, while
..dfh disables fh.
As far as I got it, you have some function in your driver that uses fh:
calc()
{
- You set PSR.dfh to 0 to enable fh
- You save the fh registers you are going to use
- Here you do some calculations.
setf.d f33=r26
Sometimes the above instruction crashes, and you see in the crash dump that
PSR.dfh is 1.
}
Is the above correct?
Is your function called in an arbitrary thread context, or from your own
system thread only?
"Sergey Plotnikov" <svplotnik@yahoo.com> wrote in message
news:36F667C9-B752-4548-B332-CE851114C925@microsoft.com...
> Blue screen happens always in the same place, because I've removed all
> access to rotated FP registers except one. On this access bsod happens.
>> Illegal instruction - code c000001d (!!! second chance !!!)
> e0000165`db2c0a04 (p9) setf.d f33=r26
>> If I clear PSR.mfh before this, code will work fine.
>> Stack is usual, there are only my functions in it.
>> Sergey
>> ----- nospam@cristalink.com wrote: -----
>> Where exactly does the blue screen happen, in the same or random
> places?
> What's the exception code? What's the call stack look like?
>>>
- Next message: Alexander Grigoriev: "Re: Floating point in kernel mode, Win2003 64-bit"
- Previous message: newsgrouper_at_discussions.microsoft.com: "Re: AVStream : failed to connect two pins by GraphEdit manually"
- In reply to: nospam_at_cristalink.com: "Re: Floating point in kernel mode, Win2003 64-bit"
- Next in thread: Alexander Grigoriev: "Re: Floating point in kernel mode, Win2003 64-bit"
- Reply: Alexander Grigoriev: "Re: Floating point in kernel mode, Win2003 64-bit"
- Reply: Ray Trent: "Re: Floating point in kernel mode, Win2003 64-bit"
- Reply: nospam_at_cristalink.com: "Re: Floating point in kernel mode, Win2003 64-bit"
- Reply: nospam_at_cristalink.com: "Re: Floating point in kernel mode, Win2003 64-bit"
- Messages sorted by: [ date ] [ thread ]