Source-Changes-HG archive

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

[src/trunk]: src/sys Add a macro to test if a map entry is wired.



details:   https://anonhg.NetBSD.org/src/rev/f11dd6b5d3e6
branches:  trunk
changeset: 473702:f11dd6b5d3e6
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Wed Jun 16 00:29:04 1999 +0000

description:
Add a macro to test if a map entry is wired.

diffstat:

 sys/uvm/uvm_fault.c |   6 +++---
 sys/uvm/uvm_map.c   |  41 +++++++++++++++++++----------------------
 sys/vm/vm_map.h     |   4 +++-
 3 files changed, 25 insertions(+), 26 deletions(-)

diffs (207 lines):

diff -r 9d59daf60e85 -r f11dd6b5d3e6 sys/uvm/uvm_fault.c
--- a/sys/uvm/uvm_fault.c       Tue Jun 15 23:32:08 1999 +0000
+++ b/sys/uvm/uvm_fault.c       Wed Jun 16 00:29:04 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_fault.c,v 1.33 1999/06/04 23:38:41 thorpej Exp $   */
+/*     $NetBSD: uvm_fault.c,v 1.34 1999/06/16 00:29:04 thorpej Exp $   */
 
 /*
  *
@@ -647,7 +647,7 @@
         */
 
        enter_prot = ufi.entry->protection;
-       wired = (ufi.entry->wired_count != 0) || (fault_type == VM_FAULT_WIRE);
+       wired = VM_MAPENT_ISWIRED(ufi.entry) || (fault_type == VM_FAULT_WIRE);
        if (wired)
                access_type = enter_prot; /* full access for wired */
 
@@ -847,7 +847,7 @@
                            VM_PAGE_TO_PHYS(anon->u.an_page),
                            (anon->an_ref > 1) ? (enter_prot & ~VM_PROT_WRITE) :
                            enter_prot, 
-                           (ufi.entry->wired_count != 0), 0);
+                           VM_MAPENT_ISWIRED(ufi.entry), 0);
                }
                simple_unlock(&anon->an_lock);
        }
diff -r 9d59daf60e85 -r f11dd6b5d3e6 sys/uvm/uvm_map.c
--- a/sys/uvm/uvm_map.c Tue Jun 15 23:32:08 1999 +0000
+++ b/sys/uvm/uvm_map.c Wed Jun 16 00:29:04 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_map.c,v 1.54 1999/06/15 23:27:47 thorpej Exp $     */
+/*     $NetBSD: uvm_map.c,v 1.55 1999/06/16 00:29:04 thorpej Exp $     */
 
 /* 
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -600,7 +600,7 @@
                        goto step3;
 
                /* wired_count's must match (new area is unwired) */
-               if (prev_entry->wired_count)
+               if (VM_MAPENT_ISWIRED(prev_entry))
                        goto step3; 
 
                /*
@@ -991,7 +991,7 @@
                 * unwiring will put the entries back into the pmap (XXX).
                 */
 
-               if (entry->wired_count)
+               if (VM_MAPENT_ISWIRED(entry))
                        uvm_map_entry_unwire(map, entry);
 
                /*
@@ -1116,7 +1116,7 @@
                 * sanity check
                 */
                /* was part of vm_map_entry_delete() */
-               if (first_entry->wired_count)
+               if (VM_MAPENT_ISWIRED(first_entry))
                        panic("unmap: still wired!");
 #endif
 
