On 21/10/26 19:36, Pierrick Bouvier wrote:
On 10/20/2026 6:43 PM, Philippe Mathieu-Daudé wrote:
On 19/10/26 23:26, Pierrick Bouvier wrote:
This allows a specific cpu to declare its implementation of
get_dump_info, needed by dump.

Reviewed-by: Anton Johansson <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Signed-off-by: Pierrick Bouvier <[email protected]>
---
   include/hw/core/sysemu-cpu-ops.h | 6 ++++++
   1 file changed, 6 insertions(+)

diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/
sysemu-cpu-ops.h
index d125540262d..2c7d0b94767 100644
--- a/include/hw/core/sysemu-cpu-ops.h
+++ b/include/hw/core/sysemu-cpu-ops.h
@@ -94,6 +94,12 @@ typedef struct SysemuCPUOps {
        */
       int (*write_elf64_qemunote)(WriteCoreDumpFunction f, CPUState *cpu,
                                   DumpState *s);
+    /**
+     * @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.

QEMU style is to return int when errno is propagated, otherwise
a boolean is preferred (bonus if error propagated in Error *errp).


Taking a look at it from this perspective, we never return any failure
from any implementation. -1 was just here to say "not implemented".
So I'll switch to no return (void) for get_dump_info, and size_t for
get_note_size.

LGTM, thanks!


Note: the global wrappers will keep on returning -1, only sysemu ops
will be infallible.

Getting the prototype right is simpler at its addition than later
refactors.
+     */
+    int (*get_dump_info)(const CPUState *cpu, ArchDumpInfo *info,
+                         const GuestPhysBlockList *guest_phys_blocks);
       /**
        * @internal_is_big_endian: Callback to return %true if a CPU
which supports
        * runtime configurable endianness is currently big-endian.





Reply via email to