diff mbox

[RFC,v2,7/8] target-arm: Prepare model-specific class_init function

Message ID 1328101045-10717-8-git-send-email-afaerber@suse.de
State New
Headers show

Commit Message

Andreas Färber Feb. 1, 2012, 12:57 p.m. UTC
This allows to share initialization between CPU models.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 target-arm/cpu-core.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/target-arm/cpu-core.c b/target-arm/cpu-core.c
index 1caf9aa..8284418 100644
--- a/target-arm/cpu-core.c
+++ b/target-arm/cpu-core.c
@@ -21,6 +21,7 @@  typedef struct ARMCPUInfo {
     const char *name;
     const char *alias;
     uint32_t id;
+    void (*class_init)(ARMCPUClass *klass, const struct ARMCPUInfo *info);
 } ARMCPUInfo;
 
 static const ARMCPUInfo arm_cpus[] = {
@@ -156,6 +157,10 @@  static void arm_cpu_class_init(ObjectClass *klass, void *data)
     cpu_class->reset = arm_cpu_reset;
 
     k->id = info->id;
+
+    if (info->class_init != NULL) {
+        (*info->class_init)(k, info);
+    }
 }
 
 static void cpu_register(const ARMCPUInfo *info)