Re: Floating point in kernel mode, Win2003 64-bit
From: Alexander Grigoriev (alegr_at_earthlink.net)
Date: 04/22/04
- Next message: Doug Phelps: "How to read current kernel image from driver?"
- Previous message: Sergey Plotnikov: "Re: Floating point in kernel mode, Win2003 64-bit"
- In reply to: Sergey Plotnikov: "Re: Floating point in kernel mode, Win2003 64-bit"
- Next in thread: Ray Trent: "Re: Floating point in kernel mode, Win2003 64-bit"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 22 Apr 2004 07:26:30 -0700
I don't think you need to save/restore FP state while on PASSIVE_LEVEL. I'm
afraid it may screw up FP save, too!
"Sergey Plotnikov" <svplotnik@yahoo.com> wrote in message
news:EA6AC636-27EC-485D-875C-AC1A659CC0C3@microsoft.com...
> 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: Doug Phelps: "How to read current kernel image from driver?"
- Previous message: Sergey Plotnikov: "Re: Floating point in kernel mode, Win2003 64-bit"
- In reply to: Sergey Plotnikov: "Re: Floating point in kernel mode, Win2003 64-bit"
- Next in thread: Ray Trent: "Re: Floating point in kernel mode, Win2003 64-bit"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|