From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56315) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEXUR-0001PZ-EM for qemu-devel@nongnu.org; Tue, 05 Aug 2014 01:40:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XEXUJ-0005UK-TE for qemu-devel@nongnu.org; Tue, 05 Aug 2014 01:40:51 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:56733) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEXUJ-0005Rx-NS for qemu-devel@nongnu.org; Tue, 05 Aug 2014 01:40:43 -0400 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N9T007AMJRRVC40@mailout3.w1.samsung.com> for qemu-devel@nongnu.org; Tue, 05 Aug 2014 06:40:39 +0100 (BST) Message-id: <53E06E57.2000209@samsung.com> Date: Tue, 05 Aug 2014 09:40:39 +0400 From: Mikhail Ilin MIME-version: 1.0 Content-type: text/plain; charset=utf-8; format=flowed Content-transfer-encoding: 7bit Subject: [Qemu-devel] Fix a bug in debug printing of memory translation tables List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, pbonzini@redhat.com, mst@redhat.com, afaerber@suse.de, rth@twiddle.net 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 > 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 > --- > 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; > } >