Skip to content

Commit 377f8f0

Browse files
philmdstsquad
authored andcommitted
gdbstub: Introduce gdb_get_float32() to get 32-bit float registers
Since we now use a GByteArray, we can not use stfl_p() directly. Introduce the gdb_get_float32() helper to load a float32 register. Fixes: a010bdb ("extend GByteArray to read register helpers") Signed-off-by: Philippe Mathieu-Daudé <[email protected]> Signed-off-by: Alex Bennée <[email protected]> Reviewed-by: Richard Henderson <[email protected]> Message-Id: <[email protected]> Message-Id: <[email protected]>
1 parent 7b8c152 commit 377f8f0

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

include/exec/gdbstub.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,15 @@ static inline int gdb_get_reg128(GByteArray *buf, uint64_t val_hi,
125125
return 16;
126126
}
127127

128+
static inline int gdb_get_float32(GByteArray *array, float32 val)
129+
{
130+
uint8_t buf[sizeof(CPU_FloatU)];
131+
132+
stfl_p(buf, val);
133+
g_byte_array_append(array, buf, sizeof(buf));
134+
135+
return sizeof(buf);
136+
}
128137
static inline int gdb_get_zeroes(GByteArray *array, size_t len)
129138
{
130139
guint oldlen = array->len;

target/sh4/gdbstub.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,9 @@ int superh_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
5858
return gdb_get_regl(mem_buf, env->fpscr);
5959
case 25 ... 40:
6060
if (env->fpscr & FPSCR_FR) {
61-
stfl_p(mem_buf, env->fregs[n - 9]);
62-
} else {
63-
stfl_p(mem_buf, env->fregs[n - 25]);
61+
return gdb_get_float32(mem_buf, env->fregs[n - 9]);
6462
}
65-
return 4;
63+
return gdb_get_float32(mem_buf, env->fregs[n - 25]);
6664
case 41:
6765
return gdb_get_regl(mem_buf, env->ssr);
6866
case 42:

0 commit comments

Comments
 (0)