Module Name:    src
Committed By:   matt
Date:           Mon May 19 07:09:10 UTC 2014

Modified Files:
        src/sys/arch/alpha/alpha: fp_complete.c

Log Message:
Update PCU_REENABLE for MP.  For UP, add a KASSERT to make sure it's never
present.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/alpha/alpha/fp_complete.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/alpha/alpha/fp_complete.c
diff -u src/sys/arch/alpha/alpha/fp_complete.c:1.20 src/sys/arch/alpha/alpha/fp_complete.c:1.21
--- src/sys/arch/alpha/alpha/fp_complete.c:1.20	Mon May 19 06:55:54 2014
+++ src/sys/arch/alpha/alpha/fp_complete.c	Mon May 19 07:09:10 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: fp_complete.c,v 1.20 2014/05/19 06:55:54 matt Exp $ */
+/* $NetBSD: fp_complete.c,v 1.21 2014/05/19 07:09:10 matt Exp $ */
 
 /*-
  * Copyright (c) 2001 Ross Harvey
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: fp_complete.c,v 1.20 2014/05/19 06:55:54 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fp_complete.c,v 1.21 2014/05/19 07:09:10 matt Exp $");
 
 #include "opt_compat_osf1.h"
 
@@ -731,10 +731,20 @@ fpu_state_load(struct lwp *l, u_int flag
 	struct pcb * const pcb = lwp_getpcb(l);
 	KASSERT(l == curlwp);
 
+#ifdef MULTIPROCESSOR
+	/*
+	 * If the LWP got switched to another CPU, pcu_switchpoint would have
+	 * called state_release to clear MDLWP_FPACTIVE.  Now that we are back
+	 * on the CPU that has our FP context, set MDLWP_FPACTIVE again.
+	 */
 	if (flags & PCU_REENABLE) {
-		KASSERT(l->l_md.md_flags & MDLWP_FPACTIVE);
+		KASSERT(flags & PCU_VALID);
+		l->l_md.md_flags |= MDLWP_FPACTIVE;
 		return;
 	}
+#else
+	KASSERT((flags & PCU_REENABLE) == 0);
+#endif
 
 	/*
 	 * Instrument FP usage -- if a process had not previously

Reply via email to