summary refs log tree commit diff stats
path: root/cpu-exec.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2015-08-18 06:32:02 -0700
committerPaolo Bonzini <pbonzini@redhat.com>2015-09-09 15:34:53 +0200
commitb0a46fa796504c7334202877a68c857e49f7c96c (patch)
tree9a3d2a9c186678ac2ba8a5461326b02ca184e48c /cpu-exec.c
parentf240eb6fdcf63a5600e15fb44c6960586459a97f (diff)
downloadfocaccia-qemu-b0a46fa796504c7334202877a68c857e49f7c96c.tar.gz
focaccia-qemu-b0a46fa796504c7334202877a68c857e49f7c96c.zip
tcg: assign cpu->current_tb in a simpler place
TCG has not been reading cpu->current_tb from signal handlers for years.
The code that synchronized cpu_exec with the signal handler is not
needed anymore.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'cpu-exec.c')
-rw-r--r--cpu-exec.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/cpu-exec.c b/cpu-exec.c
index 5153f1b632..567ae8bda1 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -493,18 +493,13 @@ int cpu_exec(CPUState *cpu)
                 }
                 have_tb_lock = false;
                 spin_unlock(&tcg_ctx.tb_ctx.tb_lock);
-
-                /* cpu_interrupt might be called while translating the
-                   TB, but before it is linked into a potentially
-                   infinite loop and becomes env->current_tb. Avoid
-                   starting execution if there is a pending interrupt. */
-                cpu->current_tb = tb;
-                barrier();
                 if (likely(!cpu->exit_request)) {
                     trace_exec_tb(tb, tb->pc);
                     tc_ptr = tb->tc_ptr;
                     /* execute the generated code */
+                    cpu->current_tb = tb;
                     next_tb = cpu_tb_exec(cpu, tc_ptr);
+                    cpu->current_tb = NULL;
                     switch (next_tb & TB_EXIT_MASK) {
                     case TB_EXIT_REQUESTED:
                         /* Something asked us to stop executing
@@ -543,7 +538,6 @@ int cpu_exec(CPUState *cpu)
                         break;
                     }
                 }
-                cpu->current_tb = NULL;
                 /* Try to align the host and virtual clocks
                    if the guest is in advance */
                 align_clocks(&sc, cpu);