Module Name:    src
Committed By:   maxv
Date:           Fri Feb  9 08:58:01 UTC 2018

Modified Files:
        src/sys/arch/x86/x86: fpu.c

Log Message:
Force a reload of CW in fpu_set_default_cw(). This function is used only
in COMPAT_FREEBSD, it really needs to die.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/x86/x86/fpu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/x86/fpu.c
diff -u src/sys/arch/x86/x86/fpu.c:1.27 src/sys/arch/x86/x86/fpu.c:1.28
--- src/sys/arch/x86/x86/fpu.c:1.27	Sat Nov 11 11:00:46 2017
+++ src/sys/arch/x86/x86/fpu.c	Fri Feb  9 08:58:01 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.c,v 1.27 2017/11/11 11:00:46 maxv Exp $	*/
+/*	$NetBSD: fpu.c,v 1.28 2018/02/09 08:58:01 maxv Exp $	*/
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.  All
@@ -96,7 +96,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.27 2017/11/11 11:00:46 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.28 2018/02/09 08:58:01 maxv Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -534,10 +534,19 @@ fpu_set_default_cw(struct lwp *l, unsign
 	union savefpu *fpu_save = process_fpframe(l);
 	struct pcb *pcb = lwp_getpcb(l);
 
-	if (i386_use_fxsave)
+	if (i386_use_fxsave) {
 		fpu_save->sv_xmm.fx_cw = x87_cw;
-	else
+
+		/* Force a reload of CW */
+		if ((x87_cw != __INITIAL_NPXCW__) &&
+		    (x86_fpu_save == FPU_SAVE_XSAVE ||
+		    x86_fpu_save == FPU_SAVE_XSAVEOPT)) {
+			fpu_save->sv_xsave_hdr.xsh_xstate_bv |=
+			    XCR0_X87;
+		}
+	} else {
 		fpu_save->sv_87.s87_cw = x87_cw;
+	}
 	pcb->pcb_fpu_dflt_cw = x87_cw;
 }
 

Reply via email to