On 2026-10-07 12:34, Philippe Mathieu-Daudé wrote:
On 7/10/26 10:43, Anton Johansson wrote:
Reviewed-by: Pierrick Bouvier <[email protected]>
Signed-off-by: Anton Johansson <[email protected]>
---
  target/riscv/arch_dump.c | 13 +++++++------
  target/riscv/meson.build |  2 +-
  2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/target/riscv/arch_dump.c b/target/riscv/arch_dump.c


@@ -175,11 +176,11 @@ int cpu_get_dump_info(ArchDumpInfo *info,
      info->d_machine = EM_RISCV;
-#if defined(TARGET_RISCV64)
-    info->d_class = ELFCLASS64;
-#else
-    info->d_class = ELFCLASS32;
-#endif
+    if (target_riscv64()) {
+        info->d_class = ELFCLASS64;
+    } else {
+        info->d_class = ELFCLASS32;
+    }
If this is good enough to link:
Acked-by: Philippe Mathieu-Daudé <[email protected]>

But FYI the whole "system/dump-arch.h" API is not ready for
heterogenous emulation. We discussed it once with Marc-André
and there is no good way to adapt it, since it was not designed
with that in mind, and is restricted to a single architecture
which doesn't change (word size, endianness) at runtime.
IIRC we ended agreeing dump can not be supported in Het.Emu.,
and the plan was to refactor get_dump_info() as a CPUClass
handler, if not heterogenous then dispatch if available
otherwise fallback to "not supported" stub.

FTR for whoever will work on this, this symbol will clash:

$ git grep -w cpu_get_dump_info
dump/dump.c:1856: * If the target architecture is not supported, cpu_get_dump_info() will dump/dump.c:1859: ret = cpu_get_dump_info(&s->dump_info, &s->guest_phys_blocks);
include/system/dump-arch.h:31:int cpu_get_dump_info(ArchDumpInfo *info,
stubs/dump.c:17:int cpu_get_dump_info(ArchDumpInfo *info,
target/arm/arch_dump.c:388:int cpu_get_dump_info(ArchDumpInfo *info,
target/i386/arch_dump.c:397:int cpu_get_dump_info(ArchDumpInfo *info,
target/loongarch/arch_dump.c:145:int cpu_get_dump_info(ArchDumpInfo *info,
target/ppc/arch_dump.c:232:int cpu_get_dump_info(ArchDumpInfo *info,
target/riscv/arch_dump.c:164:int cpu_get_dump_info(ArchDumpInfo *info,
target/s390x/arch_dump.c:452:int cpu_get_dump_info(ArchDumpInfo *info,


Reply via email to