Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm Move uvm_object-related DDB hooks into uvm_object.c....



details:   https://anonhg.NetBSD.org/src/rev/dce37af94e3e
branches:  trunk
changeset: 746720:dce37af94e3e
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Tue Aug 18 19:16:09 2009 +0000

description:
Move uvm_object-related DDB hooks into uvm_object.c.  Put all of the
uvm_map-related DDB stuff in one spot in the file.

diffstat:

 sys/uvm/uvm_map.c    |  122 +++++++++++++++++---------------------------------
 sys/uvm/uvm_object.c |   44 +++++++++++++++++-
 2 files changed, 83 insertions(+), 83 deletions(-)

diffs (222 lines):

diff -r 2706029af385 -r dce37af94e3e sys/uvm/uvm_map.c
--- a/sys/uvm/uvm_map.c Tue Aug 18 19:09:18 2009 +0000
+++ b/sys/uvm/uvm_map.c Tue Aug 18 19:16:09 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_map.c,v 1.279 2009/08/18 19:08:39 thorpej Exp $    */
+/*     $NetBSD: uvm_map.c,v 1.280 2009/08/18 19:16:09 thorpej Exp $    */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -71,7 +71,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.279 2009/08/18 19:08:39 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.280 2009/08/18 19:16:09 thorpej Exp $");
 
 #include "opt_ddb.h"
 #include "opt_uvmhist.h"
@@ -5021,84 +5021,6 @@
        return merged;
 }
 
-#if defined(DDB) || defined(DEBUGPRINT)
-
-/*
- * DDB hooks
- */
-
-/*
- * uvm_map_printit: actually prints the map
- */
-
-void
-uvm_map_printit(struct vm_map *map, bool full,
-    void (*pr)(const char *, ...))
-{
-       struct vm_map_entry *entry;
-
-       (*pr)("MAP %p: [0x%lx->0x%lx]\n", map, vm_map_min(map),
-           vm_map_max(map));
-       (*pr)("\t#ent=%d, sz=%d, ref=%d, version=%d, flags=0x%x\n",
-           map->nentries, map->size, map->ref_count, map->timestamp,
-           map->flags);
-       (*pr)("\tpmap=%p(resident=%ld, wired=%ld)\n", map->pmap,
-           pmap_resident_count(map->pmap), pmap_wired_count(map->pmap));
-       if (!full)
-               return;
-       for (entry = map->header.next; entry != &map->header;
-           entry = entry->next) {
-               (*pr)(" - %p: 0x%lx->0x%lx: obj=%p/0x%llx, amap=%p/%d\n",
-                   entry, entry->start, entry->end, entry->object.uvm_obj,
-                   (long long)entry->offset, entry->aref.ar_amap,
-                   entry->aref.ar_pageoff);
-               (*pr)(
-                   "\tsubmap=%c, cow=%c, nc=%c, prot(max)=%d/%d, inh=%d, "
-                   "wc=%d, adv=%d\n",
-                   (entry->etype & UVM_ET_SUBMAP) ? 'T' : 'F',
-                   (entry->etype & UVM_ET_COPYONWRITE) ? 'T' : 'F',
-                   (entry->etype & UVM_ET_NEEDSCOPY) ? 'T' : 'F',
-                   entry->protection, entry->max_protection,
-                   entry->inheritance, entry->wired_count, entry->advice);
-       }
-}
-
-/*
- * uvm_object_printit: actually prints the object
- */
-
-void
-uvm_object_printit(struct uvm_object *uobj, bool full,
-    void (*pr)(const char *, ...))
-{
-       struct vm_page *pg;
-       int cnt = 0;
-
-       (*pr)("OBJECT %p: locked=%d, pgops=%p, npages=%d, ",
-           uobj, mutex_owned(&uobj->vmobjlock), uobj->pgops, uobj->uo_npages);
-       if (UVM_OBJ_IS_KERN_OBJECT(uobj))
-               (*pr)("refs=<SYSTEM>\n");
-       else
-               (*pr)("refs=%d\n", uobj->uo_refs);
-
-       if (!full) {
-               return;
-       }
-       (*pr)("  PAGES <pg,offset>:\n  ");
-       TAILQ_FOREACH(pg, &uobj->memq, listq.queue) {
-               cnt++;
-               (*pr)("<%p,0x%llx> ", pg, (long long)pg->offset);
-               if ((cnt % 3) == 0) {
-                       (*pr)("\n  ");
-               }
-       }
-       if ((cnt % 3) != 0) {
-               (*pr)("\n");
-       }
-}
-
-#endif /* DDB || DEBUGPRINT */
-
 /*
  * uvm_map_create: create map
  */
