All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Laurent Vivier" <laurent@vivier.eu>
Subject: [PATCH v2 15/17] target/m68k: hack around the FPU register support (HACK!)
Date: Tue, 14 Apr 2020 21:06:29 +0100	[thread overview]
Message-ID: <20200414200631.12799-16-alex.bennee@linaro.org> (raw)
In-Reply-To: <20200414200631.12799-1-alex.bennee@linaro.org>

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 <alex.bennee@linaro.org>
Cc: Laurent Vivier <laurent@vivier.eu>
---
 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



  parent reply	other threads:[~2020-04-14 20:17 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-14 20:06 [PATCH v2 for 5.0-rc3 00/17] more randome fixes (user, pie, docker and gdbstub) Alex Bennée
2020-04-14 20:06 ` [PATCH v2 01/17] linux-user: completely re-write init_guest_space Alex Bennée
2020-04-14 20:06 ` [PATCH v2 02/17] exec/cpu-all: Use bool for have_guest_base Alex Bennée
2020-04-14 20:06 ` [PATCH v2 03/17] accel/tcg: Relax va restrictions on 64-bit guests Alex Bennée
2020-04-14 20:06 ` [PATCH v2 04/17] .gitignore: include common build sub-directories Alex Bennée
2020-04-14 20:06 ` [PATCH v2 05/17] linux-user/ppc: Fix padding in mcontext_t for ppc64 Alex Bennée
2020-04-14 20:06 ` [PATCH v2 06/17] tests/docker: add docs FEATURE flag and use for test-misc Alex Bennée
2020-04-14 20:06 ` [PATCH v2 07/17] configure: redirect sphinx-build check to config.log Alex Bennée
2020-04-14 20:06 ` [PATCH v2 08/17] configure: disable PIE for Windows builds Alex Bennée
2020-04-14 20:06   ` [Bug 1871798] " Alex Bennée
2020-04-14 20:06 ` [PATCH v2 09/17] linux-user: fix /proc/self/stat handling Alex Bennée
2020-04-14 20:06 ` [PATCH v2 10/17] target/m68k/helper: Fix m68k_fpu_gdb_get_reg() use of GByteArray Alex Bennée
2020-04-14 20:06 ` [PATCH v2 11/17] gdbstub: i386: Fix gdb_get_reg16() parameter to unbreak gdb Alex Bennée
2020-04-14 20:06 ` [PATCH v2 12/17] gdbstub: Do not use memset() on GByteArray Alex Bennée
2020-04-14 20:06 ` [PATCH v2 13/17] gdbstub: Introduce gdb_get_float32() to get 32-bit float registers Alex Bennée
2020-04-14 21:20   ` Richard Henderson
2020-04-14 20:06 ` [PATCH v2 14/17] gdbstub: Introduce gdb_get_float64() to get 64-bit " Alex Bennée
2020-04-14 21:22   ` Richard Henderson
2020-04-14 20:06 ` Alex Bennée [this message]
2020-04-14 20:06 ` [PATCH v2 16/17] tests/tcg: drop inferior.was_attached() test Alex Bennée
2020-04-14 20:06 ` [PATCH v2 17/17] tests/tcg: add a multiarch linux-user gdb test Alex Bennée
2020-04-15  1:42 ` [PATCH v2 for 5.0-rc3 00/17] more randome fixes (user, pie, docker and gdbstub) no-reply
  -- strict thread matches above, loose matches on Subject: below --
2020-04-15 10:42 [PULL for 5.0-rc3 0/8] a few small fixes (docker, user, pie " Alex Bennée
2020-04-15 10:42 ` [PULL 1/8] tests/docker: add docs FEATURE flag and use for test-misc Alex Bennée
2020-04-15 10:42 ` [PULL 2/8] configure: redirect sphinx-build check to config.log Alex Bennée
2020-04-15 10:42 ` [PULL 3/8] configure: disable PIE for Windows builds Alex Bennée
2020-04-15 10:42   ` [Bug 1871798] " Alex Bennée
2020-04-15 10:42 ` [PULL 4/8] linux-user: fix /proc/self/stat handling Alex Bennée
2020-04-15 10:42 ` [PULL 5/8] target/m68k/helper: Fix m68k_fpu_gdb_get_reg() use of GByteArray Alex Bennée
2020-04-15 10:42 ` [PULL 6/8] gdbstub: i386: Fix gdb_get_reg16() parameter to unbreak gdb Alex Bennée
2020-04-15 10:42 ` [PULL 7/8] gdbstub: Do not use memset() on GByteArray Alex Bennée
2020-04-15 10:42 ` [PULL 8/8] gdbstub: Introduce gdb_get_float32() to get 32-bit float registers Alex Bennée
2020-04-15 12:16 ` [PULL for 5.0-rc3 0/8] a few small fixes (docker, user, pie and gdbstub) Peter Maydell
2020-04-09 21:15 [PATCH for 5.0-rc3 v1 00/11] more random fixes Alex Bennée
2020-04-09 21:15 ` [PATCH v1 01/11] linux-user: completely re-write init_guest_space Alex Bennée
2020-04-09 21:15 ` [PATCH v1 02/11] exec/cpu-all: Use bool for have_guest_base Alex Bennée
2020-04-10 10:59   ` Philippe Mathieu-Daudé
2020-04-09 21:15 ` [PATCH v1 03/11] accel/tcg: Relax va restrictions on 64-bit guests Alex Bennée
2020-04-09 21:15 ` [PATCH v1 04/11] linux-user/ppc: Fix padding in mcontext_t for ppc64 Alex Bennée
2020-04-09 21:15 ` [PATCH v1 05/11] tests/docker: add docs FEATURE flag and use for test-misc Alex Bennée
2020-04-10 10:58   ` Philippe Mathieu-Daudé
2020-04-10 14:40   ` Richard Henderson
2020-04-09 21:15 ` [PATCH v1 06/11] configure: redirect sphinx-build check to config.log Alex Bennée
2020-04-10 10:56   ` Philippe Mathieu-Daudé
2020-04-10 14:37   ` Richard Henderson
2020-04-09 21:15 ` [PATCH v1 07/11] configure: disable PIE for Windows builds Alex Bennée
2020-04-09 21:15   ` [Bug 1871798] " Alex Bennée
2020-04-09 22:51   ` Howard Spoelstra
2020-04-09 22:51     ` [Bug 1871798] " Howard Spoelstra
2020-04-10 10:55   ` Philippe Mathieu-Daudé
2020-04-10 10:55     ` [Bug 1871798] " Philippe Mathieu-Daudé
2020-04-10 14:42   ` Richard Henderson
2020-04-09 21:15 ` [PATCH v1 08/11] target/m68k/helper: Fix m68k_fpu_gdb_get_reg() use of GByteArray Alex Bennée
2020-04-10 14:44   ` Richard Henderson
2020-04-09 21:15 ` [PATCH v1 09/11] gdbstub: i386: Fix gdb_get_reg16() parameter to unbreak gdb Alex Bennée
2020-04-10 13:08   ` Stefano Garzarella
2020-04-11 12:58     ` Alex Bennée
2020-04-14  7:48       ` Stefano Garzarella
2020-04-11 17:14     ` Philippe Mathieu-Daudé
2020-04-10 14:44   ` Richard Henderson
2020-04-09 21:15 ` [PATCH v1 10/11] linux-user: fix /proc/self/stat handling Alex Bennée
2020-04-10 11:11   ` Philippe Mathieu-Daudé
2020-04-10 12:33     ` Alex Bennée
2020-04-10 12:47       ` Philippe Mathieu-Daudé
2020-04-10 13:21       ` Brice Goglin
2020-04-11 13:00         ` Alex Bennée
2020-04-10 14:51   ` Richard Henderson
2020-04-09 21:15 ` [PATCH v1 11/11] .travis.yml: Build OSX 10.14 with Xcode 10.0 Alex Bennée
2020-04-14 10:17   ` Daniel P. Berrangé
2020-04-09 23:31 ` [PATCH for 5.0-rc3 v1 00/11] more random fixes no-reply
2020-04-09  8:43 [Bug 1871798] [NEW] Fails to start on Windows host without explicit --disable-pie James Le Cuirot
2020-04-09  8:51 ` [Bug 1871798] " Alex Bennée
2020-04-09 17:27 ` Alex Bennée
2020-04-09 18:39 ` James Le Cuirot
2020-04-09 19:31 ` James Le Cuirot
2020-04-09 23:04 ` James Le Cuirot
2020-04-18 13:41 ` Philippe Mathieu-Daudé
2020-04-30 13:45 ` Laurent Vivier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200414200631.12799-16-alex.bennee@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=laurent@vivier.eu \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.