Patchwork exec: Fix walk_memory_regions

login
register
mail settings
Submitter Toshiki Iwata
Date Oct. 2, 2012, 7:01 p.m.
Message ID <10B06A0D-B4A8-4610-91C3-15211D739D5E@ybb.ne.jp>
Download mbox | patch
Permalink /patch/188620/
State New
Headers show

Comments

Toshiki Iwata - Oct. 2, 2012, 7:01 p.m.
This patch fixes strange output of page_dump.

Signed-off-by: Toshiki Iwata <iwata_ppc@ybb.ne.jp>
---
Example(in the case of TARGET_PAGE_BITS=12)
[Before]
start    end      size     prot
00000000-00001000 00001000 ---
00001000-00002000 00001000 r-x
00002000-00003000 00001000 rw-
00003000-00004000 00001000 r--
00040000-00041800 00001800 rw- <-- strange
[After]
start    end      size     prot
00000000-00001000 00001000 ---
00001000-00002000 00001000 r-x
00002000-00003000 00001000 rw-
00003000-00004000 00001000 r--
40000000-40801000 00801000 rw- <-- right

exec.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

+                                V_L1_SHIFT / L2_BITS - 1, l1_map + i);
         if (rc != 0) {
             return rc;
         }

Patch

diff --git a/exec.c b/exec.c
index bb6aa4a..ced8231 100644
--- a/exec.c
+++ b/exec.c
@@ -1991,8 +1991,9 @@  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,
-                                       V_L1_SHIFT / L2_BITS - 1,  
l1_map + i);
+        int rc = walk_memory_regions_1(&data,
+                                (abi_ulong)i << (TARGET_PAGE_BITS +  
V_L1_SHIFT),