Source-Changes-HG archive

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

[src/netbsd-2]: src/sys/arch/powerpc/oea Pull up revisions 1.23 and 1.29 (req...



details:   https://anonhg.NetBSD.org/src/rev/b6bee6356542
branches:  netbsd-2
changeset: 563938:b6bee6356542
user:      riz <riz%NetBSD.org@localhost>
date:      Sun Aug 07 14:35:06 2005 +0000

description:
Pull up revisions 1.23 and 1.29 (requested by briggs in ticket #1238):
Consider the MPC601's different battable layout and its use of
I/O segments.
Ensure that pap is non-NULL before use in pmap_extract(). Fixes PR#29507.

diffstat:

 sys/arch/powerpc/oea/pmap.c |  42 +++++++++++++++++++++++++++++++++---------
 1 files changed, 33 insertions(+), 9 deletions(-)

diffs (71 lines):

diff -r bce9d395b535 -r b6bee6356542 sys/arch/powerpc/oea/pmap.c
--- a/sys/arch/powerpc/oea/pmap.c       Fri Aug 05 20:20:19 2005 +0000
+++ b/sys/arch/powerpc/oea/pmap.c       Sun Aug 07 14:35:06 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.23.2.1 2004/08/22 14:16:16 tron Exp $       */
+/*     $NetBSD: pmap.c,v 1.23.2.1.2.1 2005/08/07 14:35:06 riz 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.23.2.1 2004/08/22 14:16:16 tron Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.23.2.1.2.1 2005/08/07 14:35:06 riz Exp $");
 
 #include "opt_ppcarch.h"
 #include "opt_altivec.h"
@@ -2005,13 +2005,35 @@
        if (pm == pmap_kernel() &&
            (va < VM_MIN_KERNEL_ADDRESS ||
             (KERNEL2_SR < 15 && VM_MAX_KERNEL_ADDRESS <= va))) {
-               register_t batu = battable[va >> ADDR_SR_SHFT].batu;
                KASSERT((va >> ADDR_SR_SHFT) != USER_SR);
-               if (BAT_VALID_P(batu,0) && BAT_VA_MATCH_P(batu,va)) {
-                       register_t batl = battable[va >> ADDR_SR_SHFT].batl;
-                       register_t mask = (~(batu & BAT_BL) << 15) & ~0x1ffffL;
-                       *pap = (batl & mask) | (va & ~mask);
-                       return TRUE;
+               if ((MFPVR() >> 16) != MPC601) {
+                       register_t batu = battable[va >> ADDR_SR_SHFT].batu;
+                       if (BAT_VALID_P(batu,0) && BAT_VA_MATCH_P(batu,va)) {
+                               register_t batl =
+                                   battable[va >> ADDR_SR_SHFT].batl;
+                               register_t mask =
+                                   (~(batu & BAT_BL) << 15) & ~0x1ffffL;
+                               if (pap)
+                                       *pap = (batl & mask) | (va & ~mask);
+                               return TRUE;
+                       }
+               } else {
+                       register_t batu = battable[va >> 23].batu;
+                       register_t batl = battable[va >> 23].batl;
+                       register_t sr = iosrtable[va >> ADDR_SR_SHFT];
+                       if (BAT601_VALID_P(batl) &&
+                           BAT601_VA_MATCH_P(batu, batl, va)) {
+                               register_t mask =
+                                   (~(batl & BAT601_BSM) << 17) & ~0x1ffffL;
+                               if (pap)
+                                       *pap = (batl & mask) | (va & ~mask);
+                               return TRUE;
+                       } else if (SR601_VALID_P(sr) &&
+                                  SR601_PA_MATCH_P(sr, va)) {
+                               if (pap)
+                                       *pap = va;
+                               return TRUE;
+                       }
                }
                return FALSE;
        }
@@ -2020,7 +2042,9 @@
        pvo = pmap_pvo_find_va(pm, va & ~ADDR_POFF, NULL);
        if (pvo != NULL) {
                PMAP_PVO_CHECK(pvo);            /* sanity check */
-               *pap = (pvo->pvo_pte.pte_lo & PTE_RPGN) | (va & ADDR_POFF);
+               if (pap)
+                       *pap = (pvo->pvo_pte.pte_lo & PTE_RPGN)
+                           | (va & ADDR_POFF);
        }
        pmap_interrupts_restore(msr);
        return pvo != NULL;



Home | Main Index | Thread Index | Old Index