diff --git a/arch/riscv/core/coredump.c b/arch/riscv/core/coredump.c index c7a63dae6d..f232816433 100644 --- a/arch/riscv/core/coredump.c +++ b/arch/riscv/core/coredump.c @@ -7,9 +7,35 @@ #include #include +#ifndef CONFIG_64BIT #define ARCH_HDR_VER 1 +#else +#define ARCH_HDR_VER 2 +#endif struct riscv_arch_block { +#ifdef CONFIG_64BIT + struct { + uint64_t ra; + uint64_t tp; + uint64_t t0; + uint64_t t1; + uint64_t t2; + uint64_t a0; + uint64_t a1; + uint64_t a2; + uint64_t a3; + uint64_t a4; + uint64_t a5; + uint64_t a6; + uint64_t a7; + uint64_t t3; + uint64_t t4; + uint64_t t5; + uint64_t t6; + uint64_t pc; + } r; +#else /* !CONFIG_64BIT */ struct { uint32_t ra; uint32_t tp; @@ -32,6 +58,7 @@ struct riscv_arch_block { #endif /* !CONFIG_RISCV_ISA_RV32E */ uint32_t pc; } r; +#endif /* CONFIG_64BIT */ } __packed; /* diff --git a/scripts/coredump/gdbstubs/arch/risc_v.py b/scripts/coredump/gdbstubs/arch/risc_v.py index 7eb4b92431..60c5fcdf63 100644 --- a/scripts/coredump/gdbstubs/arch/risc_v.py +++ b/scripts/coredump/gdbstubs/arch/risc_v.py @@ -13,7 +13,6 @@ from gdbstubs.gdbstub import GdbStub logger = logging.getLogger("gdbstub") - class RegNum(): ZERO = 0 RA = 1 @@ -52,6 +51,7 @@ class RegNum(): class GdbStub_RISC_V(GdbStub): ARCH_DATA_BLK_STRUCT = " unknown value # Send in "xxxxxxxx" - pkt += b'x' * 8 + length = 8 if self.arch_data_ver == 1 else 16 + pkt += b'x' * length idx += 1 @@ -111,4 +117,5 @@ class GdbStub_RISC_V(GdbStub): def handle_register_single_read_packet(self, pkt): # Mark registers as "". 'p' packets are not sent for the registers # currently handled in this file so we can safely reply "xxxxxxxx" here. - self.put_gdb_packet(b'x' * 8) + length = 8 if self.arch_data_ver == 1 else 16 + self.put_gdb_packet(b'x' * length)