target-m68k: Start QOM'ifying CPU init

Move model-independent code from cpu_m68k_init() into a QOM initfn.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Laurent Vivier <Laurent@Vivier.EU>
Tested-by: Laurent Vivier <Laurent@Vivier.EU>
This commit is contained in:
Andreas Färber 2012-04-15 01:10:56 +02:00
parent 11c1986817
commit 9b7060396e
2 changed files with 10 additions and 1 deletions

View File

@ -48,6 +48,14 @@ static void m68k_cpu_reset(CPUState *s)
tlb_flush(env, 1); tlb_flush(env, 1);
} }
static void m68k_cpu_initfn(Object *obj)
{
M68kCPU *cpu = M68K_CPU(obj);
CPUM68KState *env = &cpu->env;
cpu_exec_init(env);
}
static void m68k_cpu_class_init(ObjectClass *c, void *data) static void m68k_cpu_class_init(ObjectClass *c, void *data)
{ {
M68kCPUClass *mcc = M68K_CPU_CLASS(c); M68kCPUClass *mcc = M68K_CPU_CLASS(c);
@ -61,6 +69,7 @@ static const TypeInfo m68k_cpu_type_info = {
.name = TYPE_M68K_CPU, .name = TYPE_M68K_CPU,
.parent = TYPE_CPU, .parent = TYPE_CPU,
.instance_size = sizeof(M68kCPU), .instance_size = sizeof(M68kCPU),
.instance_init = m68k_cpu_initfn,
.abstract = false, .abstract = false,
.class_size = sizeof(M68kCPUClass), .class_size = sizeof(M68kCPUClass),
.class_init = m68k_cpu_class_init, .class_init = m68k_cpu_class_init,

View File

@ -156,7 +156,7 @@ CPUM68KState *cpu_m68k_init(const char *cpu_model)
cpu = M68K_CPU(object_new(TYPE_M68K_CPU)); cpu = M68K_CPU(object_new(TYPE_M68K_CPU));
env = &cpu->env; env = &cpu->env;
cpu_exec_init(env);
if (!inited) { if (!inited) {
inited = 1; inited = 1;
m68k_tcg_init(); m68k_tcg_init();