Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/powerpc Restore ci_curpm since it re-enables 603 to...



details:   https://anonhg.NetBSD.org/src/rev/302a4513587e
branches:  trunk
changeset: 555557:302a4513587e
user:      matt <matt%NetBSD.org@localhost>
date:      Fri Nov 21 18:07:29 2003 +0000

description:
Restore ci_curpm since it re-enables 603 to working state.

diffstat:

 sys/arch/powerpc/include/cpu.h         |   4 +++-
 sys/arch/powerpc/oea/genassym.cf       |   3 ++-
 sys/arch/powerpc/oea/oea_machdep.c     |   6 +++---
 sys/arch/powerpc/oea/pmap.c            |  13 +++++++++++--
 sys/arch/powerpc/powerpc/locore_subr.S |   7 ++++---
 sys/arch/powerpc/powerpc/trap_subr.S   |  28 ++++++++--------------------
 6 files changed, 31 insertions(+), 30 deletions(-)

diffs (213 lines):

diff -r 5af9dcc03c9e -r 302a4513587e sys/arch/powerpc/include/cpu.h
--- a/sys/arch/powerpc/include/cpu.h    Fri Nov 21 18:07:09 2003 +0000
+++ b/sys/arch/powerpc/include/cpu.h    Fri Nov 21 18:07:29 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.h,v 1.37 2003/09/03 21:33:31 matt Exp $    */
+/*     $NetBSD: cpu.h,v 1.38 2003/11/21 18:07:29 matt Exp $    */
 
 /*
  * Copyright (C) 1999 Wolfgang Solfrank.
@@ -63,6 +63,7 @@
        struct lwp *ci_curlwp;          /* current owner of the processor */
 
        struct pcb *ci_curpcb;
+       struct pmap *ci_curpm;
        struct lwp *ci_fpulwp;
        struct lwp *ci_veclwp;
        struct pcb *ci_idle_pcb;        /* PA of our idle pcb */
@@ -161,6 +162,7 @@
 
 #define curlwp                 (curcpu()->ci_curlwp)
 #define curpcb                 (curcpu()->ci_curpcb)
+#define curpm                  (curcpu()->ci_curpm)
 
 static __inline register_t
 mfmsr(void)
diff -r 5af9dcc03c9e -r 302a4513587e sys/arch/powerpc/oea/genassym.cf
--- a/sys/arch/powerpc/oea/genassym.cf  Fri Nov 21 18:07:09 2003 +0000
+++ b/sys/arch/powerpc/oea/genassym.cf  Fri Nov 21 18:07:29 2003 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: genassym.cf,v 1.6 2003/08/27 20:20:07 matt Exp $
+#      $NetBSD: genassym.cf,v 1.7 2003/11/21 18:07:29 matt Exp $
 
 #
 # Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -170,6 +170,7 @@
 define CI_SIZE         sizeof(struct cpu_info)
 define CI_CURLWP       offsetof(struct cpu_info, ci_curlwp)
 define CI_CURPCB       offsetof(struct cpu_info, ci_curpcb)
+define CI_CURPM        offsetof(struct cpu_info, ci_curpm)
 define CI_IDLE_PCB     offsetof(struct cpu_info, ci_idle_pcb)
 define CI_ASTPENDING   offsetof(struct cpu_info, ci_astpending)
 define CI_WANT_RESCHED offsetof(struct cpu_info, ci_want_resched)
diff -r 5af9dcc03c9e -r 302a4513587e sys/arch/powerpc/oea/oea_machdep.c
--- a/sys/arch/powerpc/oea/oea_machdep.c        Fri Nov 21 18:07:09 2003 +0000
+++ b/sys/arch/powerpc/oea/oea_machdep.c        Fri Nov 21 18:07:29 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: oea_machdep.c,v 1.11 2003/08/12 05:06:57 matt Exp $    */
+/*     $NetBSD: oea_machdep.c,v 1.12 2003/11/21 18:07:29 matt Exp $    */
 
 /*
  * Copyright (C) 2002 Matt Thomas
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: oea_machdep.c,v 1.11 2003/08/12 05:06:57 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: oea_machdep.c,v 1.12 2003/11/21 18:07:29 matt Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_ddb.h"
@@ -158,7 +158,7 @@
        curpcb->pcb_vr.vscr = 0;
        curpcb->pcb_vr.vrsave = 0;
 #endif
-       curpcb->pcb_pm = pmap_kernel();
+       curpm = curpcb->pcb_pm = pmap_kernel();
 
        /*
         * Cause a PGM trap if we branch to 0.
diff -r 5af9dcc03c9e -r 302a4513587e sys/arch/powerpc/oea/pmap.c
--- a/sys/arch/powerpc/oea/pmap.c       Fri Nov 21 18:07:09 2003 +0000
+++ b/sys/arch/powerpc/oea/pmap.c       Fri Nov 21 18:07:29 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.16 2003/10/27 23:35:41 kleink Exp $ */
+/*     $NetBSD: pmap.c,v 1.17 2003/11/21 18:09:27 matt Exp $   */
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.16 2003/10/27 23:35:41 kleink Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.17 2003/11/21 18:09:27 matt Exp $");
 
 #include "opt_altivec.h"
 #include "opt_pmap.h"
@@ -2101,6 +2101,15 @@
         * XXX Normally performed in cpu_fork().
         */
        pcb->pcb_pm = pmap;
