qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v2 2/2] tcg: Set jmp_env for exceptions from atomic


From: Pranith Kumar
Subject: [Qemu-devel] [PATCH v2 2/2] tcg: Set jmp_env for exceptions from atomic execution
Date: Fri, 10 Feb 2017 13:45:25 -0500

The current method of executing atomic code in a guest uses
cpu_exec_step_atomic() from the outermost loop. This causes an abort()
when single stepping over atomic code since debug exception longjmp
will point to the the setlongjmp in cpu_exec(). Properly set jmp_env
so that it jumps back here on an exception.

CC: Alex Bennée <address@hidden>
CC: Richard Henderson <address@hidden>
CC: Paolo Bonzini <address@hidden>
Signed-off-by: Pranith Kumar <address@hidden>
---
 cpu-exec.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/cpu-exec.c b/cpu-exec.c
index 9200c643c2..e61f5747c8 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -242,9 +242,12 @@ static void cpu_exec_step(CPUState *cpu)
     tb_unlock();
 
     cc->cpu_exec_enter(cpu);
-    /* execute the generated code */
-    trace_exec_tb_nocache(tb, pc);
-    cpu_tb_exec(cpu, tb);
+
+    if (sigsetjmp(cpu->jmp_env, 0) == 0) {
+        /* execute the generated code */
+        trace_exec_tb_nocache(tb, pc);
+        cpu_tb_exec(cpu, tb);
+    }
 
     cc->cpu_exec_exit(cpu);
     tb_lock();
-- 
2.11.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]