target-microblaze: QOM'ify CPU init

Move code from cpu_mb_init() to a QOM initfn.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Tested-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
[AF: Leave cpu_reset() call in cpu_mb_init()]
This commit is contained in:
Andreas Färber 2012-04-12 02:34:40 +02:00 committed by Edgar E. Iglesias
parent 61b6208f8e
commit d0e71ef56f
2 changed files with 11 additions and 2 deletions

View File

@ -83,6 +83,16 @@ static void mb_cpu_reset(CPUState *s)
#endif
}
static void mb_cpu_initfn(Object *obj)
{
MicroBlazeCPU *cpu = MICROBLAZE_CPU(obj);
CPUMBState *env = &cpu->env;
cpu_exec_init(env);
set_float_rounding_mode(float_round_nearest_even, &env->fp_status);
}
static void mb_cpu_class_init(ObjectClass *oc, void *data)
{
CPUClass *cc = CPU_CLASS(oc);
@ -96,6 +106,7 @@ static const TypeInfo mb_cpu_type_info = {
.name = TYPE_MICROBLAZE_CPU,
.parent = TYPE_CPU,
.instance_size = sizeof(MicroBlazeCPU),
.instance_init = mb_cpu_initfn,
.class_size = sizeof(MicroBlazeCPUClass),
.class_init = mb_cpu_class_init,
};

View File

@ -1899,10 +1899,8 @@ CPUMBState *cpu_mb_init (const char *cpu_model)
cpu = MICROBLAZE_CPU(object_new(TYPE_MICROBLAZE_CPU));
env = &cpu->env;
cpu_exec_init(env);
cpu_reset(CPU(cpu));
qemu_init_vcpu(env);
set_float_rounding_mode(float_round_nearest_even, &env->fp_status);
if (tcg_initialized)
return env;