Patchwork [RFC,qom-cpu,v2,25/28] target-sh4: Move TCG initialization to SuperHCPU initfn

login
register
mail settings
Submitter Andreas Färber
Date Jan. 20, 2013, 7:22 a.m.
Message ID <1358666571-1737-26-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/213927/
State New
Headers show

Comments

Andreas Färber - Jan. 20, 2013, 7:22 a.m.
Add a tcg_enabled() check to suppress it for qtest.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 target-sh4/cpu.c       |    4 ++++
 target-sh4/cpu.h       |    1 +
 target-sh4/translate.c |    3 +--
 3 Dateien geändert, 6 Zeilen hinzugefügt(+), 2 Zeilen entfernt(-)

Patch

diff --git a/target-sh4/cpu.c b/target-sh4/cpu.c
index 839696c..223008a 100644
--- a/target-sh4/cpu.c
+++ b/target-sh4/cpu.c
@@ -72,6 +72,10 @@  static void superh_cpu_initfn(Object *obj)
     cpu_exec_init(env);
 
     env->movcal_backup_tail = &(env->movcal_backup);
+
+    if (tcg_enabled()) {
+        sh4_translate_init();
+    }
 }
 
 static void superh_cpu_class_init(ObjectClass *oc, void *data)
diff --git a/target-sh4/cpu.h b/target-sh4/cpu.h
index 34e9b0a..49dcd9e 100644
--- a/target-sh4/cpu.h
+++ b/target-sh4/cpu.h
@@ -191,6 +191,7 @@  typedef struct CPUSH4State {
 
 #include "cpu-qom.h"
 
+void sh4_translate_init(void);
 SuperHCPU *cpu_sh4_init(const char *cpu_model);
 int cpu_sh4_exec(CPUSH4State * s);
 int cpu_sh4_signal_handler(int host_signum, void *pinfo,
diff --git a/target-sh4/translate.c b/target-sh4/translate.c
index 2409a10..c58d79a 100644
--- a/target-sh4/translate.c
+++ b/target-sh4/translate.c
@@ -71,7 +71,7 @@  static uint32_t gen_opc_hflags[OPC_BUF_SIZE];
 
 #include "exec/gen-icount.h"
 
-static void sh4_translate_init(void)
+void sh4_translate_init(void)
 {
     int i;
     static int done_init = 0;
@@ -251,7 +251,6 @@  SuperHCPU *cpu_sh4_init(const char *cpu_model)
     cpu = SUPERH_CPU(object_new(TYPE_SUPERH_CPU));
     env = &cpu->env;
     env->features = def->features;
-    sh4_translate_init();
     env->cpu_model_str = cpu_model;
     cpu_register(env, def);