qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Thomas Huth" <huth@tuxfamily.org>
Subject: [PULL 07/12] target/m68k: Use explicit big-endian LD/ST API
Date: Mon,  7 Oct 2024 13:50:22 +0200	[thread overview]
Message-ID: <20241007115027.243425-8-thuth@redhat.com> (raw)
In-Reply-To: <20241007115027.243425-1-thuth@redhat.com>

From: Philippe Mathieu-Daudé <philmd@linaro.org>

The M68K architecture uses big endianness. Directly use
the big-endian LD/ST API.

Mechanical change using:

  $ end=be; \
    for acc in uw w l q tul; do \
      sed -i -e "s/ld${acc}_p(/ld${acc}_${end}_p(/" \
             -e "s/st${acc}_p(/st${acc}_${end}_p(/" \
        $(git grep -wlE '(ld|st)t?u?[wlq]_p' target/m68k/); \
    done

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Thomas Huth <huth@tuxfamily.org>
Message-ID: <20241004163042.85922-19-philmd@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 target/m68k/gdbstub.c |  2 +-
 target/m68k/helper.c  | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/target/m68k/gdbstub.c b/target/m68k/gdbstub.c
index 15547e2313..136159f98f 100644
--- a/target/m68k/gdbstub.c
+++ b/target/m68k/gdbstub.c
@@ -52,7 +52,7 @@ int m68k_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
     CPUM68KState *env = cpu_env(cs);
     uint32_t tmp;
 
-    tmp = ldl_p(mem_buf);
+    tmp = ldl_be_p(mem_buf);
 
     if (n < 8) {
         /* D0-D7 */
diff --git a/target/m68k/helper.c b/target/m68k/helper.c
index 4c85badd5d..9d3db8419d 100644
--- a/target/m68k/helper.c
+++ b/target/m68k/helper.c
@@ -57,15 +57,15 @@ static int cf_fpu_gdb_set_reg(CPUState *cs, uint8_t *mem_buf, int n)
 
     if (n < 8) {
         float_status s;
-        env->fregs[n].d = float64_to_floatx80(ldq_p(mem_buf), &s);
+        env->fregs[n].d = float64_to_floatx80(ldq_be_p(mem_buf), &s);
         return 8;
     }
     switch (n) {
     case 8: /* fpcontrol */
-        cpu_m68k_set_fpcr(env, ldl_p(mem_buf));
+        cpu_m68k_set_fpcr(env, ldl_be_p(mem_buf));
         return 4;
     case 9: /* fpstatus */
-        env->fpsr = ldl_p(mem_buf);
+        env->fpsr = ldl_be_p(mem_buf);
         return 4;
     case 10: /* fpiar, not implemented */
         return 4;
@@ -107,10 +107,10 @@ static int m68k_fpu_gdb_set_reg(CPUState *cs, uint8_t *mem_buf, int n)
     }
     switch (n) {
     case 8: /* fpcontrol */
-        cpu_m68k_set_fpcr(env, ldl_p(mem_buf));
+        cpu_m68k_set_fpcr(env, ldl_be_p(mem_buf));
         return 4;
     case 9: /* fpstatus */
-        cpu_m68k_set_fpsr(env, ldl_p(mem_buf));
+        cpu_m68k_set_fpsr(env, ldl_be_p(mem_buf));
         return 4;
     case 10: /* fpiar, not implemented */
         return 4;
-- 
2.46.1



  parent reply	other threads:[~2024-10-07 11:52 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-07 11:50 [PULL 00/12] CI fixes and various clean-ups Thomas Huth
2024-10-07 11:50 ` [PULL 01/12] docs: Mark "gluster" support in QEMU as deprecated Thomas Huth
2024-10-07 11:50 ` [PULL 02/12] .gitlab-ci.d/cirrus: Drop support for macOS 13 (Ventura) Thomas Huth
2024-10-07 11:50 ` [PULL 03/12] .gitlab-ci.d/cirrus: Add manual testing of macOS 15 (Sequoia) Thomas Huth
2024-10-07 11:50 ` [PULL 04/12] disas: Remove CRIS disassembler Thomas Huth
2024-10-07 11:50 ` [PULL 05/12] gitlab-ci/build-oss-fuzz: print FAILED marker in case the test failed and run all tests Thomas Huth
2024-10-07 11:50 ` [PULL 06/12] hw/m68k: Use explicit big-endian LD/ST API Thomas Huth
2024-10-07 11:50 ` Thomas Huth [this message]
2024-10-07 11:50 ` [PULL 08/12] hw/s390x: " Thomas Huth
2024-10-07 11:50 ` [PULL 09/12] target/s390x: Replace ldtul_p() -> ldq_p() Thomas Huth
2024-10-07 11:50 ` [PULL 10/12] target/s390x: Use explicit big-endian LD/ST API Thomas Huth
2024-10-07 11:50 ` [PULL 11/12] tests/functional: Switch back to the gitlab URLs for the advent calendar tests Thomas Huth
2024-10-07 11:50 ` [PULL 12/12] tests/functional: Bump timeout of some tests Thomas Huth
2024-10-07 13:43 ` [PULL 00/12] CI fixes and various clean-ups Peter Maydell
2024-10-07 14:13   ` Peter Maydell
2024-10-07 16:41     ` Thomas Huth
2024-10-07 16:51       ` Peter Maydell

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=20241007115027.243425-8-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=huth@tuxfamily.org \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).