diff options
author | Andreas Färber <afaerber@suse.de> | 2012-04-06 14:39:03 +0200 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2012-04-15 17:10:30 +0200 |
commit | 1d0cb67da9eff798420d0f6479fec6026c4dc41f (patch) | |
tree | 845b377b6f30e926697ff441da85fe9dd60fb9dc /target-ppc/translate_init.c | |
parent | 12b1143b2807a5b760e477fac0e1028a9760b6c6 (diff) |
target-ppc: QOM'ify CPU
Embed CPUPPCState as first member of PowerPCCPU.
Distinguish between "powerpc-cpu", "powerpc64-cpu" and
"embedded-powerpc-cpu".
Let CPUClass::reset() call cpu_state_reset() for now.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'target-ppc/translate_init.c')
-rw-r--r-- | target-ppc/translate_init.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c index 067e07ea54..e4d15a59a8 100644 --- a/target-ppc/translate_init.c +++ b/target-ppc/translate_init.c @@ -10204,3 +10204,40 @@ void ppc_cpu_list (FILE *f, fprintf_function cpu_fprintf) ppc_defs[i].name, ppc_defs[i].pvr); } } + +/* CPUClass::reset() */ +static void ppc_cpu_reset(CPUState *s) +{ + PowerPCCPU *cpu = POWERPC_CPU(s); + PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu); + CPUPPCState *env = &cpu->env; + + pcc->parent_reset(s); + + cpu_state_reset(env); +} + +static void ppc_cpu_class_init(ObjectClass *oc, void *data) +{ + PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); + CPUClass *cc = CPU_CLASS(oc); + + pcc->parent_reset = cc->reset; + cc->reset = ppc_cpu_reset; +} + +static const TypeInfo ppc_cpu_type_info = { + .name = TYPE_POWERPC_CPU, + .parent = TYPE_CPU, + .instance_size = sizeof(PowerPCCPU), + .abstract = false, + .class_size = sizeof(PowerPCCPUClass), + .class_init = ppc_cpu_class_init, +}; + +static void ppc_cpu_register_types(void) +{ + type_register_static(&ppc_cpu_type_info); +} + +type_init(ppc_cpu_register_types) |