diff mbox

[v2,2/2] tcg: Set jmp_env for exceptions from atomic execution

Message ID 20170210184525.10966-3-bobby.prani@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Pranith Kumar Feb. 10, 2017, 6:45 p.m. UTC
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 <alex.bennee@linaro.org>
CC: Richard Henderson <rth@twiddle.net>
CC: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
---
 cpu-exec.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
diff mbox

Patch

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