From 53d43e3f5237c8851a10132d7caf399ab3f71491 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 30 Jan 2007 12:03:04 +0000 Subject: [PATCH] The KDL command "page" can now also look up the physical page behind a virtual address. The "lookup" option has been removed, there is now a "-p" for a physical address, and "-v" for a virtual address. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20016 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/vm/vm_page.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/system/kernel/vm/vm_page.c b/src/system/kernel/vm/vm_page.c index 83cbdb48fe..902d56b454 100644 --- a/src/system/kernel/vm/vm_page.c +++ b/src/system/kernel/vm/vm_page.c @@ -12,7 +12,9 @@ #include #include +#include #include +#include #include #include #include @@ -875,24 +877,41 @@ dump_page(int argc, char **argv) { struct vm_page *page; addr_t address; + bool physical = false; int32 index = 1; - if (argc > 2 && !strncmp(argv[1], "lookup", strlen(argv[1]))) - index++; + if (argc > 2) { + if (!strcmp(argv[1], "-p")) { + physical = true; + index++; + } else if (!strcmp(argv[1], "-v")) + index++; + } if (argc < 2 || strlen(argv[index]) <= 2 || argv[index][0] != '0' || argv[index][1] != 'x') { - kprintf("usage: page [lookup]
\n"); + kprintf("usage: page [-p|-v]
\n" + " -v looks up a virtual address for the page, -p a physical address.\n" + " Default is to look for the page structure address directly\n."); return 0; } address = strtoul(argv[index], NULL, 0); - if (index == 2) + if (index == 2) { + if (!physical) { + vm_address_space *addressSpace = vm_kernel_address_space(); + if (thread_get_current_thread()->team->address_space != NULL) + addressSpace = thread_get_current_thread()->team->address_space; + + addressSpace->translation_map.ops->query_interrupt( + &addressSpace->translation_map, address, &address); + + } page = vm_lookup_page(address / B_PAGE_SIZE); - else + } else page = (struct vm_page *)address; kprintf("PAGE: %p\n", page);