Patchwork [v3,3/6] target-cris: Start QOM'ifying CPU init

login
register
mail settings
Submitter Andreas Färber
Date April 23, 2012, 2:43 p.m.
Message ID <1335192223-31188-4-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/154461/
State New
Headers show

Comments

Andreas Färber - April 23, 2012, 2:43 p.m.
Move VR-independent code from cpu_cris_init() into an initfn.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 target-cris/cpu.c       |    9 +++++++++
 target-cris/translate.c |    2 +-
 2 files changed, 10 insertions(+), 1 deletions(-)

Patch

diff --git a/target-cris/cpu.c b/target-cris/cpu.c
index 93c7e00..c596609 100644
--- a/target-cris/cpu.c
+++ b/target-cris/cpu.c
@@ -55,6 +55,14 @@  static void cris_cpu_reset(CPUState *s)
 #endif
 }
 
+static void cris_cpu_initfn(Object *obj)
+{
+    CRISCPU *cpu = CRIS_CPU(obj);
+    CPUCRISState *env = &cpu->env;
+
+    cpu_exec_init(env);
+}
+
 static void cris_cpu_class_init(ObjectClass *oc, void *data)
 {
     CPUClass *cc = CPU_CLASS(oc);
@@ -68,6 +76,7 @@  static const TypeInfo cris_cpu_type_info = {
     .name = TYPE_CRIS_CPU,
     .parent = TYPE_CPU,
     .instance_size = sizeof(CRISCPU),
+    .instance_init = cris_cpu_initfn,
     .abstract = false,
     .class_size = sizeof(CRISCPUClass),
     .class_init = cris_cpu_class_init,
diff --git a/target-cris/translate.c b/target-cris/translate.c
index d3dbac2..e353ea3 100644
--- a/target-cris/translate.c
+++ b/target-cris/translate.c
@@ -3514,7 +3514,7 @@  CPUCRISState *cpu_cris_init (const char *cpu_model)
     env = &cpu->env;
 
 	env->pregs[PR_VR] = vr_by_name(cpu_model);
-	cpu_exec_init(env);
+
     cpu_reset(CPU(cpu));
 	qemu_init_vcpu(env);