Module Name:    src
Committed By:   martin
Date:           Wed May 18 08:44:42 UTC 2016

Modified Files:
        src/sys/arch/powerpc/include [netbsd-6]: psl.h userret.h
        src/sys/arch/powerpc/oea [netbsd-6]: oea_machdep.c

Log Message:
Pull up following revision(s) (requested by matt in ticket #1310):
        sys/arch/powerpc/include/userret.h: revision 1.29-1.30
        sys/arch/powerpc/include/psl.h: revision 1.20
        sys/arch/powerpc/oea/oea_machdep.c: revision 1.72
(via patch)

Add a check to make sure that if PSL_FP is set, we own the FPU.
Don't clear PSL_FP/PSL_VEC
Remove PSL_SPV from BOOKE PSL_USERMOD
Don't preserve PSL_FP/PSL_VEC in cpu_setmcontext.


To generate a diff of this commit:
cvs rdiff -u -r1.18.8.3 -r1.18.8.4 src/sys/arch/powerpc/include/psl.h
cvs rdiff -u -r1.22.8.4 -r1.22.8.5 src/sys/arch/powerpc/include/userret.h
cvs rdiff -u -r1.63.2.3 -r1.63.2.4 src/sys/arch/powerpc/oea/oea_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/powerpc/include/psl.h
diff -u src/sys/arch/powerpc/include/psl.h:1.18.8.3 src/sys/arch/powerpc/include/psl.h:1.18.8.4
--- src/sys/arch/powerpc/include/psl.h:1.18.8.3	Thu Nov 19 08:50:05 2015
+++ src/sys/arch/powerpc/include/psl.h	Wed May 18 08:44:41 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: psl.h,v 1.18.8.3 2015/11/19 08:50:05 bouyer Exp $	*/
+/*	$NetBSD: psl.h,v 1.18.8.4 2016/05/18 08:44:41 martin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -111,7 +111,7 @@ extern register_t cpu_psluserset, cpu_ps
 #elif defined(PPC_BOOKE)
 #define	PSL_USERSET		(PSL_EE | PSL_PR | PSL_IS | PSL_DS | PSL_ME | PSL_CE | PSL_DE)
 #define	PSL_USERMASK		(PSL_SPV | PSL_CE | 0xFFFF)
-#define	PSL_USERMOD		(PSL_SPV)
+#define	PSL_USERMOD		(0)
 #else /* PPC_IBM4XX */
 #ifdef PPC_IBM403
 #define	PSL_USERSET		(PSL_EE | PSL_PR | PSL_IR | PSL_DR | PSL_ME)

Index: src/sys/arch/powerpc/include/userret.h
diff -u src/sys/arch/powerpc/include/userret.h:1.22.8.4 src/sys/arch/powerpc/include/userret.h:1.22.8.5
--- src/sys/arch/powerpc/include/userret.h:1.22.8.4	Thu Nov 19 08:50:05 2015
+++ src/sys/arch/powerpc/include/userret.h	Wed May 18 08:44:41 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: userret.h,v 1.22.8.4 2015/11/19 08:50:05 bouyer Exp $	*/
+/*	$NetBSD: userret.h,v 1.22.8.5 2016/05/18 08:44:41 martin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -58,7 +58,13 @@ userret(struct lwp *l, struct trapframe 
 	/* Invoke MI userret code */
 	mi_userret(l);
 
-	tf->tf_srr1 &= PSL_USERSRR1;	/* clear SRR1 status bits */
+	KASSERTMSG((tf->tf_srr1 & PSL_FP) == 0
+	    || l->l_cpu->ci_data.cpu_pcu_curlwp[PCU_FPU] == l,
+	    "tf=%p: srr1 (%#lx): PSL_FP set but FPU curlwp %p is not curlwp %p!",
+	    tf, tf->tf_srr1, l->l_cpu->ci_data.cpu_pcu_curlwp[PCU_FPU], l);
+
+	/* clear SRR1 status bits */
+	tf->tf_srr1 &= (PSL_USERSRR1|PSL_FP|PSL_VEC);
 
 #ifdef ALTIVEC
 	/*

Index: src/sys/arch/powerpc/oea/oea_machdep.c
diff -u src/sys/arch/powerpc/oea/oea_machdep.c:1.63.2.3 src/sys/arch/powerpc/oea/oea_machdep.c:1.63.2.4
--- src/sys/arch/powerpc/oea/oea_machdep.c:1.63.2.3	Thu Nov 19 08:50:05 2015
+++ src/sys/arch/powerpc/oea/oea_machdep.c	Wed May 18 08:44:42 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: oea_machdep.c,v 1.63.2.3 2015/11/19 08:50:05 bouyer Exp $	*/
+/*	$NetBSD: oea_machdep.c,v 1.63.2.4 2016/05/18 08:44:42 martin Exp $	*/
 
 /*
  * Copyright (C) 2002 Matt Thomas
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: oea_machdep.c,v 1.63.2.3 2015/11/19 08:50:05 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: oea_machdep.c,v 1.63.2.4 2016/05/18 08:44:42 martin Exp $");
 
 #include "opt_ppcarch.h"
 #include "opt_compat_netbsd.h"
@@ -391,19 +391,16 @@ oea_init(void (*handler)(void))
 
         /*
 	 * Configure a PSL user mask matching this processor.
+	 * Don't allow to set PSL_FP/PSL_VEC, since that will affect PCU.
  	 */
 	cpu_psluserset = PSL_EE | PSL_PR | PSL_ME | PSL_IR | PSL_DR | PSL_RI;
-	cpu_pslusermod = PSL_FP | PSL_FE0 | PSL_FE1 | PSL_LE | PSL_SE | PSL_BE;
+	cpu_pslusermod = PSL_FE0 | PSL_FE1 | PSL_LE | PSL_SE | PSL_BE;
 #ifdef PPC_OEA601
 	if (cpuvers == MPC601) {
 		cpu_psluserset &= PSL_601_MASK;
 		cpu_pslusermod &= PSL_601_MASK;
 	}
 #endif
-#ifdef ALTIVEC
-	if (cpu_altivec)
-		cpu_pslusermod |= PSL_VEC;
-#endif
 #ifdef PPC_HIGH_VEC
 	cpu_psluserset |= PSL_IP;	/* XXX ok? */
 #endif

Reply via email to