mirror of https://gitee.com/openkylin/qemu.git
target-microblaze: Introduce QOM realizefn for MicroBlazeCPU
Introduce realizefn and set realized = true from cpu_mb_init(). Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
6d1bbc6273
commit
746b03b27c
|
@ -33,6 +33,7 @@
|
|||
|
||||
/**
|
||||
* MicroBlazeCPUClass:
|
||||
* @parent_realize: The parent class' realize handler.
|
||||
* @parent_reset: The parent class' reset handler.
|
||||
*
|
||||
* A MicroBlaze CPU model.
|
||||
|
@ -42,6 +43,7 @@ typedef struct MicroBlazeCPUClass {
|
|||
CPUClass parent_class;
|
||||
/*< public >*/
|
||||
|
||||
DeviceRealize parent_realize;
|
||||
void (*parent_reset)(CPUState *cpu);
|
||||
} MicroBlazeCPUClass;
|
||||
|
||||
|
|
|
@ -85,6 +85,17 @@ static void mb_cpu_reset(CPUState *s)
|
|||
#endif
|
||||
}
|
||||
|
||||
static void mb_cpu_realizefn(DeviceState *dev, Error **errp)
|
||||
{
|
||||
MicroBlazeCPU *cpu = MICROBLAZE_CPU(dev);
|
||||
MicroBlazeCPUClass *mcc = MICROBLAZE_CPU_GET_CLASS(dev);
|
||||
|
||||
cpu_reset(CPU(cpu));
|
||||
qemu_init_vcpu(&cpu->env);
|
||||
|
||||
mcc->parent_realize(dev, errp);
|
||||
}
|
||||
|
||||
static void mb_cpu_initfn(Object *obj)
|
||||
{
|
||||
MicroBlazeCPU *cpu = MICROBLAZE_CPU(obj);
|
||||
|
@ -106,6 +117,9 @@ static void mb_cpu_class_init(ObjectClass *oc, void *data)
|
|||
CPUClass *cc = CPU_CLASS(oc);
|
||||
MicroBlazeCPUClass *mcc = MICROBLAZE_CPU_CLASS(oc);
|
||||
|
||||
mcc->parent_realize = dc->realize;
|
||||
dc->realize = mb_cpu_realizefn;
|
||||
|
||||
mcc->parent_reset = cc->reset;
|
||||
cc->reset = mb_cpu_reset;
|
||||
|
||||
|
|
|
@ -1970,8 +1970,7 @@ MicroBlazeCPU *cpu_mb_init(const char *cpu_model)
|
|||
|
||||
cpu = MICROBLAZE_CPU(object_new(TYPE_MICROBLAZE_CPU));
|
||||
|
||||
cpu_reset(CPU(cpu));
|
||||
qemu_init_vcpu(&cpu->env);
|
||||
object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
|
||||
|
||||
if (tcg_initialized) {
|
||||
return cpu;
|
||||
|
|
Loading…
Reference in New Issue