Module Name: src
Committed By: matt
Date: Mon Jul 6 02:43:26 UTC 2015
Modified Files:
src/sys/arch/powerpc/oea: altivec.c
Log Message:
Don't reload if just re-enabling
To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/powerpc/oea/altivec.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/oea/altivec.c
diff -u src/sys/arch/powerpc/oea/altivec.c:1.29 src/sys/arch/powerpc/oea/altivec.c:1.30
--- src/sys/arch/powerpc/oea/altivec.c:1.29 Fri May 16 00:48:41 2014
+++ src/sys/arch/powerpc/oea/altivec.c Mon Jul 6 02:43:26 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: altivec.c,v 1.29 2014/05/16 00:48:41 rmind Exp $ */
+/* $NetBSD: altivec.c,v 1.30 2015/07/06 02:43:26 matt Exp $ */
/*
* Copyright (C) 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: altivec.c,v 1.29 2014/05/16 00:48:41 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altivec.c,v 1.30 2015/07/06 02:43:26 matt Exp $");
#include "opt_multiprocessor.h"
@@ -82,18 +82,26 @@ vec_state_load(lwp_t *l, u_int flags)
vec_mark_used(l);
}
- /*
- * Enable AltiVec temporarily (and disable interrupts).
- */
- const register_t msr = mfmsr();
- mtmsr((msr & ~PSL_EE) | PSL_VEC);
- __asm volatile ("isync");
-
- /*
- * Load the vector unit from vreg which is best done in
- * assembly.
- */
- vec_load_from_vreg(&pcb->pcb_vr);
+ if ((flags & PCU_REENABLE) == 0) {
+ /*
+ * Enable AltiVec temporarily (and disable interrupts).
+ */
+ const register_t msr = mfmsr();
+ mtmsr((msr & ~PSL_EE) | PSL_VEC);
+ __asm volatile ("isync");
+
+ /*
+ * Load the vector unit from vreg which is best done in
+ * assembly.
+ */
+ vec_load_from_vreg(&pcb->pcb_vr);
+
+ /*
+ * Restore MSR (turn off AltiVec)
+ */
+ mtmsr(msr);
+ __asm volatile ("isync");
+ }
/*
* VRSAVE will be restored when trap frame returns
@@ -101,12 +109,6 @@ vec_state_load(lwp_t *l, u_int flags)
l->l_md.md_utf->tf_vrsave = pcb->pcb_vr.vrsave;
/*
- * Restore MSR (turn off AltiVec)
- */
- mtmsr(msr);
- __asm volatile ("isync");
-
- /*
* Mark vector registers as modified.
*/
l->l_md.md_flags |= PSL_VEC;