mirror of
https://github.com/qemu/qemu.git
synced 2024-11-24 19:33:39 +08:00
target-unicore32: Introduce QOM realizefn for UniCore32CPU
Introduce a realizefn and set realized = true in uc32_cpu_init(). Acked-by: Guan Xuetao <gxt@mprc.pku.edu.cn> [AF: Invoke the parent's realizefn] Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
b6e91ebfe0
commit
088383e322
@ -25,6 +25,7 @@
|
||||
|
||||
/**
|
||||
* UniCore32CPUClass:
|
||||
* @parent_realize: The parent class' realize handler.
|
||||
*
|
||||
* A UniCore32 CPU model.
|
||||
*/
|
||||
@ -32,6 +33,8 @@ typedef struct UniCore32CPUClass {
|
||||
/*< private >*/
|
||||
CPUClass parent_class;
|
||||
/*< public >*/
|
||||
|
||||
DeviceRealize parent_realize;
|
||||
} UniCore32CPUClass;
|
||||
|
||||
/**
|
||||
|
@ -81,6 +81,16 @@ static const UniCore32CPUInfo uc32_cpus[] = {
|
||||
{ .name = "any", .instance_init = uc32_any_cpu_initfn },
|
||||
};
|
||||
|
||||
static void uc32_cpu_realizefn(DeviceState *dev, Error **errp)
|
||||
{
|
||||
UniCore32CPU *cpu = UNICORE32_CPU(dev);
|
||||
UniCore32CPUClass *ucc = UNICORE32_CPU_GET_CLASS(dev);
|
||||
|
||||
qemu_init_vcpu(&cpu->env);
|
||||
|
||||
ucc->parent_realize(dev, errp);
|
||||
}
|
||||
|
||||
static void uc32_cpu_initfn(Object *obj)
|
||||
{
|
||||
UniCore32CPU *cpu = UNICORE32_CPU(obj);
|
||||
@ -108,6 +118,10 @@ static void uc32_cpu_class_init(ObjectClass *oc, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(oc);
|
||||
CPUClass *cc = CPU_CLASS(oc);
|
||||
UniCore32CPUClass *ucc = UNICORE32_CPU_CLASS(oc);
|
||||
|
||||
ucc->parent_realize = dc->realize;
|
||||
dc->realize = uc32_cpu_realizefn;
|
||||
|
||||
cc->class_by_name = uc32_cpu_class_by_name;
|
||||
dc->vmsd = &vmstate_uc32_cpu;
|
||||
|
@ -45,7 +45,8 @@ CPUUniCore32State *uc32_cpu_init(const char *cpu_model)
|
||||
uc32_translate_init();
|
||||
}
|
||||
|
||||
qemu_init_vcpu(env);
|
||||
object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
|
||||
|
||||
return env;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user