qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: qemu-ppc@nongnu.org, "Michael Rolnik" <mrolnik@gmail.com>,
	"Halil Pasic" <pasic@linux.ibm.com>,
	"Christian Borntraeger" <borntraeger@linux.ibm.com>,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	"Frederic Konrad" <konrad.frederic@yahoo.fr>,
	"Artyom Tarasenko" <atar4qemu@gmail.com>,
	"Matthew Rosato" <mjrosato@linux.ibm.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"David Hildenbrand" <david@redhat.com>,
	"Peter Xu" <peterx@redhat.com>,
	"Ilya Leoshkevich" <iii@linux.ibm.com>,
	"Song Gao" <gaosong@loongson.cn>,
	"Thomas Huth" <thuth@redhat.com>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	qemu-s390x@nongnu.org, "Laurent Vivier" <laurent@vivier.eu>,
	"Eric Farman" <farman@linux.ibm.com>,
	"Clément Chigot" <chigot@adacore.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Thomas Huth" <huth@tuxfamily.org>,
	"Bastian Koppelmann" <kbastian@mail.uni-paderborn.de>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Pierrick Bouvier" <pierrick.bouvier@linaro.org>
Subject: [PATCH 06/16] hw/m68k: Use explicit big-endian LD/ST API
Date: Fri,  4 Oct 2024 01:42:01 +0200	[thread overview]
Message-ID: <20241003234211.53644-7-philmd@linaro.org> (raw)
In-Reply-To: <20241003234211.53644-1-philmd@linaro.org>

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

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/m68k/bootinfo.h  | 28 ++++++++++++++--------------
 hw/m68k/mcf5208.c   |  2 +-
 hw/m68k/next-cube.c |  2 +-
 hw/m68k/q800.c      |  4 ++--
 4 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/hw/m68k/bootinfo.h b/hw/m68k/bootinfo.h
