target-mips: Start QOM'ifying CPU init
authorAndreas Färber <afaerber@suse.de>
Mon, 16 Apr 2012 00:37:56 +0000 (02:37 +0200)
committerAndreas Färber <afaerber@suse.de>
Mon, 30 Apr 2012 09:32:13 +0000 (11:32 +0200)
Move code not dependent on mips_def_t from cpu_mips_init() into a
QOM initfn, as a start.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Richard Henderson <rth@twiddle.net>
target-mips/cpu.c
target-mips/translate.c

index d573ec8be8e06d2f5631321c839ee5cabd7e156e..004406232bda7fba3e1c98dd974b0feb2ea5ce90 100644 (file)
@@ -34,6 +34,14 @@ static void mips_cpu_reset(CPUState *s)
     cpu_state_reset(env);
 }
 
+static void mips_cpu_initfn(Object *obj)
+{
+    MIPSCPU *cpu = MIPS_CPU(obj);
+    CPUMIPSState *env = &cpu->env;
+
+    cpu_exec_init(env);
+}
+
 static void mips_cpu_class_init(ObjectClass *c, void *data)
 {
     MIPSCPUClass *mcc = MIPS_CPU_CLASS(c);
@@ -47,6 +55,7 @@ static const TypeInfo mips_cpu_type_info = {
     .name = TYPE_MIPS_CPU,
     .parent = TYPE_CPU,
     .instance_size = sizeof(MIPSCPU),
+    .instance_init = mips_cpu_initfn,
     .abstract = false,
     .class_size = sizeof(MIPSCPUClass),
     .class_init = mips_cpu_class_init,
index b10ec2196a845cea90d49d36a2ee8fd4235436e3..f5297b039200cf583821f162ccef3a298dbacad6 100644 (file)
@@ -12703,7 +12703,6 @@ CPUMIPSState *cpu_mips_init (const char *cpu_model)
     env->cpu_model = def;
     env->cpu_model_str = cpu_model;
 
-    cpu_exec_init(env);
 #ifndef CONFIG_USER_ONLY
     mmu_init(env, def);
 #endif