Patchwork [20/47] target-m68k: Move TCG initialization to M68kCPU initfn

login
register
mail settings
Submitter Andreas Färber
Date Feb. 16, 2013, 3:45 p.m.
Message ID <1361029542-8412-21-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/220984/
State New
Headers show

Comments

Andreas Färber - Feb. 16, 2013, 3:45 p.m.
Add a tcg_enabled() check to suppress it for qtest.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 target-m68k/cpu.c    |    6 ++++++
 target-m68k/helper.c |    7 -------
 2 Dateien geändert, 6 Zeilen hinzugefügt(+), 7 Zeilen entfernt(-)

Patch

diff --git a/target-m68k/cpu.c b/target-m68k/cpu.c
index e3eaffc..42735db 100644
--- a/target-m68k/cpu.c
+++ b/target-m68k/cpu.c
@@ -156,8 +156,14 @@  static void m68k_cpu_initfn(Object *obj)
 {
     M68kCPU *cpu = M68K_CPU(obj);
     CPUM68KState *env = &cpu->env;
+    static bool inited;
 
     cpu_exec_init(env);
+
+    if (tcg_enabled() && !inited) {
+        inited = true;
+        m68k_tcg_init();
+    }
 }
 
 static const VMStateDescription vmstate_m68k_cpu = {
diff --git a/target-m68k/helper.c b/target-m68k/helper.c
index 3ae6fa0..6030807 100644
--- a/target-m68k/helper.c
+++ b/target-m68k/helper.c
@@ -103,7 +103,6 @@  CPUM68KState *cpu_m68k_init(const char *cpu_model)
     M68kCPU *cpu;
     CPUM68KState *env;
     ObjectClass *oc;
-    static int inited;
 
     oc = cpu_class_by_name(TYPE_M68K_CPU, cpu_model);
     if (oc == NULL) {
@@ -111,12 +110,6 @@  CPUM68KState *cpu_m68k_init(const char *cpu_model)
     }
     cpu = M68K_CPU(object_new(object_class_get_name(oc)));
     env = &cpu->env;
-
-    if (!inited) {
-        inited = 1;
-        m68k_tcg_init();
-    }
-
     env->cpu_model_str = cpu_model;
 
     register_m68k_insns(env);