aboutsummaryrefslogtreecommitdiff
path: root/hw/core/cpu.c
diff options
context:
space:
mode:
authorGreg Kurz <groug@kaod.org>2019-12-16 16:01:12 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2020-01-24 20:59:06 +0100
commitef0a6249a80f05906dffa3a954e0563421972244 (patch)
tree5fb12ac2fd848f806c40dfc424125c487803f957 /hw/core/cpu.c
parent3e08b2b9cb64bff2b73fa9128c0e49bfcde0dd40 (diff)
cpu: Introduce cpu_class_set_parent_reset()
Similarly to what we already do with qdev, use a helper to overload the reset QOM methods of the parent in children classes, for clarity. Signed-off-by: Greg Kurz <groug@kaod.org> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Acked-by: David Hildenbrand <david@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <157650847239.354886.2782881118916307978.stgit@bahia.lan> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/core/cpu.c')
-rw-r--r--hw/core/cpu.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/hw/core/cpu.c b/hw/core/cpu.c
index db1a03c6bb..fde5fd395b 100644
--- a/hw/core/cpu.c
+++ b/hw/core/cpu.c
@@ -239,6 +239,14 @@ void cpu_dump_statistics(CPUState *cpu, int flags)
}
}
+void cpu_class_set_parent_reset(CPUClass *cc,
+ void (*child_reset)(CPUState *cpu),
+ void (**parent_reset)(CPUState *cpu))
+{
+ *parent_reset = cc->reset;
+ cc->reset = child_reset;
+}
+
void cpu_reset(CPUState *cpu)
{
CPUClass *klass = CPU_GET_CLASS(cpu);