@@ -2033,11 +2033,10 @@
                 * really wired down and that there are no holes.  
                 */
                while ((entry != &map->header) && (entry->start < end)) {
-                       
                        if (entry->wired_count == 0 ||
                            (entry->end < end &&
-                           (entry->next == &map->header ||
-                           entry->next->start > entry->end))) {
+                            (entry->next == &map->header ||
+                             entry->next->start > entry->end))) {
                                vm_map_unlock(map);
                                UVMHIST_LOG(maphist,
                                    "<- done (INVALID UNWIRE ARG)",0,0,0,0);
@@ -2060,7 +2059,7 @@
                while ((entry != &map->header) && (entry->start < end)) {
                        UVM_MAP_CLIP_END(map, entry, end);
                        entry->wired_count--;
-                       if (entry->wired_count == 0)
+                       if (VM_MAPENT_ISWIRED(entry) == 0)
                                uvm_map_entry_unwire(map, entry);
                        entry = entry->next;
                }
@@ -2095,9 +2094,7 @@
         */
 
        while ((entry != &map->header) && (entry->start < end)) {
-
-               if (entry->wired_count == 0) {  /* not already wired? */
-
+               if (VM_MAPENT_ISWIRED(entry) == 0) { /* not already wired? */
                        /* 
                         * perform actions of vm_map_lookup that need the
                         * write lock on the map: create an anonymous map
@@ -2105,7 +2102,6 @@
                         * for a zero-fill region.  (XXXCDC: submap case
                         * ok?)
                         */
-
                        if (!UVM_ET_ISSUBMAP(entry)) {  /* not submap */
                                if (UVM_ET_ISNEEDSCOPY(entry) && 
                                    ((entry->protection & VM_PROT_WRITE) ||
@@ -2115,7 +2111,7 @@
                                        /* XXXCDC: wait OK? */
                                }
                        }
-               } /* wired_count == 0 */
+               }
                UVM_MAP_CLIP_START(map, entry, start);
                UVM_MAP_CLIP_END(map, entry, end);
                entry->wired_count++;
@@ -2189,7 +2185,7 @@
                entry = start_entry;
                while (entry != failed_entry) {
                        entry->wired_count--;
-                       if (entry->wired_count == 0)
+                       if (VM_MAPENT_ISWIRED(entry) == 0)
                                uvm_map_entry_unwire(map, entry);
                        entry = entry->next;
                }
@@ -2248,8 +2244,9 @@
                 */
                for (entry = map->header.next; entry != &map->header;
                     entry = entry->next) {
-                       if (entry->wired_count) {
-                               if (--entry->wired_count == 0)
+                       if (VM_MAPENT_ISWIRED(entry)) {
+                               entry->wired_count--;
+                               if (VM_MAPENT_ISWIRED(entry) == 0)
                                        uvm_map_entry_unwire(map, entry);
                        }
                }
@@ -2305,7 +2302,7 @@
        for (size = 0, entry = map->header.next; entry != &map->header;
             entry = entry->next) {
                if (entry->protection != VM_PROT_NONE &&
-                   entry->wired_count == 0) {  /* not already wired? */
+                   VM_MAPENT_ISWIRED(entry) == 0) { /* not already wired? */
                        size += entry->end - entry->start;
                }
        }
@@ -2332,7 +2329,7 @@
             entry = entry->next) {
                if (entry->protection == VM_PROT_NONE)
                        continue;
-               if (entry->wired_count == 0) {  /* not already wired? */
+               if (VM_MAPENT_ISWIRED(entry) == 0) { /* not already wired? */
                        /*
                         * perform actions of vm_map_lookup that need the
                         * write lock on the map: create an anonymous map
@@ -2349,7 +2346,7 @@
                                        /* XXXCDC: wait OK? */
                                }
                        }
-               } /* wired_count == 0 */
+               }
                entry->wired_count++;
        }
 
@@ -2398,7 +2395,7 @@
                for (entry = map->header.next; entry != failed_entry;
                     entry = entry->next) {
                        entry->wired_count--;
-                       if (entry->wired_count == 0)
+                       if (VM_MAPENT_ISWIRED(entry) == 0)
                                uvm_map_entry_unwire(map, entry);
                }
                vm_map_unlock(map);
@@ -2972,7 +2969,7 @@
 
                          if ((amap_flags(old_entry->aref.ar_amap) & 
                               AMAP_SHARED) != 0 ||
-                             old_entry->wired_count != 0) {
+                             VM_MAPENT_ISWIRED(old_entry)) {
 
                            amap_copy(new_map, new_entry, M_WAITOK, FALSE,
                                      0, 0);
@@ -2991,7 +2988,7 @@
                         * allocated any needed amap (above).
                         */
 
-                       if (old_entry->wired_count != 0) {
+                       if (VM_MAPENT_ISWIRED(old_entry)) {
 
                          /* 
                           * resolve all copy-on-write faults now
diff -r 9d59daf60e85 -r f11dd6b5d3e6 sys/vm/vm_map.h
--- a/sys/vm/vm_map.h   Tue Jun 15 23:32:08 1999 +0000
+++ b/sys/vm/vm_map.h   Wed Jun 16 00:29:04 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vm_map.h,v 1.30 1999/06/15 23:27:48 thorpej Exp $      */
+/*     $NetBSD: vm_map.h,v 1.31 1999/06/16 00:29:05 thorpej Exp $      */
 
 /* 
  * Copyright (c) 1991, 1993
@@ -123,6 +123,8 @@
 
 };
 
+#define        VM_MAPENT_ISWIRED(entry)        ((entry)->wired_count != 0)
+
 /*
  *     Maps are doubly-linked lists of map entries, kept sorted
  *     by address.  A single hint is provided to start



Home | Main Index | Thread Index | Old Index