Skip to content

Commit b0bd9d8

Browse files
androm3daSidManningquic-mathbern
authored andcommitted
Hexagon (gdbstub): fix p3:0 read and write via stub
Signed-off-by: Brian Cain <[email protected]> Co-authored-by: Sid Manning <[email protected]> Signed-off-by: Sid Manning <[email protected]> Co-authored-by: Matheus Tavares Bernardino <[email protected]> Signed-off-by: Matheus Tavares Bernardino <[email protected]> Reviewed-by: Taylor Simpson <[email protected]> Signed-off-by: Taylor Simpson <[email protected]> Message-Id: <32e7de567cdae184a6781644454bbb19916c955b.1683214375.git.quic_mathbern@quicinc.com>
1 parent ab930e8 commit b0bd9d8

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

target/hexagon/gdbstub.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ int hexagon_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
2525
HexagonCPU *cpu = HEXAGON_CPU(cs);
2626
CPUHexagonState *env = &cpu->env;
2727

28+
if (n == HEX_REG_P3_0_ALIASED) {
29+
uint32_t p3_0 = 0;
30+
for (int i = 0; i < NUM_PREGS; i++) {
31+
p3_0 = deposit32(p3_0, i * 8, 8, env->pred[i]);
32+
}
33+
return gdb_get_regl(mem_buf, p3_0);
34+
}
35+
2836
if (n < TOTAL_PER_THREAD_REGS) {
2937
return gdb_get_regl(mem_buf, env->gpr[n]);
3038
}
@@ -37,6 +45,14 @@ int hexagon_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
3745
HexagonCPU *cpu = HEXAGON_CPU(cs);
3846
CPUHexagonState *env = &cpu->env;
3947

48+
if (n == HEX_REG_P3_0_ALIASED) {
49+
uint32_t p3_0 = ldtul_p(mem_buf);
50+
for (int i = 0; i < NUM_PREGS; i++) {
51+
env->pred[i] = extract32(p3_0, i * 8, 8);
52+
}
53+
return sizeof(target_ulong);
54+
}
55+
4056
if (n < TOTAL_PER_THREAD_REGS) {
4157
env->gpr[n] = ldtul_p(mem_buf);
4258
return sizeof(target_ulong);

0 commit comments

Comments
 (0)