[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH RFC 8/7] target-arm: Use IoC for CPU init
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PATCH RFC 8/7] target-arm: Use IoC for CPU init |
Date: |
Mon, 30 Jan 2012 00:50:28 +0100 |
Instead of having each CPU's class_init function call its parent's
function, indirect this through arm_cpu_class_init().
Signed-off-by: Andreas Färber <address@hidden>
---
target-arm/cpu-core.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/target-arm/cpu-core.c b/target-arm/cpu-core.c
index b1ac22c..cdd049e 100644
--- a/target-arm/cpu-core.c
+++ b/target-arm/cpu-core.c
@@ -246,6 +246,13 @@ static void arm_cpu_realize(Object *obj)
cpu->env.cp15.c0_cpuid = cpu_class->id;
}
+static void arm_cpu_class_init(ObjectClass *klass, void *data)
+{
+ const struct ARMCPUDef *d = data;
+
+ (*d->class_init)(klass, NULL);
+}
+
static void cpu_register(const struct ARMCPUDef *def)
{
TypeInfo type = {
@@ -254,7 +261,8 @@ static void cpu_register(const struct ARMCPUDef *def)
.instance_size = sizeof(ARMCPU),
.instance_init = arm_cpu_realize,
.class_size = sizeof(ARMCPUClass),
- .class_init = def->class_init,
+ .class_init = arm_cpu_class_init,
+ .class_data = (void *)def,
};
type_register_static(&type);
--
1.7.7
- Re: [Qemu-devel] [PATCH RFC 4/7] qom: Introduce CPU class, (continued)