On 12/10/26 06:17, Brian Cain wrote:
Add support for the system and guest registers to the gdbstub.
Reviewed-by: Pierrick Bouvier <[email protected]>
Signed-off-by: Brian Cain <[email protected]>
---
target/hexagon/cpu.h | 1 +
target/hexagon/internal.h | 4 +++
target/hexagon/cpu.c | 13 ++++++--
target/hexagon/gdbstub.c | 63 +++++++++++++++++++++++++++++++++++++++
4 files changed, 78 insertions(+), 3 deletions(-)
+int hexagon_sys_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
+{
+ CPUHexagonState *env = cpu_env(cs);
+ HexagonCPU *cpu = env_archcpu(env);
+ BQL_LOCK_GUARD();
+
+ if (n < NUM_SREGS) {
+ uint32_t val;
+ if (n < HEX_SREG_GLB_START) {
+ val = env->t_sreg[n];
+ } else {
+ val = cpu->globalregs ?
+ hexagon_globalreg_read(cpu->globalregs, n, env->threadId) : 0;
+ }
+ return gdb_get_regl(mem_buf, val);
+ }
+ n -= NUM_SREGS;
+
+ if (n < NUM_GREGS) {
+ return gdb_get_regl(mem_buf, hexagon_greg_read(env, n));
And my PR removing gdb_get_regl failed because it got re-used
meanwhile :(
https://lore.kernel.org/qemu-devel/[email protected]/
Hexagon is 32-bit so I'll replace by gdb_get_reg32 like in
commit 7831e5f48d2 ("target/hexagon: Expand gdb_get_regl()
-> gdb_get_reg32()").
+ }
+ n -= NUM_GREGS;
+
+ g_assert_not_reached();
+}