[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 15/17] target/m68k: hack around the FPU register support (HACK
From: |
Alex Bennée |
Subject: |
[PATCH v2 15/17] target/m68k: hack around the FPU register support (HACK!) |
Date: |
Tue, 14 Apr 2020 21:06:29 +0100 |
Attempting to attach to the gdbstub causes GDB to complain:
warning: Register "fp0" has an unsupported size (80 bits)
warning: Register "fp1" has an unsupported size (80 bits)
warning: Register "fp2" has an unsupported size (80 bits)
warning: Register "fp3" has an unsupported size (80 bits)
warning: Register "fp4" has an unsupported size (80 bits)
warning: Register "fp5" has an unsupported size (80 bits)
warning: Register "fp6" has an unsupported size (80 bits)
warning: Register "fp7" has an unsupported size (80 bits)
Remote 'g' packet reply is too long (expected 148 bytes, got 164 bytes):
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000$
00000000000000000000408009f000000000800003407fffffffffffffffffff7fffffffffffffffffff7fffffffffffffffffff7fffffffffffffffffff7fffffffffffffffffff7fffffffffffffffffff7fffffff$
fffffffffff7fffffffffffffffffff000000000000000000000000
and then subsequently fail. The root problem seems to be this is an
undefined size register for the target description. There does exist a
floatformats_m68881_ext in GDB but setting "m68881_ext" also fails as
the only "weird" tdesc types gdb seems to understand are:
{ "arm_fpa_ext", TDESC_TYPE_ARM_FPA_EXT },
{ "i387_ext", TDESC_TYPE_I387_EXT }
So present the register as a i386_ext as some sort of hack. The values
are garbage but at least we can continue to connect. Perhaps we should
just delete the code because I don't think this ever worked with
upstream tools.
Signed-off-by: Alex Bennée <address@hidden>
Cc: Laurent Vivier <address@hidden>
---
target/m68k/helper.c | 11 +++++------
gdb-xml/m68k-fp.xml | 16 ++++++++--------
2 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/target/m68k/helper.c b/target/m68k/helper.c
index 79b0b10ea9b..80069adb8cc 100644
--- a/target/m68k/helper.c
+++ b/target/m68k/helper.c
@@ -109,9 +109,8 @@ static int cf_fpu_gdb_set_reg(CPUM68KState *env, uint8_t
*mem_buf, int n)
static int m68k_fpu_gdb_get_reg(CPUM68KState *env, GByteArray *mem_buf, int n)
{
if (n < 8) {
- int len = gdb_get_reg16(mem_buf, env->fregs[n].l.upper);
- len += gdb_get_reg16(mem_buf, 0);
- len += gdb_get_reg64(mem_buf, env->fregs[n].l.lower);
+ int len = gdb_get_reg64(mem_buf, cpu_to_le64(env->fregs[n].l.lower));
+ len += gdb_get_reg16(mem_buf, cpu_to_le16(env->fregs[n].l.upper));
return len;
}
switch (n) {
@@ -128,9 +127,9 @@ static int m68k_fpu_gdb_get_reg(CPUM68KState *env,
GByteArray *mem_buf, int n)
static int m68k_fpu_gdb_set_reg(CPUM68KState *env, uint8_t *mem_buf, int n)
{
if (n < 8) {
- env->fregs[n].l.upper = lduw_be_p(mem_buf);
- env->fregs[n].l.lower = ldq_be_p(mem_buf + 4);
- return 12;
+ env->fregs[n].l.lower = le64_to_cpu(* (uint64_t *) mem_buf);
+ env->fregs[n].l.upper = le16_to_cpu(* (uint16_t *) (mem_buf + 8));
+ return 10;
}
switch (n) {
case 8: /* fpcontrol */
diff --git a/gdb-xml/m68k-fp.xml b/gdb-xml/m68k-fp.xml
index 64290d16306..8eb55af2860 100644
--- a/gdb-xml/m68k-fp.xml
+++ b/gdb-xml/m68k-fp.xml
@@ -6,14 +6,14 @@
notice and this notice are preserved. -->
<!DOCTYPE feature SYSTEM "gdb-target.dtd">
<feature name="org.gnu.gdb.coldfire.fp">
- <reg name="fp0" bitsize="96" type="float" group="float"/>
- <reg name="fp1" bitsize="96" type="float" group="float"/>
- <reg name="fp2" bitsize="96" type="float" group="float"/>
- <reg name="fp3" bitsize="96" type="float" group="float"/>
- <reg name="fp4" bitsize="96" type="float" group="float"/>
- <reg name="fp5" bitsize="96" type="float" group="float"/>
- <reg name="fp6" bitsize="96" type="float" group="float"/>
- <reg name="fp7" bitsize="96" type="float" group="float"/>
+ <reg name="fp0" bitsize="80" type="i387_ext" group="float"/>
+ <reg name="fp1" bitsize="80" type="i387_ext" group="float"/>
+ <reg name="fp2" bitsize="80" type="i387_ext" group="float"/>
+ <reg name="fp3" bitsize="80" type="i387_ext" group="float"/>
+ <reg name="fp4" bitsize="80" type="i387_ext" group="float"/>
+ <reg name="fp5" bitsize="80" type="i387_ext" group="float"/>
+ <reg name="fp6" bitsize="80" type="i387_ext" group="float"/>
+ <reg name="fp7" bitsize="80" type="i387_ext" group="float"/>
<reg name="fpcontrol" bitsize="32" group="float"/>
<reg name="fpstatus" bitsize="32" group="float"/>,
--
2.20.1
- [PATCH v2 05/17] linux-user/ppc: Fix padding in mcontext_t for ppc64, (continued)
- [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, 2020/04/14
- [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 <=
- [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