summaryrefslogtreecommitdiff
path: root/vm
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2015-07-10 16:28:11 +0200
committerJustus Winter <4winter@informatik.uni-hamburg.de>2015-08-15 12:43:27 +0200
commite6514f58ee48b5440e71b42b3859047120bce9cf (patch)
treea34cfbbdbc9da72f3d4db2f11c800364432c585e /vm
parent49b87ac0e4767cae64249e16e97e0e461b59518f (diff)
yyy vm: add vm_map_info
Diffstat (limited to 'vm')
-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 a521476..1ebccac 100644
--- a/vm/vm_map.c
+++ b/vm/vm_map.c
@@ -4831,4 +4831,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 */