diff mbox

Monitor command to translate guest physical address to host virtual address

Message ID 1285897945.24402.5.camel@yhuang-dev (mailing list archive)
State New, archived
Headers show

Commit Message

Huang, Ying Oct. 1, 2010, 1:52 a.m. UTC
None
diff mbox

Patch

--- a/monitor.c
+++ b/monitor.c
@@ -2301,6 +2301,17 @@  static void do_inject_mce(Monitor *mon,
 }
 #endif
 
+static void do_p2v(Monitor *mon, const QDict *qdict)
+{
+    target_phys_addr_t size = TARGET_PAGE_SIZE;
+    target_phys_addr_t addr = qdict_get_int(qdict, "addr");
+    void *vaddr;
+
+    vaddr = cpu_physical_memory_map(addr, &size, 0);
+    monitor_printf(mon, "Guest physical address %p is mapped at "
+                   "host virtual address %p\n", (void *)addr, vaddr);
+}
+
 static int do_getfd(Monitor *mon, const QDict *qdict, QObject **ret_data)
 {
     const char *fdname = qdict_get_str(qdict, "fdname");
--- a/qemu-monitor.hx
+++ b/qemu-monitor.hx
@@ -459,6 +459,19 @@  Start gdbserver session (default @var{po
 ETEXI
 
     {
+        .name       = "p2v",
+        .args_type  = "fmt:/,addr:l",
+        .params     = "/fmt addr",
+        .help       = "translate guest physical 'addr' to host virtual address",
+        .mhandler.cmd = do_p2v,
+    },
+STEXI
+@item p2v @var{addr}
+@findex mce
+Translate guest physical @var{addr} to host virtual address.
+ETEXI
+
+    {
         .name       = "x",
         .args_type  = "fmt:/,addr:l",
         .params     = "/fmt addr",