Skip to contentSkip to conversation

memory: fix 128 arithmetic in info mtree

PATCH Applied Alexey Kardashevskiy 2 participants 4 messages Aug 30, 2013 – Sep 25, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 memory: fix 128 arithmetic in info mtree

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().

---
 memory.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
memory.c +3 -1
index ffedde7..93f2995 100644
@@ -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",
Signature · 1 line
1.8.4.rc4
#1 lore raw
Quoted 16 lines · Alexey Kardashevskiy

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().

---
 memory.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
memory.c +0 -0
index ffedde7..93f2995 100644

memory.c static void mtree_print_mr(fprintf_function mon_printf, void *f, · line 1824

Quoted 10 lines
memory.c +3 -1
@@ -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?

Signature · 1 line
Alexey
#2 lore raw
Quoted 22 lines · Alexey Kardashevskiy
Quoted 21 lines · Alexey Kardashevskiy

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().

---
 memory.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
memory.c +2 -1
index ffedde7..93f2995 100644
@@ -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,
Quoted 8 lines

memory.c static void mtree_print_mr(fprintf_function mon_printf, void *f, · line 1824

Quoted 5 lines
memory.c +1 -0
+                                                      int128_one())) : 0));
     } else {
         mon_printf(f,
                    TARGET_FMT_plx "-" TARGET_FMT_plx " (prio %d, %c%c): %s\n",

Ping?

Ping?

Signature · 1 line
Alexey
#3 lore raw
In reply to Alexey Kardashevskiy

Il 30/08/2013 10:10, Alexey Kardashevskiy ha scritto:

Quoted 16 lines

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().

---
 memory.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
memory.c +0 -0
index ffedde7..93f2995 100644

memory.c static void mtree_print_mr(fprintf_function mon_printf, void *f, · line 1824

Quoted 10 lines
memory.c +3 -1
@@ -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",

Applied to my iommu branch, which I should eventually rename. :)

Thanks,

Paolo