Hi all,

sys/i386/i386/swtch.s have a big FIX ME in resumectx()
and I have occationally got bitten by it; resulting in SIGFPE disasters.

After cursory looking around FPU context, I think it's the simplest way
to set CR0_TS on resumectx() and to let npxdna() DTRT lazilly.

Attached is the mods that I'm currently using without a problem at the moment.
It at least doesn't interact with normal resume operations badly.

Ah, of cource, we have a choice to throw i386 away and get on amd64,
but at least I won't because I'd miss VOCALOIDs running on wine/i386 :)

-- 
-|-__   YAMAMOTO, Taku
 | __ <     <t...@tackymt.homeip.net>

      - A chicken is an egg's way of producing more eggs. -
commit 99a24d7c19d624654afbd574e604d8a011ed28b3
Author: Taku YAMAMOTO <t...@tackymt.homeip.net>
Date:   Sun Jul 14 07:36:29 2013 +0900

    i386: defer FPU context resume from resumectx() to npxdna() by CR0_TS.

diff --git a/sys/i386/i386/swtch.s b/sys/i386/i386/swtch.s
index 80aa6c4..71efae1 100644
--- a/sys/i386/i386/swtch.s
+++ b/sys/i386/i386/swtch.s
@@ -36,6 +36,7 @@
 #include "opt_sched.h"
 
 #include <machine/asmacros.h>
+#include <machine/specialreg.h>
 
 #include "assym.s"
 
@@ -487,6 +488,10 @@ ENTRY(resumectx)
        movl    PCB_CR3(%ecx),%eax
        movl    %eax,%cr3
        movl    PCB_CR0(%ecx),%eax
+#ifdef DEV_NPX
+       /* Let npxdna() restore the FPU context lazily. */
+       orl     $CR0_TS,%eax
+#endif
        movl    %eax,%cr0
        jmp     1f
 1:
@@ -519,10 +524,6 @@ ENTRY(resumectx)
        movl    PCB_DR7(%ecx),%eax
        movl    %eax,%dr7
 
-#ifdef DEV_NPX
-       /* XXX FIX ME */
-#endif
-
        /* Restore other registers */
        movl    PCB_EDI(%ecx),%edi
        movl    PCB_ESI(%ecx),%esi
_______________________________________________
freebsd-acpi@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-acpi
To unsubscribe, send any mail to "freebsd-acpi-unsubscr...@freebsd.org"

Reply via email to