qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] monitor: Prevent sign-extension of 32-bit addresses printed by info mem
@ 2011-08-15  3:19 Austin Clements
  2011-08-21 18:26 ` Blue Swirl
  0 siblings, 1 reply; 5+ messages in thread
From: Austin Clements @ 2011-08-15  3:19 UTC (permalink / raw)
  To: qemu-devel; +Cc: Austin Clements, Markus Armbruster, Luiz Capitulino

Previously, on 32-bit i386, info mem used signed 32-bit int's to store
the page table indexes.  As a result, address calculation was done in
32 bits and then incorrectly sign-extended to 64 bits, yielding output
like

ffffffffef000000-ffffffffef031000 0000000000031000 ur-
ffffffffef7bc000-ffffffffef7bd000 0000000000001000 urw
ffffffffef7bd000-ffffffffef7be000 0000000000001000 ur-

This makes these indexes unsigned, which yields correct output

00000000ef000000-00000000ef031000 0000000000031000 ur-
00000000ef7bc000-00000000ef7bd000 0000000000001000 urw
00000000ef7bd000-00000000ef7be000 0000000000001000 ur-

Signed-off-by: Austin Clements <amdragon@mit.edu>
---
 monitor.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/monitor.c b/monitor.c
index 718935b..6a4f8c2 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2224,7 +2224,8 @@ static void mem_print(Monitor *mon, target_phys_addr_t *pstart,
 
 static void mem_info_32(Monitor *mon, CPUState *env)
 {
-    int l1, l2, prot, last_prot;
+    unsigned int l1, l2;
+    int prot, last_prot;
     uint32_t pgd, pde, pte;
     target_phys_addr_t start, end;
 
@@ -2261,7 +2262,8 @@ static void mem_info_32(Monitor *mon, CPUState *env)
 
 static void mem_info_pae32(Monitor *mon, CPUState *env)
 {
-    int l1, l2, l3, prot, last_prot;
+    unsigned int l1, l2, l3;
+    int prot, last_prot;
     uint64_t pdpe, pde, pte;
     uint64_t pdp_addr, pd_addr, pt_addr;
     target_phys_addr_t start, end;
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-08-21 19:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-15  3:19 [Qemu-devel] [PATCH] monitor: Prevent sign-extension of 32-bit addresses printed by info mem Austin Clements
2011-08-21 18:26 ` Blue Swirl
2011-08-21 18:48   ` Austin Clements
2011-08-21 18:49     ` [Qemu-devel] [PATCH] monitor: Prevent sign-extension of 32-bit addresses printed by info tlb Austin Clements
2011-08-21 19:51       ` Blue Swirl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).