qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] Fix a bug in debug printing of memory translation tables


From: Mikhail Ilin
Subject: [Qemu-devel] Fix a bug in debug printing of memory translation tables
Date: Tue, 05 Aug 2014 09:40:39 +0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0

ping

http://patchwork.ozlabs.org/patch/372865/

On 23.07.2014 14:44, Mikhail Ilin wrote:
> Hi,
>
> I've enabled DEBUG_MMAP in linux-user/mmap.c and 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_PRIVATE fd=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-003f6400 ffff7000 rw-
>   003fe400-003ff400 00001000 rw-
>   003ff400-003ff400 00000000 r-x
>   003ff400-003fe400 fffff000 r--
>   003fe400-003ff400 00001000 rw-
>   003ff400-000f6800 ffcf7400 ---
>   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_PRIVATE fd=0 offset=00000000
> ret=0x0804a000
>   start    end      size     prot
>   08048000-08049000 00001000 r-x
> * 08049000-0806b000 00022000 rw-
>   f6612000-f6615000 00003000 rw-
>   f6615000-f67bb000 001a6000 r-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 297045c6e7da0089c6ea4ee271000c507c5a8bf8 Mon 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(-)
>
> diff --git a/translate-all.c b/translate-all.c
> index 8f7e11b..cb7a33d 100644
> --- a/translate-all.c
> +++ b/translate-all.c
> @@ -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;
>          }
>



reply via email to

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