qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v2 1/6] Add an "info pg" command that prints the current page


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v2 1/6] Add an "info pg" command that prints the current page tables
Date: Mon, 3 Jun 2024 10:46:53 +0200
User-agent: Mozilla Thunderbird

On 31/5/24 16:11, Dr. David Alan Gilbert wrote:
* Don Porter (porter@cs.unc.edu) wrote:
The new "info pg" monitor command prints the current page table,
including virtual address ranges, flag bits, and snippets of physical
page numbers.  Completely filled regions of the page table with
compatible flags are "folded", with the result that the complete
output for a freshly booted x86-64 Linux VM can fit in a single
terminal window.  The output looks like this:

VPN range             Entry         Flags            Physical page
[7f0000000-7f0000000] PML4[0fe]     ---DA--UWP
   [7f28c0000-7f28fffff]  PDP[0a3]     ---DA--UWP
     [7f28c4600-7f28c47ff]  PDE[023]     ---DA--UWP
       [7f28c4655-7f28c4656]  PTE[055-056] X--D---U-P 0000007f14-0000007f15
       [7f28c465b-7f28c465b]  PTE[05b]     ----A--U-P 0000001cfc
...
[ff8000000-ff8000000] PML4[1ff]     ---DA--UWP
   [ffff80000-ffffbffff]  PDP[1fe]     ---DA---WP
     [ffff81000-ffff81dff]  PDE[008-00e] -GSDA---WP 0000001000-0000001dff
   [ffffc0000-fffffffff]  PDP[1ff]     ---DA--UWP
     [ffffff400-ffffff5ff]  PDE[1fa]     ---DA--UWP
       [ffffff5fb-ffffff5fc]  PTE[1fb-1fc] XG-DACT-WP 00000fec00 00000fee00
     [ffffff600-ffffff7ff]  PDE[1fb]     ---DA--UWP
       [ffffff600-ffffff600]  PTE[000]     -G-DA--U-P 0000001467

This draws heavy inspiration from Austin Clements' original patch.

This also adds a generic page table walker, which other monitor
and execution commands will be migrated to in subsequent patches.

Signed-off-by: Don Porter <porter@cs.unc.edu>
---
  hmp-commands-info.hx              |  26 ++
  include/monitor/hmp-target.h      |   1 +
  target/i386/arch_memory_mapping.c | 486 +++++++++++++++++++++++++++++-
  target/i386/cpu.h                 |  16 +
  target/i386/monitor.c             | 380 +++++++++++++++++++++++
  5 files changed, 908 insertions(+), 1 deletion(-)

diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
index 20a9835ea8..918b82015c 100644
--- a/hmp-commands-info.hx
+++ b/hmp-commands-info.hx
@@ -237,6 +237,32 @@ ERST
          .cmd        = hmp_info_mtree,
      },
+#if defined(TARGET_I386)

FYI in order to unify all QEMU system binaries as a single
one, we are trying to remove target-specific bits in monitor.

How 'info pg' should work in a binary supporting heterogeneous
emulation?

+    {
+        .name       = "pg",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show the page table",
+        .cmd        = hmp_info_pg,
+    },
+#endif

So that looks OK




reply via email to

[Prev in Thread] Current Thread [Next in Thread]