[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 01/59] cpu: Introduce cpu_class_set_parent_reset()
From: |
Paolo Bonzini |
Subject: |
[PULL 01/59] cpu: Introduce cpu_class_set_parent_reset() |
Date: |
Thu, 23 Jan 2020 14:48:04 +0100 |
From: Greg Kurz <address@hidden>
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 <address@hidden>
Reviewed-by: David Gibson <address@hidden>
Reviewed-by: Alistair Francis <address@hidden>
Reviewed-by: Cornelia Huck <address@hidden>
Acked-by: David Hildenbrand <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/core/cpu.c | 8 ++++++++
include/hw/core/cpu.h | 4 ++++
2 files changed, 12 insertions(+)
diff --git a/hw/core/cpu.c b/hw/core/cpu.c
index db1a03c..fde5fd3 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);
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index 77c6f05..73e9a86 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -1135,6 +1135,10 @@ void cpu_exec_unrealizefn(CPUState *cpu);
*/
bool target_words_bigendian(void);
+void cpu_class_set_parent_reset(CPUClass *cc,
+ void (*child_reset)(CPUState *cpu),
+ void (**parent_reset)(CPUState *cpu));
+
#ifdef NEED_CPU_H
#ifdef CONFIG_SOFTMMU
--
1.8.3.1
- [PULL 00/59] Misc patches for 2020-01-23, Paolo Bonzini, 2020/01/23
- [PULL 01/59] cpu: Introduce cpu_class_set_parent_reset(),
Paolo Bonzini <=
- [PULL 03/59] pvpanic: introduce crashloaded for pvpanic, Paolo Bonzini, 2020/01/23
- [PULL 02/59] cpu: Use cpu_class_set_parent_reset(), Paolo Bonzini, 2020/01/23
- [PULL 06/59] audio/audio: Add missing fall through comment, Paolo Bonzini, 2020/01/23
- [PULL 07/59] hw/display/tcx: Add missing fall through comments, Paolo Bonzini, 2020/01/23
- [PULL 04/59] pvpanic: implement crashloaded event handling, Paolo Bonzini, 2020/01/23
- [PULL 10/59] hw/net/imx_fec: Remove unuseful FALLTHROUGH comments, Paolo Bonzini, 2020/01/23
- [PULL 05/59] qom/object: Display more helpful message when an interface is missing, Paolo Bonzini, 2020/01/23
- [PULL 08/59] hw/timer/aspeed_timer: Add a fall through comment, Paolo Bonzini, 2020/01/23
- [PULL 09/59] hw/net/imx_fec: Rewrite fall through comments, Paolo Bonzini, 2020/01/23
- [PULL 11/59] hw/pci-host/designware: Remove unuseful FALLTHROUGH comment, Paolo Bonzini, 2020/01/23