mirror of https://github.com/xemu-project/xemu.git
target-mips: Introduce QOM realizefn for MIPSCPU
Introduce a realizefn and set realized = true from cpu_mips_init(). Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
746b03b27c
commit
c1caf1d961
|
@ -37,6 +37,7 @@
|
|||
|
||||
/**
|
||||
* MIPSCPUClass:
|
||||
* @parent_realize: The parent class' realize handler.
|
||||
* @parent_reset: The parent class' reset handler.
|
||||
*
|
||||
* A MIPS CPU model.
|
||||
|
@ -46,6 +47,7 @@ typedef struct MIPSCPUClass {
|
|||
CPUClass parent_class;
|
||||
/*< public >*/
|
||||
|
||||
DeviceRealize parent_realize;
|
||||
void (*parent_reset)(CPUState *cpu);
|
||||
} MIPSCPUClass;
|
||||
|
||||
|
|
|
@ -42,6 +42,17 @@ static void mips_cpu_reset(CPUState *s)
|
|||
cpu_state_reset(env);
|
||||
}
|
||||
|
||||
static void mips_cpu_realizefn(DeviceState *dev, Error **errp)
|
||||
{
|
||||
MIPSCPU *cpu = MIPS_CPU(dev);
|
||||
MIPSCPUClass *mcc = MIPS_CPU_GET_CLASS(dev);
|
||||
|
||||
cpu_reset(CPU(cpu));
|
||||
qemu_init_vcpu(&cpu->env);
|
||||
|
||||
mcc->parent_realize(dev, errp);
|
||||
}
|
||||
|
||||
static void mips_cpu_initfn(Object *obj)
|
||||
{
|
||||
MIPSCPU *cpu = MIPS_CPU(obj);
|
||||
|
@ -54,6 +65,10 @@ static void mips_cpu_class_init(ObjectClass *c, void *data)
|
|||
{
|
||||
MIPSCPUClass *mcc = MIPS_CPU_CLASS(c);
|
||||
CPUClass *cc = CPU_CLASS(c);
|
||||
DeviceClass *dc = DEVICE_CLASS(c);
|
||||
|
||||
mcc->parent_realize = dc->realize;
|
||||
dc->realize = mips_cpu_realizefn;
|
||||
|
||||
mcc->parent_reset = cc->reset;
|
||||
cc->reset = mips_cpu_reset;
|
||||
|
|
|
@ -15916,8 +15916,9 @@ MIPSCPU *cpu_mips_init(const char *cpu_model)
|
|||
fpu_init(env, def);
|
||||
mvp_init(env, def);
|
||||
mips_tcg_init();
|
||||
cpu_reset(CPU(cpu));
|
||||
qemu_init_vcpu(env);
|
||||
|
||||
object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
|
||||
|
||||
return cpu;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue