]> xenbits.xensource.com Git - people/julieng/freebsd.git/commitdiff
MFamd64: Explicitly initialize the mxcsr during npxinit().
authorjhb <jhb@FreeBSD.org>
Sun, 2 Nov 2014 21:34:24 +0000 (21:34 +0000)
committerjhb <jhb@FreeBSD.org>
Sun, 2 Nov 2014 21:34:24 +0000 (21:34 +0000)
sys/i386/isa/npx.c

index dd8403a5175a14fc8256f3baafbd0f655730c76f..dbbfba2195ed92e5cf7224598249136672279909 100644 (file)
@@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/syslog.h>
 #endif
 #include <sys/signalvar.h>
+#include <vm/uma.h>
 
 #include <machine/asmacros.h>
 #include <machine/cputypes.h>
@@ -99,6 +100,7 @@ __FBSDID("$FreeBSD$");
 #ifdef CPU_ENABLE_SSE
 #define        fxrstor(addr)           __asm __volatile("fxrstor %0" : : "m" (*(addr)))
 #define        fxsave(addr)            __asm __volatile("fxsave %0" : "=m" (*(addr)))
+#define        ldmxcsr(csr)            __asm __volatile("ldmxcsr %0" : : "m" (csr))
 #define        stmxcsr(addr)           __asm __volatile("stmxcsr %0" : : "m" (*(addr)))
 #endif
 #else  /* !(__GNUCLIKE_ASM && !lint) */
@@ -114,6 +116,7 @@ void        frstor(caddr_t addr);
 #ifdef CPU_ENABLE_SSE
 void   fxsave(caddr_t addr);
 void   fxrstor(caddr_t addr);
+void   ldmxcsr(u_int csr);
 void   stmxcsr(u_int *csr);
 #endif
 
@@ -364,6 +367,12 @@ npxinit(void)
 #endif
        control = __INITIAL_NPXCW__;
        fldcw(control);
+#ifdef CPU_ENABLE_SSE
+       if (cpu_fxsr) {
+               mxcsr = __INITIAL_MXCSR__;
+               ldmxcsr(mxcsr);
+       }
+#endif
        start_emulating();
        intr_restore(saveintr);
 }