mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
target-lm32: Introduce QOM realizefn for LM32CPU
Introduce a realizefn and set realized = true in cpu_lm32_init(). Also move cpu_reset() call from initfn to realizefn. Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
ca45f8b044
commit
9c23169e8c
3 changed files with 20 additions and 4 deletions
|
@ -42,6 +42,18 @@ static void lm32_cpu_reset(CPUState *s)
|
|||
memset(env, 0, offsetof(CPULM32State, breakpoints));
|
||||
}
|
||||
|
||||
static void lm32_cpu_realizefn(DeviceState *dev, Error **errp)
|
||||
{
|
||||
LM32CPU *cpu = LM32_CPU(dev);
|
||||
LM32CPUClass *lcc = LM32_CPU_GET_CLASS(dev);
|
||||
|
||||
cpu_reset(CPU(cpu));
|
||||
|
||||
qemu_init_vcpu(&cpu->env);
|
||||
|
||||
lcc->parent_realize(dev, errp);
|
||||
}
|
||||
|
||||
static void lm32_cpu_initfn(Object *obj)
|
||||
{
|
||||
LM32CPU *cpu = LM32_CPU(obj);
|
||||
|
@ -50,14 +62,16 @@ static void lm32_cpu_initfn(Object *obj)
|
|||
cpu_exec_init(env);
|
||||
|
||||
env->flags = 0;
|
||||
|
||||
cpu_reset(CPU(cpu));
|
||||
}
|
||||
|
||||
static void lm32_cpu_class_init(ObjectClass *oc, void *data)
|
||||
{
|
||||
LM32CPUClass *lcc = LM32_CPU_CLASS(oc);
|
||||
CPUClass *cc = CPU_CLASS(oc);
|
||||
DeviceClass *dc = DEVICE_CLASS(oc);
|
||||
|
||||
lcc->parent_realize = dc->realize;
|
||||
dc->realize = lm32_cpu_realizefn;
|
||||
|
||||
lcc->parent_reset = cc->reset;
|
||||
cc->reset = lm32_cpu_reset;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue