Patchwork [RFC,qom-cpu,08/15] target-m68k: Introduce QOM realizefn for M68kCPU

login
register
mail settings
Submitter Andreas Färber
Date Jan. 16, 2013, 5:32 a.m.
Message ID <1358314380-9400-9-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/212416/
State New
Headers show

Comments

Andreas Färber - Jan. 16, 2013, 5:32 a.m.
Introduce realizefn and set realized = true in cpu_m68k_init().

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

Patch

diff --git a/target-m68k/cpu.c b/target-m68k/cpu.c
index ce89674..633fcc7 100644
--- a/target-m68k/cpu.c
+++ b/target-m68k/cpu.c
@@ -119,6 +119,14 @@  static const M68kCPUInfo m68k_cpus[] = {
     { .name = "any",   .instance_init = any_cpu_initfn },
 };
 
+static void m68k_cpu_realizefn(DeviceState *dev, Error **errp)
+{
+    M68kCPU *cpu = M68K_CPU(dev);
+
+    cpu_reset(CPU(cpu));
+    qemu_init_vcpu(&cpu->env);
+}
+
 static void m68k_cpu_initfn(Object *obj)
 {
     M68kCPU *cpu = M68K_CPU(obj);
@@ -131,6 +139,9 @@  static void m68k_cpu_class_init(ObjectClass *c, void *data)
 {
     M68kCPUClass *mcc = M68K_CPU_CLASS(c);
     CPUClass *cc = CPU_CLASS(c);
+    DeviceClass *dc = DEVICE_CLASS(c);
+
+    dc->realize = m68k_cpu_realizefn;
 
     mcc->parent_reset = cc->reset;
     cc->reset = m68k_cpu_reset;
diff --git a/target-m68k/helper.c b/target-m68k/helper.c
index 097fc78..14b399a 100644
--- a/target-m68k/helper.c
+++ b/target-m68k/helper.c
@@ -119,8 +119,7 @@  CPUM68KState *cpu_m68k_init(const char *cpu_model)
     }
     /* TODO: Add [E]MAC registers.  */
 
-    cpu_reset(ENV_GET_CPU(env));
-    qemu_init_vcpu(env);
+    object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
     return env;
 }