aboutsummaryrefslogtreecommitdiff
path: root/target-sh4
diff options
context:
space:
mode:
Diffstat (limited to 'target-sh4')
-rw-r--r--target-sh4/cpu.c11
-rw-r--r--target-sh4/translate.c2
2 files changed, 11 insertions, 2 deletions
diff --git a/target-sh4/cpu.c b/target-sh4/cpu.c
index 84d46728aa..a1a177fa88 100644
--- a/target-sh4/cpu.c
+++ b/target-sh4/cpu.c
@@ -53,6 +53,16 @@ static void superh_cpu_reset(CPUState *s)
set_default_nan_mode(1, &env->fp_status);
}
+static void superh_cpu_initfn(Object *obj)
+{
+ SuperHCPU *cpu = SUPERH_CPU(obj);
+ CPUSH4State *env = &cpu->env;
+
+ cpu_exec_init(env);
+
+ env->movcal_backup_tail = &(env->movcal_backup);
+}
+
static void superh_cpu_class_init(ObjectClass *oc, void *data)
{
CPUClass *cc = CPU_CLASS(oc);
@@ -66,6 +76,7 @@ static const TypeInfo superh_cpu_type_info = {
.name = TYPE_SUPERH_CPU,
.parent = TYPE_CPU,
.instance_size = sizeof(SuperHCPU),
+ .instance_init = superh_cpu_initfn,
.abstract = false,
.class_size = sizeof(SuperHCPUClass),
.class_init = superh_cpu_class_init,
diff --git a/target-sh4/translate.c b/target-sh4/translate.c
index d0568e2964..d25f0c5a29 100644
--- a/target-sh4/translate.c
+++ b/target-sh4/translate.c
@@ -259,8 +259,6 @@ CPUSH4State *cpu_sh4_init(const char *cpu_model)
cpu = SUPERH_CPU(object_new(TYPE_SUPERH_CPU));
env = &cpu->env;
env->features = def->features;
- cpu_exec_init(env);
- env->movcal_backup_tail = &(env->movcal_backup);
sh4_translate_init();
env->cpu_model_str = cpu_model;
cpu_reset(CPU(cpu));