Re: Floating point in kernel mode, Win2003 64-bit

From: Alexander Grigoriev (alegr_at_earthlink.net)
Date: 04/22/04


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?
> >>>



Relevant Pages

  • Re: Floating point in kernel mode, Win2003 64-bit
    ... > Restore fh; ... > ..dfh disables fh. ... > Sometimes the above instruction crashes, and you see in the crash dump ... On this access bsod ...
    (microsoft.public.development.device.drivers)
  • RE: Disaster Recovoery of windows 2003 Server DC ??
    ... Only one DC crash in branch site, how to do the disaster recovery? ... You restore the crashed servers by ... replacing any faulty hardware, reinstalling Windows with the same name, ...
    (microsoft.public.windows.server.active_directory)
  • Re: disk backup. Efficiency?
    ... The only way to know if your current system to restore ... a crash you may be unfortunate to discover that ... Although I have provided some guidance with backups I have ... hard disk crash with no working Windows system using the Acronis ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: Automated System Restore without floppy.
    ... I am interested in using the Automated System Restore in Windows XP, ... Now in Windows XP it is possible to alter the drive letter for a drive. ... recovering from the previous crash. ...
    (microsoft.public.windowsxp.general)
  • Re: Automated System Restore without floppy.
    ... I am interested in using the Automated System Restore in Windows XP, ... Now in Windows XP it is possible to alter the drive letter for a drive. ... recovering from the previous crash. ...
    (microsoft.public.windowsxp.general)

Loading