summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vm/vm_map.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/vm/vm_map.c b/vm/vm_map.c
index 1b331d6..99481c7 100644
--- a/vm/vm_map.c
+++ b/vm/vm_map.c
@@ -4858,4 +4858,58 @@ void vm_map_copy_print(copy)
indent -= 2;
}
+
+/*
+ * vm_map_info: [ debug ]
+ *
+ * Like vm_map_print, but less verbose. Output is similar to
+ * that of /bin/vminfo.
+ */
+void vm_map_info(vm_map_t map)
+{
+ vm_map_entry_t entry;
+
+ printf("Task map 0x%X: pmap=0x%X,",
+ (vm_offset_t) map, (vm_offset_t) (map->pmap));
+ printf("ref=%d,nentries=%d,", map->ref_count, map->hdr.nentries);
+ printf("version=%d\n", map->timestamp);
+
+ for (entry = vm_map_first_entry(map);
+ entry != vm_map_to_entry(map);
+ entry = entry->vme_next) {
+ static char *inheritance_name[3] = { "share", "copy", "none"};
+
+ /* Offset and size. */
+ printf("0x%X[0x%X] ",
+ (vm_offset_t) entry->vme_start,
+ (vm_offset_t) entry->vme_end
+ - (vm_offset_t) entry->vme_start);
+
+ static char *protections[] = {
+ "0", "R", "W", "RW", "X", "RX", "WX", "RWX",
+ };
+ printf("(prot=%s, max_prot=%s",
+ protections[entry->protection],
+ protections[entry->max_protection]);
+ if (entry->is_sub_map)
+ printf(", submap=0x%X",
+ (vm_offset_t) entry->object.sub_map);
+ else if (entry->object.vm_object)
+ printf(", object=0x%X",
+ (vm_offset_t) entry->object.vm_object);
+ if (entry->offset)
+ printf(", offs=0x%x", entry->offset);
+ if (entry->inheritance != VM_INHERIT_NONE)
+ printf(", %s", inheritance_name[entry->inheritance]);
+ if (entry->wired_count != 0) {
+ printf(", wired=");
+ if (entry->user_wired_count != 0)
+ printf("u");
+ if (entry->wired_count >
+ ((entry->user_wired_count == 0) ? 0 : 1))
+ printf("k");
+ }
+ printf(")\n");
+ }
+}
#endif /* MACH_KDB */