aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--target-m68k/cpu.c9
-rw-r--r--target-m68k/helper.c2
2 files changed, 10 insertions, 1 deletions
diff --git a/target-m68k/cpu.c b/target-m68k/cpu.c
index e599ece..0bb1b2c 100644
--- a/target-m68k/cpu.c
+++ b/target-m68k/cpu.c
@@ -48,6 +48,14 @@ static void m68k_cpu_reset(CPUState *s)
tlb_flush(env, 1);
}
+static void m68k_cpu_initfn(Object *obj)
+{
+ M68kCPU *cpu = M68K_CPU(obj);
+ CPUM68KState *env = &cpu->env;
+
+ cpu_exec_init(env);
+}
+
static void m68k_cpu_class_init(ObjectClass *c, void *data)
{
M68kCPUClass *mcc = M68K_CPU_CLASS(c);
@@ -61,6 +69,7 @@ static const TypeInfo m68k_cpu_type_info = {
.name = TYPE_M68K_CPU,
.parent = TYPE_CPU,
.instance_size = sizeof(M68kCPU),
+ .instance_init = m68k_cpu_initfn,
.abstract = false,
.class_size = sizeof(M68kCPUClass),
.class_init = m68k_cpu_class_init,
diff --git a/target-m68k/helper.c b/target-m68k/helper.c
index 69fb147..e850d53 100644
--- a/target-m68k/helper.c
+++ b/target-m68k/helper.c
@@ -156,7 +156,7 @@ CPUM68KState *cpu_m68k_init(const char *cpu_model)
cpu = M68K_CPU(object_new(TYPE_M68K_CPU));
env = &cpu->env;
- cpu_exec_init(env);
+
if (!inited) {
inited = 1;
m68k_tcg_init();