From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56922) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VJFRW-0002SZ-8f for qemu-devel@nongnu.org; Tue, 10 Sep 2013 00:20:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VJFRQ-0005SQ-3O for qemu-devel@nongnu.org; Tue, 10 Sep 2013 00:20:46 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:44769) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VJFRP-0005SI-GL for qemu-devel@nongnu.org; Tue, 10 Sep 2013 00:20:39 -0400 Received: by mail-pa0-f49.google.com with SMTP id ld10so7149160pab.36 for ; Mon, 09 Sep 2013 21:20:38 -0700 (PDT) Message-ID: <522E9DE0.8020508@ozlabs.ru> Date: Tue, 10 Sep 2013 14:19:44 +1000 From: Alexey Kardashevskiy MIME-Version: 1.0 References: <1377850238-10270-1-git-send-email-aik@ozlabs.ru> In-Reply-To: <1377850238-10270-1-git-send-email-aik@ozlabs.ru> Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] memory: fix 128 arithmetic in info mtree List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy Cc: Paolo Bonzini , qemu-devel@nongnu.org On 08/30/2013 06:10 PM, Alexey Kardashevskiy wrote: > mtree_print_mr() calls int128_get64() in 3 places but only 2 places > handle 2^64 correctly. > > This fixes the third call of int128_get64(). > > Signed-off-by: Alexey Kardashevskiy > --- > memory.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/memory.c b/memory.c > index ffedde7..93f2995 100644 > --- a/memory.c > +++ b/memory.c > @@ -1816,7 +1816,9 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f, > mr->alias->name, > mr->alias_offset, > mr->alias_offset > - + (hwaddr)int128_get64(mr->size) - 1); > + + (int128_nz(mr->size) ? > + (hwaddr)int128_get64(int128_sub(mr->size, > + int128_one())) : 0)); > } else { > mon_printf(f, > TARGET_FMT_plx "-" TARGET_FMT_plx " (prio %d, %c%c): %s\n", > Ping? -- Alexey