+
+       /*
+       * In theory, the SR registers need only be valid on return
+       * to user space wait to do them there.
+       */
+       if (l == curlwp) {
+               /* Store pointer to new current pmap. */
+               curpm = pmap;
+       }
 }
 
 /*
diff -r 5af9dcc03c9e -r 302a4513587e sys/arch/powerpc/powerpc/locore_subr.S
--- a/sys/arch/powerpc/powerpc/locore_subr.S    Fri Nov 21 18:07:09 2003 +0000
+++ b/sys/arch/powerpc/powerpc/locore_subr.S    Fri Nov 21 18:07:29 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore_subr.S,v 1.23 2003/10/17 22:21:38 matt Exp $    */
+/*     $NetBSD: locore_subr.S,v 1.24 2003/11/21 18:07:29 matt Exp $    */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -360,6 +360,8 @@
        stptr   %r31,CI_CURLWP(%r7)
        ldptr   %r4,L_ADDR(%r31)        /* put PCB addr in r4 */
        stptr   %r4,CI_CURPCB(%r7)      /* indicate new pcb */
+       ldptr   %r3,PCB_PM(%r4)         /* save pmap pointer */
+       stptru  %r3,CI_CURPM(%r7)
 #if 0
        li      %r3,CI_CURPCB
 #ifdef PPC_OEA64
@@ -423,8 +425,7 @@
 #if defined(PPC_IBM4XX)
 0:
        GET_CPUINFO(%r3)
-       ldreg   %r3,CI_CURPCB(%r3)      /* Do we need a context? */
-       ldreg   %r3,PCB_PM(%r3) 
+       ldreg   %r3,CI_CURPM(%r3)       /* Do we need a context? */
        ldreg   %r4,PM_CTX(%r3)
        cmpwi   %r4,0
 #      mtspr   SPR_SPR0,4              /* Always keep the current ctx here */
diff -r 5af9dcc03c9e -r 302a4513587e sys/arch/powerpc/powerpc/trap_subr.S
--- a/sys/arch/powerpc/powerpc/trap_subr.S      Fri Nov 21 18:07:09 2003 +0000
+++ b/sys/arch/powerpc/powerpc/trap_subr.S      Fri Nov 21 18:07:29 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap_subr.S,v 1.51 2003/10/22 17:27:58 matt Exp $      */
+/*     $NetBSD: trap_subr.S,v 1.52 2003/11/21 18:07:29 matt Exp $      */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -60,6 +60,8 @@
  * User segment table is loaded through a pointer to the current pmap.
  */
 #define RESTORE_USER_SRS(t0,t1)                                                \
+       GET_CPUINFO(t0);                                                \
+       ldptr   t0,CI_CURPM(t0);                                        \
        ldreg   t0,PM_STEG(t0);                                         \
        mtasr   t0
 
@@ -98,6 +100,8 @@
  * User SRs are loaded through a pointer to the current pmap.
  */
 #define RESTORE_USER_SRS(pmap,sr) \
+       GET_CPUINFO(pmap); \
+       ldptr   pmap,CI_CURPM(pmap); \
        ldregu  sr,PM_SR(pmap); \
        RESTORE_SRS(pmap,sr)
 
@@ -770,11 +774,6 @@
 /* Can't touch %r1 from here on */                                     \
        mtsprg2 %r2;                    /* save r2 & r3 */              \
        mtsprg3 %r3;                                                    \
-/* While the MMU is on, get the PMAP address and save it */            \
-       GET_CPUINFO(%r2);                                               \
-       ldptr   %r3,CI_CURPCB(%r2);                                     \
-       ldptr   %r3,PCB_PM(%r3);                                        \
-       stptr   %r3,(savearea+CPUSAVE_R28)(%r2);                        \
 /* Disable translation, machine check and recoverability: */           \
        mfmsr   %r2;                                                    \
        andi.   %r2,%r2,~(PSL_DR|PSL_IR|PSL_ME|PSL_RI)@l;               \
@@ -787,8 +786,6 @@
        bf      17,1f;                  /* branch if PSL_PR is false */ \
 /* Restore user SRs */                                                 \
        CPU601_KERN_LEAVE(%r2,%r3);                                     \
-       GET_CPUINFO(%r2);                                               \
-       ldreg   %r2,(savearea+CPUSAVE_R28)(%r2);                        \
        RESTORE_USER_SRS(%r2,%r3);                                      \
 1:     mfsprg1 %r2;                    /* restore cr */                \
        mtcr    %r2;                                                    \
@@ -1011,9 +1008,9 @@
        bl      _C_LABEL(extint_call)   /* to be filled in later */
 
 intr_exit:
-/* Disable interrupts (should already be disabled) and recoverability here: */
+/* Disable interrupts (should already be disabled) and MMU here: */
        mfmsr   %r3
-       andi.   %r3,%r3,~(PSL_EE|PSL_ME|PSL_RI)@l
+       andi.   %r3,%r3,~(PSL_EE|PSL_ME|PSL_RI|PSL_DR|PSL_IR)@l
        mtmsr   %r3
        isync
 
@@ -1038,20 +1035,11 @@
        addi    %r4,%r4,-1              /* adjust reentrancy count */
        stint   %r4,CI_INTRDEPTH(%r5)
 
-       ldptr   %r3,CI_CURPCB(%r5)      /* access PCB while MMU is on */
-       ldptr   %r3,PCB_PM(%r3)         /* get pmap pointer */
-
-/* Now disable MMU */
-       mfmsr   %r4
-       andi.   %r4,%r4,~(PSL_DR|PSL_IR)@l
-       mtmsr   %r4
-       isync
-
 /* Returning to user mode? */
        mtcr    %r6                     /* saved SRR1 */
        bf      17,1f                   /* branch if PSL_PR is false */
 
-       CPU601_KERN_LEAVE(%r6,%r4)      /* leave r3 alone */
+       CPU601_KERN_LEAVE(%r3,%r4)
        RESTORE_USER_SRS(%r3,%r4)
        ldint   %r3,CI_ASTPENDING(%r5)  /* Test AST pending */
        andi.   %r3,%r3,1



Home | Main Index | Thread Index | Old Index