]> Git Repo - qemu.git/commitdiff
memory: Fix zero-sized memory region print
authorAlex Williamson <[email protected]>
Fri, 19 Jul 2013 18:42:12 +0000 (12:42 -0600)
committerAnthony Liguori <[email protected]>
Mon, 22 Jul 2013 20:40:41 +0000 (15:40 -0500)
if mr->size == 0, then

int128_get64(int128_sub(mr->size, int128_make64(1))) => assert(!a.hi)

Also, use int128_one().

Signed-off-by: Alex Williamson <[email protected]>
Reviewed-by: Paolo Bonzini <[email protected]>
Message-id: 20130719184124[email protected]
Signed-off-by: Anthony Liguori <[email protected]>
memory.c

index 34a088e90f4cb745e6fd462c6fc9b14bc6b25f41..01846c97682b7388f466b61ae7d88bc7876ae175 100644 (file)
--- a/memory.c
+++ b/memory.c
@@ -1787,7 +1787,9 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f,
                    "-" TARGET_FMT_plx "\n",
                    base + mr->addr,
                    base + mr->addr
                    "-" TARGET_FMT_plx "\n",
                    base + mr->addr,
                    base + mr->addr
-                   + (hwaddr)int128_get64(int128_sub(mr->size, int128_make64(1))),
+                   + (int128_nz(mr->size) ?
+                      (hwaddr)int128_get64(int128_sub(mr->size,
+                                                      int128_one())) : 0),
                    mr->priority,
                    mr->romd_mode ? 'R' : '-',
                    !mr->readonly && !(mr->rom_device && mr->romd_mode) ? 'W'
                    mr->priority,
                    mr->romd_mode ? 'R' : '-',
                    !mr->readonly && !(mr->rom_device && mr->romd_mode) ? 'W'
@@ -1802,7 +1804,9 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f,
                    TARGET_FMT_plx "-" TARGET_FMT_plx " (prio %d, %c%c): %s\n",
                    base + mr->addr,
                    base + mr->addr
                    TARGET_FMT_plx "-" TARGET_FMT_plx " (prio %d, %c%c): %s\n",
                    base + mr->addr,
                    base + mr->addr
-                   + (hwaddr)int128_get64(int128_sub(mr->size, int128_make64(1))),
+                   + (int128_nz(mr->size) ?
+                      (hwaddr)int128_get64(int128_sub(mr->size,
+                                                      int128_one())) : 0),
                    mr->priority,
                    mr->romd_mode ? 'R' : '-',
                    !mr->readonly && !(mr->rom_device && mr->romd_mode) ? 'W'
                    mr->priority,
                    mr->romd_mode ? 'R' : '-',
                    !mr->readonly && !(mr->rom_device && mr->romd_mode) ? 'W'
This page took 0.028248 seconds and 4 git commands to generate.