Fix a bug in debug printing of memory translation tables
ping
http://patchwork.ozlabs.org/patch/372865/
Quoted 73 lines · Mikhail Ilin
Hi,
I've enabled
DEBUG_MMAPinlinux-user/mmap.cand got debug info of memory layout.This is the debug output of guest memory layout from qemu (including the last mmap call marked with *).
mmap: start=0x0804a000 len=0x00021000 prot=rw- flags=MAP_ANON
MAP_PRIVATEfd=0 offset=00000000 ret=0x0804a000
start end size prot
00048000-00049000 00001000 r-x
* 00049000-0006b000 00022000 rw-
002f6400-002f7400 00001000 rw-
002f7400-003ff400 00108000 r-x
003ff400-003ff400 00000000 r--
003ff400-003f6400ffff7000rw-
003fe400-003ff400 00001000 rw-
003ff400-003ff400 00000000 r-x
003ff400-003fe400fffff000r--
003fe400-003ff400 00001000 rw-
003ff400-000f6800ffcf7400---
000f6800-000f7000 00000800 rw-It looks completely insane with weird records where the start is bigger than the end, the size is likely negative and in general all addresses are in wrong boundaries.
Found a bug in the function which textualize memory translation tables. Made a fix. Now I have the following output:
mmap: start=0x0804a000 len=0x00021000 prot=rw- flags=MAP_ANON
MAP_PRIVATEfd=0 offset=00000000 ret=0x0804a000
start end size prot
08048000-08049000 00001000 r-x
* 08049000-0806b000 00022000 rw-
f6612000-f6615000 00003000 rw-
f6615000-f67bb000001a6000r-x
f67bb000-f67bd000 00002000 r--
f67bd000-f67c2000 00005000 rw-
f67da000-f67dd000 00003000 rw-
f67dd000-f67fd000 00020000 r-x
f67fd000-f67fe000 00001000 r--
f67fe000-f67ff000 00001000 rw-
f67ff000-f6800000 00001000 ---This looks much better.
From
297045c6e7da0089c6ea4ee271000c507c5a8bf8Mon Sep 17 00:00:00 2001
From: Mikhail Ilyin <address@hidden>
Date: Wed, 23 Jul 2014 13:06:15 +0400
Subject: [PATCH] Fix a bug in debug printing of memory translation tables.Signed-off-by Mikhail Ilyin <address@hidden>--- translate-all.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)translate-all.c +1
-2@@ -1728,9 +1728,8 @@ int walk_memory_regions(void *priv, walk_memory_regions_fn fn) data.prot =0 ;for (i =0 ; i <V_L1_SIZE ; i++) { -int rc =walk_memory_regions_1 (&data, (abi_ulong )i <<V_L1_SHIFT , +int rc =walk_memory_regions_1 (&data, (abi_ulong )i << (V_L1_SHIFT +TARGET_PAGE_BITS ),V_L1_SHIFT /V_L2_BITS -1 , l1_map + i); -if (rc !=0 ) {return rc; }