[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 13/17] gdbstub: Introduce gdb_get_float32() to get 32-bit floa
From: |
Alex Bennée |
Subject: |
[PATCH v2 13/17] gdbstub: Introduce gdb_get_float32() to get 32-bit float registers |
Date: |
Tue, 14 Apr 2020 21:06:27 +0100 |
From: Philippe Mathieu-Daudé <address@hidden>
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: a010bdbe719 ("extend GByteArray to read register helpers")
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
Signed-off-by: Alex Bennée <address@hidden>
Message-Id: <address@hidden>
---
include/exec/gdbstub.h | 9 +++++++++
target/sh4/gdbstub.c | 6 ++----
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h
index 3c452fc50c0..20e10726929 100644
--- a/include/exec/gdbstub.h
+++ b/include/exec/gdbstub.h
@@ -125,6 +125,15 @@ static inline int gdb_get_reg128(GByteArray *buf, uint64_t
val_hi,
return 16;
}
+static inline int gdb_get_float32(GByteArray *array, float32 val)
+{
+ uint8_t buf[sizeof(CPU_FloatU)];
+
+ stfl_p(buf, val);
+ g_byte_array_append(array, buf, sizeof(buf));
+
+ return sizeof(buf);
+}
static inline int gdb_get_zeroes(GByteArray *array, size_t len)
{
guint oldlen = array->len;
diff --git a/target/sh4/gdbstub.c b/target/sh4/gdbstub.c
index 49fc4a0cc69..34ad3ca0508 100644
--- a/target/sh4/gdbstub.c
+++ b/target/sh4/gdbstub.c
@@ -58,11 +58,9 @@ int superh_cpu_gdb_read_register(CPUState *cs, GByteArray
*mem_buf, int n)
return gdb_get_regl(mem_buf, env->fpscr);
case 25 ... 40:
if (env->fpscr & FPSCR_FR) {
- stfl_p(mem_buf, env->fregs[n - 9]);
- } else {
- stfl_p(mem_buf, env->fregs[n - 25]);
+ return gdb_get_float32(mem_buf, env->fregs[n - 9]);
}
- return 4;
+ return gdb_get_float32(mem_buf, env->fregs[n - 25]);
case 41:
return gdb_get_regl(mem_buf, env->ssr);
case 42:
--
2.20.1
- [PATCH v2 02/17] exec/cpu-all: Use bool for have_guest_base, (continued)
- [PATCH v2 02/17] exec/cpu-all: Use bool for have_guest_base, Alex Bennée, 2020/04/14
- [PATCH v2 03/17] accel/tcg: Relax va restrictions on 64-bit guests, Alex Bennée, 2020/04/14
- [PATCH v2 04/17] .gitignore: include common build sub-directories, Alex Bennée, 2020/04/14
- [PATCH v2 01/17] linux-user: completely re-write init_guest_space, Alex Bennée, 2020/04/14
- [PATCH v2 06/17] tests/docker: add docs FEATURE flag and use for test-misc, Alex Bennée, 2020/04/14
- [PATCH v2 07/17] configure: redirect sphinx-build check to config.log, Alex Bennée, 2020/04/14
- [PATCH v2 05/17] linux-user/ppc: Fix padding in mcontext_t for ppc64, Alex Bennée, 2020/04/14
- [PATCH v2 08/17] configure: disable PIE for Windows builds, Alex Bennée, 2020/04/14
- [PATCH v2 12/17] gdbstub: Do not use memset() on GByteArray, Alex Bennée, 2020/04/14
- [PATCH v2 11/17] gdbstub: i386: Fix gdb_get_reg16() parameter to unbreak gdb, Alex Bennée, 2020/04/14
- [PATCH v2 13/17] gdbstub: Introduce gdb_get_float32() to get 32-bit float registers,
Alex Bennée <=
- [PATCH v2 09/17] linux-user: fix /proc/self/stat handling, Alex Bennée, 2020/04/14
- [PATCH v2 10/17] target/m68k/helper: Fix m68k_fpu_gdb_get_reg() use of GByteArray, Alex Bennée, 2020/04/14
- [PATCH v2 16/17] tests/tcg: drop inferior.was_attached() test, Alex Bennée, 2020/04/14
- [PATCH v2 17/17] tests/tcg: add a multiarch linux-user gdb test, Alex Bennée, 2020/04/14
- [PATCH v2 15/17] target/m68k: hack around the FPU register support (HACK!), Alex Bennée, 2020/04/14
- [PATCH v2 14/17] gdbstub: Introduce gdb_get_float64() to get 64-bit float registers, Alex Bennée, 2020/04/14
- Re: [PATCH v2 for 5.0-rc3 00/17] more randome fixes (user, pie, docker and gdbstub), no-reply, 2020/04/14