Skip to contentSkip to conversation

exec: fix breakpoint_invalidate when pc may not be translated

PATCH In review Max Filippov 2 participants 3 messages Oct 28, 2013 – Nov 7, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 exec: fix breakpoint_invalidate when pc may not be translated

This fixes qemu abort with the following message:

    include/qemu/int128.h:22: int128_get64: Assertion `!a.hi' failed.

which happens due to attempt to invalidate breakpoint by virtual address for which get_phys_page_debug couldn't find mapping.

For more details see
http://lists.nongnu.org/archive/html/qemu-devel/2013-09/msg04582.html

---
 exec.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
exec.c +4 -2
index 2e31ffc..9150430 100644
@@ -409,8 +409,10 @@ static void breakpoint_invalidate(CPUState *cpu, target_ulong pc)
 #else
 static void breakpoint_invalidate(CPUState *cpu, target_ulong pc)
 {
-    tb_invalidate_phys_addr(cpu_get_phys_page_debug(cpu, pc) |
-            (pc & ~TARGET_PAGE_MASK));
+    hwaddr phys = cpu_get_phys_page_debug(cpu, pc);
+    if (phys != -1) {
+        tb_invalidate_phys_addr(phys | (pc & ~TARGET_PAGE_MASK));
+    }
 }
 #endif
 #endif /* TARGET_HAS_ICE */
Signature · 1 line
1.8.1.4
#1 lore raw
Quoted 9 lines · Max Filippov

This fixes qemu abort with the following message:

    include/qemu/int128.h:22: int128_get64: Assertion `!a.hi' failed.

which happens due to attempt to invalidate breakpoint by virtual address for which get_phys_page_debug couldn't find mapping.

For more details see
http://lists.nongnu.org/archive/html/qemu-devel/2013-09/msg04582.html

Ping^2?

Quoted 26 lines
---
 exec.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
exec.c +4 -3
index 2e31ffc..9150430 100644
@@ -409,8 +409,10 @@ static void breakpoint_invalidate(CPUState *cpu, target_ulong pc)
 #else
 static void breakpoint_invalidate(CPUState *cpu, target_ulong pc)
 {
-    tb_invalidate_phys_addr(cpu_get_phys_page_debug(cpu, pc) |
-            (pc & ~TARGET_PAGE_MASK));
+    hwaddr phys = cpu_get_phys_page_debug(cpu, pc);
+    if (phys != -1) {
+        tb_invalidate_phys_addr(phys | (pc & ~TARGET_PAGE_MASK));
+    }
 }
 #endif
 #endif /* TARGET_HAS_ICE */
--

1.8.1.4

Signature · 2 lines
Thanks.
-- Max
Reviewed-by
#2 lore raw

Il 06/11/2013 19:23, Max Filippov ha scritto:

Quoted 5 lines · Max Filippov
Quoted 4 lines

This fixes qemu abort with the following message:

    include/qemu/int128.h:22: int128_get64: Assertion `!a.hi' failed.
Quoted 7 lines
Quoted 5 lines

which happens due to attempt to invalidate breakpoint by virtual address for which get_phys_page_debug couldn't find mapping.

For more details see
http://lists.nongnu.org/archive/html/qemu-devel/2013-09/msg04582.html

Ping^2?

Quoted 29 lines
Quoted 26 lines
---
 exec.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
exec.c +4 -3
index 2e31ffc..9150430 100644
@@ -409,8 +409,10 @@ static void breakpoint_invalidate(CPUState *cpu, target_ulong pc)
 #else
 static void breakpoint_invalidate(CPUState *cpu, target_ulong pc)
 {
-    tb_invalidate_phys_addr(cpu_get_phys_page_debug(cpu, pc) |
-            (pc & ~TARGET_PAGE_MASK));
+    hwaddr phys = cpu_get_phys_page_debug(cpu, pc);
+    if (phys != -1) {
+        tb_invalidate_phys_addr(phys | (pc & ~TARGET_PAGE_MASK));
+    }
 }
 #endif
 #endif /* TARGET_HAS_ICE */
--

1.8.1.4