Module Name:    src
Committed By:   bouyer
Date:           Wed Feb 22 18:35:26 UTC 2012

Modified Files:
        src/sys/arch/i386/i386: machdep.c

Log Message:
i386_switch_context(): mimic code in cpu_switchto() and compare pcb->pcb_fpcpu
against ci to decide if we need to turn off FPU. Fix FPU corruption, e.g.
paranoia occasionally reporting flaws on Xen/MP systems.

XXX is ci_fpused still needed at all ?


To generate a diff of this commit:
cvs rdiff -u -r1.718 -r1.719 src/sys/arch/i386/i386/machdep.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/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.718 src/sys/arch/i386/i386/machdep.c:1.719
--- src/sys/arch/i386/i386/machdep.c:1.718	Sun Feb 19 21:06:08 2012
+++ src/sys/arch/i386/i386/machdep.c	Wed Feb 22 18:35:26 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.718 2012/02/19 21:06:08 rmind Exp $	*/
+/*	$NetBSD: machdep.c,v 1.719 2012/02/22 18:35:26 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.718 2012/02/19 21:06:08 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.719 2012/02/22 18:35:26 bouyer Exp $");
 
 #include "opt_beep.h"
 #include "opt_compat_ibcs2.h"
@@ -542,9 +542,8 @@ i386_switch_context(lwp_t *l)
 
 	pcb = lwp_getpcb(l);
 	ci = curcpu();
-	if (ci->ci_fpused) {
+	if (pcb->pcb_fpcpu != ci) {
 		HYPERVISOR_fpu_taskswitch(1);
-		ci->ci_fpused = 0;
 	}
 
 	HYPERVISOR_stack_switch(GSEL(GDATA_SEL, SEL_KPL), pcb->pcb_esp0);

Reply via email to