Source-Changes-HG archive

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

[src/netbsd-1-5]: src/sys/arch/i386/i386 pull up rev. 1.105, approved by thor...



details:   https://anonhg.NetBSD.org/src/rev/63c78d1a2110
branches:  netbsd-1-5
changeset: 489518:63c78d1a2110
user:      chs <chs%NetBSD.org@localhost>
date:      Thu Sep 21 14:20:24 2000 +0000

description:
pull up rev. 1.105, approved by thorpej:
> move the guts of pmap_remove() to pmap_do_remove(), which has a flags arg
> to tell it whether or not to remove wired mappings.  pmap_remove() wants
> to remove wired mappings, pmap_collect() doesn't.  fixes PRs 10363 and 10761.

diffstat:

 sys/arch/i386/i386/pmap.c |  47 ++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 38 insertions(+), 9 deletions(-)

diffs (137 lines):

diff -r a181d6df5c2b -r 63c78d1a2110 sys/arch/i386/i386/pmap.c
--- a/sys/arch/i386/i386/pmap.c Thu Sep 21 14:06:29 2000 +0000
+++ b/sys/arch/i386/i386/pmap.c Thu Sep 21 14:20:24 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.94.2.1 2000/08/16 23:18:23 thorpej Exp $    */
+/*     $NetBSD: pmap.c,v 1.94.2.2 2000/09/21 14:20:24 chs Exp $        */
 
 /*
  *
@@ -409,12 +409,16 @@
 static pt_entry_t      *pmap_map_ptes __P((struct pmap *));
 static struct pv_entry *pmap_remove_pv __P((struct pv_head *, struct pmap *,
                                             vaddr_t));
+static void             pmap_do_remove __P((struct pmap *, vaddr_t,
+                                               vaddr_t, int));
 static boolean_t        pmap_remove_pte __P((struct pmap *, struct vm_page *,
-                                             pt_entry_t *, vaddr_t));
+                                             pt_entry_t *, vaddr_t, int));
 static void             pmap_remove_ptes __P((struct pmap *,
                                               struct pmap_remove_record *,
                                               struct vm_page *, vaddr_t,
-                                              vaddr_t, vaddr_t));
+                                              vaddr_t, vaddr_t, int));
+#define PMAP_REMOVE_ALL                0       /* remove all mappings */
+#define PMAP_REMOVE_SKIPWIRED  1       /* skip wired mappings */
 static struct vm_page  *pmap_steal_ptp __P((struct uvm_object *,
                                             vaddr_t));
 static vaddr_t          pmap_tmpmap_pa __P((paddr_t));
@@ -1626,7 +1630,8 @@
                                        pmap_remove_ptes(pmaps_hand, NULL, ptp,
                                                         (vaddr_t)ptes,
                                                         ptp_i2v(idx),
-                                                        ptp_i2v(idx+1));
+                                                        ptp_i2v(idx+1),
+                                                        PMAP_REMOVE_ALL);
                                pmap_tmpunmap_pa();
 
                                if (lcv != PTES_PER_PTP)
@@ -2135,12 +2140,13 @@
  */
 
 static void
-pmap_remove_ptes(pmap, pmap_rr, ptp, ptpva, startva, endva)
+pmap_remove_ptes(pmap, pmap_rr, ptp, ptpva, startva, endva, flags)
        struct pmap *pmap;
        struct pmap_remove_record *pmap_rr;
        struct vm_page *ptp;
        vaddr_t ptpva;
        vaddr_t startva, endva;
+       int flags;
 {
        struct pv_entry *pv_tofree = NULL;      /* list of pv_entrys to free */
        struct pv_entry *pve;
@@ -2161,6 +2167,9 @@
                             ; pte++, startva += NBPG) {
                if (!pmap_valid_entry(*pte))
                        continue;                       /* VA not mapped */
+               if ((flags & PMAP_REMOVE_SKIPWIRED) && (*pte & PG_W)) {
+                       continue;
+               }
 
                opte = *pte;            /* save the old PTE */
                *pte = 0;                       /* zap! */
@@ -2238,11 +2247,12 @@
  */
 
 static boolean_t
-pmap_remove_pte(pmap, ptp, pte, va)
+pmap_remove_pte(pmap, ptp, pte, va, flags)
        struct pmap *pmap;
        struct vm_page *ptp;
        pt_entry_t *pte;
        vaddr_t va;
+       int flags;
 {
        pt_entry_t opte;
        int bank, off;
@@ -2250,6 +2260,9 @@
 
        if (!pmap_valid_entry(*pte))
                return(FALSE);          /* VA not mapped */
+       if ((flags & PMAP_REMOVE_SKIPWIRED) && (*pte & PG_W)) {
+               return(FALSE);
+       }
 
        opte = *pte;                    /* save the old PTE */
        *pte = 0;                       /* zap! */
@@ -2307,6 +2320,21 @@
        struct pmap *pmap;
        vaddr_t sva, eva;
 {
+       pmap_do_remove(pmap, sva, eva, PMAP_REMOVE_ALL);
+}
+
+/*
+ * pmap_do_remove: mapping removal guts
+ *
+ * => caller should not be holding any pmap locks
+ */
+
+static void
+pmap_do_remove(pmap, sva, eva, flags)
+       struct pmap *pmap;
+       vaddr_t sva, eva;
+       int flags;
+{
        pt_entry_t *ptes;
        boolean_t result;
        paddr_t ptppa;
@@ -2354,7 +2382,7 @@
 
                        /* do it! */
                        result = pmap_remove_pte(pmap, ptp,
-                                                &ptes[i386_btop(sva)], sva);
+                           &ptes[i386_btop(sva)], sva, flags);
 
                        /*
                         * if mapping removed and the PTP is no longer
@@ -2449,7 +2477,7 @@
                        }
                }
                pmap_remove_ptes(pmap, prr, ptp,
-                                (vaddr_t)&ptes[i386_btop(sva)], sva, blkendva);
+                   (vaddr_t)&ptes[i386_btop(sva)], sva, blkendva, flags);
 
                /* if PTP is no longer being used, free it! */
                if (ptp && ptp->wire_count <= 1) {
@@ -2944,7 +2972,8 @@
         * for its entire address space.
         */
 
-       pmap_remove(pmap, VM_MIN_ADDRESS, VM_MAX_ADDRESS);
+       pmap_do_remove(pmap, VM_MIN_ADDRESS, VM_MAX_ADDRESS,
+           PMAP_REMOVE_SKIPWIRED);
 }
 
 #if 0



Home | Main Index | Thread Index | Old Index