aboutsummaryrefslogtreecommitdiff
path: root/target/avr/cpu.c
diff options
context:
space:
mode:
Diffstat (limited to 'target/avr/cpu.c')
-rw-r--r--target/avr/cpu.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/target/avr/cpu.c b/target/avr/cpu.c
index c7295b4..d013980 100644
--- a/target/avr/cpu.c
+++ b/target/avr/cpu.c
@@ -67,14 +67,16 @@ static void avr_restore_state_to_opc(CPUState *cs,
env->pc_w = data[0];
}
-static void avr_cpu_reset(DeviceState *ds)
+static void avr_cpu_reset_hold(Object *obj)
{
- CPUState *cs = CPU(ds);
+ CPUState *cs = CPU(obj);
AVRCPU *cpu = AVR_CPU(cs);
AVRCPUClass *mcc = AVR_CPU_GET_CLASS(cpu);
CPUAVRState *env = &cpu->env;
- mcc->parent_reset(ds);
+ if (mcc->parent_phases.hold) {
+ mcc->parent_phases.hold(obj);
+ }
env->pc_w = 0;
env->sregI = 1;
@@ -223,9 +225,12 @@ static void avr_cpu_class_init(ObjectClass *oc, void *data)
DeviceClass *dc = DEVICE_CLASS(oc);
CPUClass *cc = CPU_CLASS(oc);
AVRCPUClass *mcc = AVR_CPU_CLASS(oc);
+ ResettableClass *rc = RESETTABLE_CLASS(oc);
device_class_set_parent_realize(dc, avr_cpu_realizefn, &mcc->parent_realize);
- device_class_set_parent_reset(dc, avr_cpu_reset, &mcc->parent_reset);
+
+ resettable_class_set_parent_phases(rc, NULL, avr_cpu_reset_hold, NULL,
+ &mcc->parent_phases);
cc->class_by_name = avr_cpu_class_by_name;