index 70c1dc0e8c3..0b3e7c4ea01 100644
--- a/hw/m68k/bootinfo.h
+++ b/hw/m68k/bootinfo.h
@@ -14,39 +14,39 @@
 
 #define BOOTINFO0(base, id) \
     do { \
-        stw_p(base, id); \
+        stw_be_p(base, id); \
         base += 2; \
-        stw_p(base, sizeof(struct bi_record)); \
+        stw_be_p(base, sizeof(struct bi_record)); \
         base += 2; \
     } while (0)
 
 #define BOOTINFO1(base, id, value) \
     do { \
-        stw_p(base, id); \
+        stw_be_p(base, id); \
         base += 2; \
-        stw_p(base, sizeof(struct bi_record) + 4); \
+        stw_be_p(base, sizeof(struct bi_record) + 4); \
         base += 2; \
-        stl_p(base, value); \
+        stl_be_p(base, value); \
         base += 4; \
     } while (0)
 
 #define BOOTINFO2(base, id, value1, value2) \
     do { \
-        stw_p(base, id); \
+        stw_be_p(base, id); \
         base += 2; \
-        stw_p(base, sizeof(struct bi_record) + 8); \
+        stw_be_p(base, sizeof(struct bi_record) + 8); \
         base += 2; \
-        stl_p(base, value1); \
+        stl_be_p(base, value1); \
         base += 4; \
-        stl_p(base, value2); \
+        stl_be_p(base, value2); \
         base += 4; \
     } while (0)
 
 #define BOOTINFOSTR(base, id, string) \
     do { \
-        stw_p(base, id); \
+        stw_be_p(base, id); \
         base += 2; \
-        stw_p(base, \
+        stw_be_p(base, \
                  (sizeof(struct bi_record) + strlen(string) + \
                   1 /* null termination */ + 3 /* padding */) & ~3); \
         base += 2; \
@@ -59,13 +59,13 @@
 
 #define BOOTINFODATA(base, id, data, len) \
     do { \
-        stw_p(base, id); \
+        stw_be_p(base, id); \
         base += 2; \
-        stw_p(base, \
+        stw_be_p(base, \
                  (sizeof(struct bi_record) + len + \
                   2 /* length field */ + 3 /* padding */) & ~3); \
         base += 2; \
-        stw_p(base, len); \
+        stw_be_p(base, len); \
         base += 2; \
         for (unsigned i_ = 0; i_ < len; ++i_) { \
             stb_p(base++, data[i_]); \
diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c
index b6677ad6bc3..e37cd50d189 100644
--- a/hw/m68k/mcf5208.c
+++ b/hw/m68k/mcf5208.c
@@ -359,7 +359,7 @@ static void mcf5208evb_init(MachineState *machine)
         /* Initial PC is always at offset 4 in firmware binaries */
         ptr = rom_ptr(0x4, 4);
         assert(ptr != NULL);
-        env->pc = ldl_p(ptr);
+        env->pc = ldl_be_p(ptr);
     }
 
     /* Load kernel.  */
diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c
index 9b78767ea8e..9832213e7ec 100644
--- a/hw/m68k/next-cube.c
+++ b/hw/m68k/next-cube.c
@@ -1036,7 +1036,7 @@ static void next_cube_init(MachineState *machine)
         /* Initial PC is always at offset 4 in firmware binaries */
         ptr = rom_ptr(0x01000004, 4);
         g_assert(ptr != NULL);
-        env->pc = ldl_p(ptr);
+        env->pc = ldl_be_p(ptr);
         if (env->pc >= 0x01020000) {
             error_report("'%s' does not seem to be a valid firmware image.",
                          bios_name);
diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c
index fa7683bf76f..556604e1dcf 100644
--- a/hw/m68k/q800.c
+++ b/hw/m68k/q800.c
@@ -684,9 +684,9 @@ static void q800_machine_init(MachineState *machine)
 
             ptr = rom_ptr(MACROM_ADDR, bios_size);
             assert(ptr != NULL);
-            stl_phys(cs->as, 0, ldl_p(ptr));    /* reset initial SP */
+            stl_phys(cs->as, 0, ldl_be_p(ptr));    /* reset initial SP */
             stl_phys(cs->as, 4,
-                     MACROM_ADDR + ldl_p(ptr + 4)); /* reset initial PC */
+                     MACROM_ADDR + ldl_be_p(ptr + 4)); /* reset initial PC */
         }
     }
 }
-- 
2.45.2



  parent reply	other threads:[~2024-10-03 23:44 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-03 23:41 [PATCH 00/16] misc: Use explicit endian LD/ST API Philippe Mathieu-Daudé
2024-10-03 23:41 ` [PATCH 01/16] qemu/bswap: Undefine CPU_CONVERT() once done Philippe Mathieu-Daudé
2024-10-07  5:50   ` Thomas Huth
2024-10-03 23:41 ` [PATCH 02/16] exec/memop: Remove unused memop_big_endian() helper Philippe Mathieu-Daudé
2024-10-07  5:51   ` Thomas Huth
2024-10-03 23:41 ` [PATCH 03/16] linux-user/i386: Use explicit little-endian LD/ST API Philippe Mathieu-Daudé
2024-10-07  5:52   ` Thomas Huth
2024-10-03 23:41 ` [PATCH 04/16] hw/i386: " Philippe Mathieu-Daudé
2024-10-04  8:41   ` Philippe Mathieu-Daudé
2024-10-03 23:42 ` [PATCH 05/16] target/i386: " Philippe Mathieu-Daudé
2024-10-03 23:42 ` Philippe Mathieu-Daudé [this message]
2024-10-04 16:35   ` [PATCH 06/16] hw/m68k: Use explicit big-endian " Thomas Huth
2024-10-03 23:42 ` [PATCH 07/16] target/m68k: " Philippe Mathieu-Daudé
2024-10-04 16:36   ` Thomas Huth
2024-10-03 23:42 ` [PATCH 08/16] hw/ppc/e500: " Philippe Mathieu-Daudé
2024-10-03 23:42 ` [PATCH 09/16] hw/s390x: " Philippe Mathieu-Daudé
2024-10-07  5:48   ` Thomas Huth
2024-10-03 23:42 ` [PATCH 10/16] target/s390x: " Philippe Mathieu-Daudé
2024-10-07  5:49   ` Thomas Huth
2024-10-03 23:42 ` [PATCH 11/16] hw/sparc: " Philippe Mathieu-Daudé
2024-10-04 17:31   ` Mark Cave-Ayland
2024-10-07  7:03   ` Clément Chigot
2024-10-03 23:42 ` [PATCH 12/16] target/sparc: " Philippe Mathieu-Daudé
2024-10-04 17:32   ` Mark Cave-Ayland

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=20241003234211.53644-7-philmd@linaro.org \
    --to=philmd@linaro.org \
    --cc=atar4qemu@gmail.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=chigot@adacore.com \
    --cc=david@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=farman@linux.ibm.com \
    --cc=gaosong@loongson.cn \
    --cc=huth@tuxfamily.org \
    --cc=iii@linux.ibm.com \
    --cc=kbastian@mail.uni-paderborn.de \
    --cc=konrad.frederic@yahoo.fr \
    --cc=laurent@vivier.eu \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=mjrosato@linux.ibm.com \
    --cc=mrolnik@gmail.com \
    --cc=mst@redhat.com \
    --cc=pasic@linux.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=pierrick.bouvier@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@redhat.com \
    /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).