@@ -5230,6 +5152,43 @@
 }
 
 #if defined(DDB) || defined(DEBUGPRINT)
+
+/*
+ * uvm_map_printit: actually prints the map
+ */
+
+void
+uvm_map_printit(struct vm_map *map, bool full,
+    void (*pr)(const char *, ...))
+{
+       struct vm_map_entry *entry;
+
+       (*pr)("MAP %p: [0x%lx->0x%lx]\n", map, vm_map_min(map),
+           vm_map_max(map));
+       (*pr)("\t#ent=%d, sz=%d, ref=%d, version=%d, flags=0x%x\n",
+           map->nentries, map->size, map->ref_count, map->timestamp,
+           map->flags);
+       (*pr)("\tpmap=%p(resident=%ld, wired=%ld)\n", map->pmap,
+           pmap_resident_count(map->pmap), pmap_wired_count(map->pmap));
+       if (!full)
+               return;
+       for (entry = map->header.next; entry != &map->header;
+           entry = entry->next) {
+               (*pr)(" - %p: 0x%lx->0x%lx: obj=%p/0x%llx, amap=%p/%d\n",
+                   entry, entry->start, entry->end, entry->object.uvm_obj,
+                   (long long)entry->offset, entry->aref.ar_amap,
+                   entry->aref.ar_pageoff);
+               (*pr)(
+                   "\tsubmap=%c, cow=%c, nc=%c, prot(max)=%d/%d, inh=%d, "
+                   "wc=%d, adv=%d\n",
+                   (entry->etype & UVM_ET_SUBMAP) ? 'T' : 'F',
+                   (entry->etype & UVM_ET_COPYONWRITE) ? 'T' : 'F',
+                   (entry->etype & UVM_ET_NEEDSCOPY) ? 'T' : 'F',
+                   entry->protection, entry->max_protection,
+                   entry->inheritance, entry->wired_count, entry->advice);
+       }
+}
+
 void
 uvm_whatis(uintptr_t addr, void (*pr)(const char *, ...))
 {
@@ -5250,4 +5209,5 @@
                map = entry->object.sub_map;
        }
 }
-#endif /* defined(DDB) || defined(DEBUGPRINT) */
+
+#endif /* DDB || DEBUGPRINT */
diff -r 2706029af385 -r dce37af94e3e sys/uvm/uvm_object.c
--- a/sys/uvm/uvm_object.c      Tue Aug 18 19:09:18 2009 +0000
+++ b/sys/uvm/uvm_object.c      Tue Aug 18 19:16:09 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_object.c,v 1.6 2008/04/28 20:24:12 martin Exp $    */
+/*     $NetBSD: uvm_object.c,v 1.7 2009/08/18 19:16:09 thorpej Exp $   */
 
 /*
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -38,13 +38,15 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_object.c,v 1.6 2008/04/28 20:24:12 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_object.c,v 1.7 2009/08/18 19:16:09 thorpej Exp $");
 
+#include "opt_ddb.h"
 #include "opt_uvmhist.h"
 
 #include <sys/param.h>
 
 #include <uvm/uvm.h>
+#include <uvm/uvm_ddb.h>
 
 /* We will fetch this page count per step */
 #define        FETCH_PAGECOUNT 16
@@ -159,3 +161,41 @@
        mutex_exit(&uvm_pageqlock);
        mutex_exit(&uobj->vmobjlock);
 }
+
+#if defined(DDB) || defined(DEBUGPRINT)
+
+/*
+ * uvm_object_printit: actually prints the object
+ */
+
+void
+uvm_object_printit(struct uvm_object *uobj, bool full,
+    void (*pr)(const char *, ...))
+{
+       struct vm_page *pg;
+       int cnt = 0;
+
+       (*pr)("OBJECT %p: locked=%d, pgops=%p, npages=%d, ",
+           uobj, mutex_owned(&uobj->vmobjlock), uobj->pgops, uobj->uo_npages);
+       if (UVM_OBJ_IS_KERN_OBJECT(uobj))
+               (*pr)("refs=<SYSTEM>\n");
+       else
+               (*pr)("refs=%d\n", uobj->uo_refs);
+
+       if (!full) {
+               return;
+       }
+       (*pr)("  PAGES <pg,offset>:\n  ");
+       TAILQ_FOREACH(pg, &uobj->memq, listq.queue) {
+               cnt++;
+               (*pr)("<%p,0x%llx> ", pg, (long long)pg->offset);
+               if ((cnt % 3) == 0) {
+                       (*pr)("\n  ");
+               }
+       }
+       if ((cnt % 3) != 0) {
+               (*pr)("\n");
+       }
+}
+
+#endif /* DDB || DEBUGPRINT */



Home | Main Index | Thread Index | Old Index