Source-Changes-HG archive

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

[src/netbsd-1-6]: src/sys/arch/powerpc/mpc6xx Undo pullup of revision 1.51 (r...



details:   https://anonhg.NetBSD.org/src/rev/d11a4a3d39e4
branches:  netbsd-1-6
changeset: 529549:d11a4a3d39e4
user:      tron <tron%NetBSD.org@localhost>
date:      Wed Nov 27 08:13:25 2002 +0000

description:
Undo pullup of revision 1.51 (requested by chs in ticket #1016):
This change causes icache corruption, and reverting it shouldn't
re-introduce any old problems.

diffstat:

 sys/arch/powerpc/mpc6xx/pmap.c |  52 +++++++++++++++--------------------------
 1 files changed, 19 insertions(+), 33 deletions(-)

diffs (108 lines):

diff -r fbf453f260ed -r d11a4a3d39e4 sys/arch/powerpc/mpc6xx/pmap.c
--- a/sys/arch/powerpc/mpc6xx/pmap.c    Tue Nov 26 18:36:04 2002 +0000
+++ b/sys/arch/powerpc/mpc6xx/pmap.c    Wed Nov 27 08:13:25 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.43.4.3 2002/11/10 15:50:38 he Exp $ */
+/*     $NetBSD: pmap.c,v 1.43.4.4 2002/11/27 08:13:25 tron Exp $       */
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -1394,11 +1394,11 @@
                        failed = 1;
                }
                if (((pvo->pvo_pte.pte_lo ^ pt->pte_lo) &
-                   (PTE_PP|PTE_WIMG|PTE_RPGN)) != 0) {
+                   (PTE_PP|PTE_W|PTE_I|PTE_G|PTE_RPGN)) != 0) {
                        printf("pmap_pvo_check: pvo %p: pte_lo differ: %#x/%#x\n",
                            pvo,
-                           pvo->pvo_pte.pte_lo & (PTE_PP|PTE_WIMG|PTE_RPGN),
-                           pt->pte_lo & (PTE_PP|PTE_WIMG|PTE_RPGN));
+                           pvo->pvo_pte.pte_lo & (PTE_PP|PTE_W|PTE_I|PTE_G|PTE_RPGN),
+                           pt->pte_lo & (PTE_PP|PTE_W|PTE_I|PTE_G|PTE_RPGN));
                        failed = 1;
                }
                if (pmap_pte_to_va(pt) != PVO_VADDR(pvo)) {
@@ -1636,21 +1636,26 @@
         * If this is a managed page, and it's the first reference to the
         * page clear the execness of the page.  Otherwise fetch the execness.
         */
-       if (pg != NULL)
-               was_exec = pmap_attr_fetch(pg) & PTE_EXEC;
+       if (pg != NULL) {
+               if (LIST_EMPTY(pvo_head)) {
+                       pmap_attr_clear(pg, PTE_EXEC);
+                       DPRINTFN(ENTER, (" first"));
+               } else {
+                       was_exec = pmap_attr_fetch(pg) & PTE_EXEC;
+               }
+       }
 
        DPRINTFN(ENTER, (" was_exec=%d", was_exec));
 
        /*
         * Assume the page is cache inhibited and access is guarded unless
-        * it's in our available memory array.  If it is in the memory array,
-        * asssume it's in memory coherent memory.
+        * it's in our available memory array.
         */
-       pte_lo = PTE_IG;
+       pte_lo = PTE_I | PTE_G;
        if ((flags & PMAP_NC) == 0) {
                for (mp = mem; mp->size; mp++) {
                        if (pa >= mp->start && pa < mp->start + mp->size) {
-                               pte_lo = PTE_M;
+                               pte_lo &= ~(PTE_I | PTE_G);
                                break;
                        }
                }
@@ -1721,15 +1726,10 @@
        DPRINTFN(KENTER,
            ("pmap_kenter_pa(%#lx,%#lx,%#x)\n", va, pa, prot));
 
-       /*
-        * Assume the page is cache inhibited and access is guarded unless
-        * it's in our available memory array.  If it is in the memory array,
-        * asssume it's in memory coherent memory.
-        */
-       pte_lo = PTE_IG;
+       pte_lo = PTE_I | PTE_G;
        for (mp = mem; mp->size; mp++) {
                if (pa >= mp->start && pa < mp->start + mp->size) {
-                       pte_lo = PTE_M;
+                       pte_lo &= ~(PTE_I | PTE_G);
                        break;
                }
        }
@@ -1751,15 +1751,9 @@
 
        /* 
         * Flush the real memory from the instruction cache.
-        * If it's writeable, clear the PTE_EXEC attribute.
         */
-       if (prot & VM_PROT_EXECUTE) {
-               if ((pte_lo & (PTE_IG)) == 0)
-                       pmap_syncicache(pa, NBPG);
-       } else if (prot & VM_PROT_WRITE) {
-               struct vm_page *pg = PHYS_TO_VM_PAGE(pa);
-               if (pg != NULL)
-                       pmap_attr_clear(pg, PTE_EXEC);
+       if ((prot & VM_PROT_EXECUTE) && (pte_lo & (PTE_I|PTE_G)) == 0) {
+               pmap_syncicache(pa, NBPG);
        }
 }
 
@@ -1949,14 +1943,6 @@
        s = splvm();
        msr = pmap_interrupts_off();
 
-       /*
-        * When UVM reuses a page, it does a pmap_page_protect with
-        * VM_PROT_NONE.  At that point, we can clear the exec flag
-        * since we know the page will have different contents.
-        */
-       if ((prot & VM_PROT_READ) == 0)
-               pmap_attr_clear(pg, PTE_EXEC);
-
        pvo_head = vm_page_to_pvoh(pg);
        for (pvo = LIST_FIRST(pvo_head); pvo != NULL; pvo = next_pvo) {
                next_pvo = LIST_NEXT(pvo, pvo_vlink);



Home | Main Index | Thread Index | Old Index