Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/powerpc/powerpc Fix curlwp check for fpreg/vecreg t...



details:   https://anonhg.NetBSD.org/src/rev/da0d43285982
branches:  trunk
changeset: 766176:da0d43285982
user:      matt <matt%NetBSD.org@localhost>
date:      Fri Jun 17 23:12:40 2011 +0000

description:
Fix curlwp check for fpreg/vecreg to acknowledge that the PCU is either
for the current lwp or that PCU is not owned on any cpu.

diffstat:

 sys/arch/powerpc/powerpc/process_machdep.c |  19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diffs (56 lines):

diff -r 5f44f603993f -r da0d43285982 sys/arch/powerpc/powerpc/process_machdep.c
--- a/sys/arch/powerpc/powerpc/process_machdep.c        Fri Jun 17 21:19:42 2011 +0000
+++ b/sys/arch/powerpc/powerpc/process_machdep.c        Fri Jun 17 23:12:40 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: process_machdep.c,v 1.32 2011/06/12 20:38:10 matt Exp $        */
+/*     $NetBSD: process_machdep.c,v 1.33 2011/06/17 23:12:40 matt Exp $        */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,13 +32,14 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.32 2011/06/12 20:38:10 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.33 2011/06/17 23:12:40 matt Exp $");
 
 #include "opt_altivec.h"
 
 #include <sys/param.h>
 #include <sys/proc.h>
 #include <sys/systm.h>
+#include <sys/cpu.h>
 #include <sys/ptrace.h>
 
 #include <machine/fpu.h>
@@ -88,10 +89,12 @@
        if (!fpu_used_p(l)) {
                memset(fpregs, 0, sizeof (*fpregs));
 #ifdef PPC_HAVE_FPU
+       } else if (l == curlwp) {
+               fpu_save();
        } else {
-               KASSERTMSG(l == curlwp,
-                   ("%s: l (%p) != curlwp (%p)", __func__, l, curlwp));
-               fpu_save();
+               KASSERTMSG(l->l_pcu_cpu[PCU_FPU] == NULL,
+                   ("%s: FPU of l (%p) active on cpu%u",
+                    __func__, l, cpu_index(l->l_pcu_cpu[PCU_FPU])));
 #endif
        }
        *fpregs = pcb->pcb_fpu;
@@ -156,9 +159,13 @@
        /* Is the process using AltiVEC? */
        if (!vec_used_p(l)) {
                memset(vregs, 0, sizeof (*vregs));
-       } else {
+       } else if (l == curlwp) {
                vec_save();
                *vregs = pcb->pcb_vr;
+       } else {
+               KASSERTMSG(l->l_pcu_cpu[PCU_VEC] == NULL,
+                   ("%s: VEC of l (%p) active on cpu%u",
+                    __func__, l, cpu_index(l->l_pcu_cpu[PCU_FPU])));
        }
        vec_mark_used(l);
 



Home | Main Index | Thread Index | Old Index