]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
translate-all: Change tb_flush() env argument to cpu
authorPeter Crosthwaite <crosthwaitepeter@gmail.com>
Wed, 24 Jun 2015 02:31:15 +0000 (19:31 -0700)
committerAndreas Färber <afaerber@suse.de>
Thu, 9 Jul 2015 13:20:40 +0000 (15:20 +0200)
All of the core-code usages of this API have the cpu pointer handy so
pass it in. There are only 3 architecture specific usages (2 of which
are commented out) which can just use ENV_GET_CPU() locally to get the
cpu pointer. The reduces core code usage of the CPU env, which brings
us closer to common-obj'ing these core files.

Cc: Riku Voipio <riku.voipio@iki.fi>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
exec.c
gdbstub.c
include/exec/exec-all.h
linux-user/signal.c
target-alpha/sys_helper.c
target-i386/translate.c
translate-all.c

diff --git a/exec.c b/exec.c
index d817e5f0250152983f2eb5788c4d3c5565f80497..b92c74d7075e2b587b15f73ecd711bdec80ccd2e 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -816,8 +816,7 @@ void cpu_single_step(CPUState *cpu, int enabled)
         } else {
             /* must flush all the translated code to avoid inconsistencies */
             /* XXX: only flush what is necessary */
-            CPUArchState *env = cpu->env_ptr;
-            tb_flush(env);
+            tb_flush(cpu);
         }
     }
 }
index cea2a847e06df72fbaa4a7b48d360f04e406b6a3..0fa8dd8352d5d0c363ebae57766b816bf1aefd54 100644 (file)
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -1226,7 +1226,6 @@ void gdb_set_stop_cpu(CPUState *cpu)
 static void gdb_vm_state_change(void *opaque, int running, RunState state)
 {
     GDBState *s = gdbserver_state;
-    CPUArchState *env = s->c_cpu->env_ptr;
     CPUState *cpu = s->c_cpu;
     char buf[256];
     const char *type;
@@ -1261,7 +1260,7 @@ static void gdb_vm_state_change(void *opaque, int running, RunState state)
             cpu->watchpoint_hit = NULL;
             goto send_packet;
         }
-        tb_flush(env);
+        tb_flush(cpu);
         ret = GDB_SIGNAL_TRAP;
         break;
     case RUN_STATE_PAUSED:
@@ -1490,7 +1489,6 @@ gdb_queuesig (void)
 int
 gdb_handlesig(CPUState *cpu, int sig)
 {
-    CPUArchState *env = cpu->env_ptr;
     GDBState *s;
     char buf[256];
     int n;
@@ -1502,7 +1500,7 @@ gdb_handlesig(CPUState *cpu, int sig)
 
     /* disable single step if it was enabled */
     cpu_single_step(cpu, 0);
-    tb_flush(env);
+    tb_flush(cpu);
 
     if (sig != 0) {
         snprintf(buf, sizeof(buf), "S%02x", target_signal_to_gdb(sig));
index 44b89551c90e0c4d4ec9439de60c174072532b37..9f74abd98ccfd3f134eb53301b6021dfb51baa92 100644 (file)
@@ -196,7 +196,7 @@ struct TBContext {
 };
 
 void tb_free(TranslationBlock *tb);
-void tb_flush(CPUArchState *env);
+void tb_flush(CPUState *cpu);
 void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr);
 
 #if defined(USE_DIRECT_JUMP)
index 1166f2fdb2188747e4d81bbf00c5cfcfe61dff4e..9d4cef409ea9e4ddccb996bd7e9fbe4a5d693c43 100644 (file)
@@ -2348,7 +2348,7 @@ static void setup_frame(int sig, struct target_sigaction *ka,
 
                /* Flush instruction space. */
                //flush_sig_insns(current->mm, (unsigned long) &(sf->insns[0]));
-                //             tb_flush(env);
+                //             tb_flush(CPU(sparc_env_get_cpu(env)));
        }
         unlock_user(sf, sf_addr, sizeof(struct target_signal_frame));
        return;
index ae2e174f32099399feff2298497ab61acf0b9d97..1c59e108b937539af9d72bd707ec067a7890f0c0 100644 (file)
@@ -74,7 +74,7 @@ void helper_tbis(CPUAlphaState *env, uint64_t p)
 
 void helper_tb_flush(CPUAlphaState *env)
 {
-    tb_flush(env);
+    tb_flush(CPU(alpha_env_get_cpu(env)));
 }
 
 void helper_halt(uint64_t restart)
index 7a1bdee2710564ef582b4be01dfaadb37d56f31d..82e2245bfdb9de30bc9f66f3132199d21b3cfa52 100644 (file)
@@ -6925,7 +6925,7 @@ static target_ulong disas_insn(CPUX86State *env, DisasContext *s,
         gen_debug(s, pc_start - s->cs_base);
 #else
         /* start debug */
-        tb_flush(env);
+        tb_flush(CPU(x86_env_get_cpu(env)));
         qemu_set_log(CPU_LOG_INT | CPU_LOG_TB_IN_ASM);
 #endif
         break;
index 50d53fdac0ac6936b5b5c83d33f8f08a624347c2..60a3d8b2bd04ceccbe1143f52d21075fbbfedd48 100644 (file)
@@ -772,10 +772,8 @@ static void page_flush_tb(void)
 
 /* flush all the translation blocks */
 /* XXX: tb_flush is currently not thread safe */
-void tb_flush(CPUArchState *env1)
+void tb_flush(CPUState *cpu)
 {
-    CPUState *cpu = ENV_GET_CPU(env1);
-
 #if defined(DEBUG_FLUSH)
     printf("qemu: flush code_size=%ld nb_tbs=%d avg_tb_size=%ld\n",
            (unsigned long)(tcg_ctx.code_gen_ptr - tcg_ctx.code_gen_buffer),
@@ -1014,7 +1012,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu,
     tb = tb_alloc(pc);
     if (!tb) {
         /* flush must be done */
-        tb_flush(env);
+        tb_flush(cpu);
         /* cannot fail at this point */
         tb = tb_alloc(pc);
         /* Don't forget to invalidate previous TB info.  */