This allows a specific cpu to declare its implementation of the operations needed by dump, starting with get_dump_info.
Signed-off-by: Pierrick Bouvier <[email protected]> --- include/hw/core/cpu.h | 6 ++++++ include/hw/core/dump-cpu-ops.h | 24 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 include/hw/core/dump-cpu-ops.h diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 456154df6f6..eb8747b9bcf 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -98,6 +98,9 @@ struct AccelCPUClass; /* see sysemu-cpu-ops.h */ struct SysemuCPUOps; +/* see dump-cpu-ops.h */ +struct DumpCPUOps; + /* see semihosting/common-semi.h */ struct SemihostingCPUOps; @@ -186,6 +189,9 @@ struct CPUClass { /* when system emulation is not available, this pointer is NULL */ const struct SysemuCPUOps *sysemu_ops; + /* when target does not implement dump ops, this pointer is NULL */ + const struct DumpCPUOps *dump_ops; + #ifdef CONFIG_TCG /* when TCG is not available, this pointer is NULL */ const TCGCPUOps *tcg_ops; diff --git a/include/hw/core/dump-cpu-ops.h b/include/hw/core/dump-cpu-ops.h new file mode 100644 index 00000000000..5e8a89cbbea --- /dev/null +++ b/include/hw/core/dump-cpu-ops.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * CPU operations specific to dump + */ + +#ifndef DUMP_CPU_OPS_H +#define DUMP_CPU_OPS_H + +#include "hw/core/cpu.h" +#include "system/dump-arch.h" + +/* + * struct DumpCPUOps: Dump operations specific to a CPU class + */ +typedef struct DumpCPUOps { + /** + * @get_dump_info: fills @info with the endianness, class and architecture. + * Returns 0 on success, or -1 if the guest memory can't be dumped. + */ + int (*get_dump_info)(const CPUState *cs, ArchDumpInfo *info, + const struct GuestPhysBlockList *guest_phys_blocks); +} DumpCPUOps; + +#endif /* DUMP_CPU_OPS_H */ -- 2.43.0
