aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2022-03-23 19:57:18 +0400
committerPaolo Bonzini <pbonzini@redhat.com>2022-04-06 10:50:37 +0200
commitee3eb3a7ce7242735e6fd64cad53482e3df5a5ec (patch)
treee44d5190b97904e26b30b974002dcbfd6fbe5c80 /include
parente03b56863d2bca3e649e81531c1b0299524481ae (diff)
downloadqemu-ee3eb3a7ce7242735e6fd64cad53482e3df5a5ec.zip
qemu-ee3eb3a7ce7242735e6fd64cad53482e3df5a5ec.tar.gz
qemu-ee3eb3a7ce7242735e6fd64cad53482e3df5a5ec.tar.bz2
Replace TARGET_WORDS_BIGENDIAN
Convert the TARGET_WORDS_BIGENDIAN macro, similarly to what was done with HOST_BIG_ENDIAN. The new TARGET_BIG_ENDIAN macro is either 0 or 1, and thus should always be defined to prevent misuse. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Suggested-by: Halil Pasic <pasic@linux.ibm.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220323155743.1585078-8-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/exec/cpu-all.h7
-rw-r--r--include/exec/cpu_ldst.h2
-rw-r--r--include/exec/gdbstub.h2
-rw-r--r--include/exec/memop.h2
-rw-r--r--include/exec/memory.h2
-rw-r--r--include/exec/poison.h2
-rw-r--r--include/hw/core/cpu.h2
-rw-r--r--include/hw/mips/bios.h2
-rw-r--r--include/hw/virtio/virtio-access.h2
9 files changed, 11 insertions, 12 deletions
diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
index f77070d..5d5290d 100644
--- a/include/exec/cpu-all.h
+++ b/include/exec/cpu-all.h
@@ -37,11 +37,10 @@
* HOST_BIG_ENDIAN : whether the host cpu is big endian and
* otherwise little endian.
*
- * TARGET_WORDS_BIGENDIAN : if defined, the host cpu is big endian and otherwise
- * little endian.
+ * TARGET_BIG_ENDIAN : same for the target cpu
*/
-#if HOST_BIG_ENDIAN != defined(TARGET_WORDS_BIGENDIAN)
+#if HOST_BIG_ENDIAN != TARGET_BIG_ENDIAN
#define BSWAP_NEEDED
#endif
@@ -121,7 +120,7 @@ static inline void tswap64s(uint64_t *s)
/* Target-endianness CPU memory access functions. These fit into the
* {ld,st}{type}{sign}{size}{endian}_p naming scheme described in bswap.h.
*/
-#if defined(TARGET_WORDS_BIGENDIAN)
+#if TARGET_BIG_ENDIAN
#define lduw_p(p) lduw_be_p(p)
#define ldsw_p(p) ldsw_be_p(p)
#define ldl_p(p) ldl_be_p(p)
diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h
index 6adacf8..d0c7c0d 100644
--- a/include/exec/cpu_ldst.h
+++ b/include/exec/cpu_ldst.h
@@ -377,7 +377,7 @@ static inline CPUTLBEntry *tlb_entry(CPUArchState *env, uintptr_t mmu_idx,
#endif /* defined(CONFIG_USER_ONLY) */
-#ifdef TARGET_WORDS_BIGENDIAN
+#if TARGET_BIG_ENDIAN
# define cpu_lduw_data cpu_lduw_be_data
# define cpu_ldsw_data cpu_ldsw_be_data
# define cpu_ldl_data cpu_ldl_be_data
diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h
index 89edf94..c35d733 100644
--- a/include/exec/gdbstub.h
+++ b/include/exec/gdbstub.h
@@ -110,7 +110,7 @@ static inline int gdb_get_reg128(GByteArray *buf, uint64_t val_hi,
uint64_t val_lo)
{
uint64_t to_quad;
-#ifdef TARGET_WORDS_BIGENDIAN
+#if TARGET_BIG_ENDIAN
to_quad = tswap64(val_hi);
g_byte_array_append(buf, (uint8_t *) &to_quad, 8);
to_quad = tswap64(val_lo);
diff --git a/include/exec/memop.h b/include/exec/memop.h
index 44f923e..25d0274 100644
--- a/include/exec/memop.h
+++ b/include/exec/memop.h
@@ -36,7 +36,7 @@ typedef enum MemOp {
MO_BE = MO_BSWAP,
#endif
#ifdef NEED_CPU_H
-#ifdef TARGET_WORDS_BIGENDIAN
+#if TARGET_BIG_ENDIAN
MO_TE = MO_BE,
#else
MO_TE = MO_LE,
diff --git a/include/exec/memory.h b/include/exec/memory.h
index e40653f..f1c1945 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -2931,7 +2931,7 @@ static inline MemOp devend_memop(enum device_endian end)
QEMU_BUILD_BUG_ON(DEVICE_HOST_ENDIAN != DEVICE_LITTLE_ENDIAN &&
DEVICE_HOST_ENDIAN != DEVICE_BIG_ENDIAN);
-#if HOST_BIG_ENDIAN != defined(TARGET_WORDS_BIGENDIAN)
+#if HOST_BIG_ENDIAN != TARGET_BIG_ENDIAN
/* Swap if non-host endianness or native (target) endianness */
return (end == DEVICE_HOST_ENDIAN) ? 0 : MO_BSWAP;
#else
diff --git a/include/exec/poison.h b/include/exec/poison.h
index 7c5c02f..9f1ca34 100644
--- a/include/exec/poison.h
+++ b/include/exec/poison.h
@@ -38,7 +38,7 @@
#pragma GCC poison TARGET_HAS_BFLT
#pragma GCC poison TARGET_NAME
#pragma GCC poison TARGET_SUPPORTS_MTTCG
-#pragma GCC poison TARGET_WORDS_BIGENDIAN
+#pragma GCC poison TARGET_BIG_ENDIAN
#pragma GCC poison BSWAP_NEEDED
#pragma GCC poison TARGET_LONG_BITS
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index b0e2e5b..13adb25 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -1028,7 +1028,7 @@ void cpu_exec_unrealizefn(CPUState *cpu);
* target_words_bigendian:
* Returns true if the (default) endianness of the target is big endian,
* false otherwise. Note that in target-specific code, you can use
- * TARGET_WORDS_BIGENDIAN directly instead. On the other hand, common
+ * TARGET_BIG_ENDIAN directly instead. On the other hand, common
* code should normally never need to know about the endianness of the
* target, so please do *not* use this function unless you know very well
* what you are doing!
diff --git a/include/hw/mips/bios.h b/include/hw/mips/bios.h
index c030079..44acb68 100644
--- a/include/hw/mips/bios.h
+++ b/include/hw/mips/bios.h
@@ -5,7 +5,7 @@
#include "cpu.h"
#define BIOS_SIZE (4 * MiB)
-#ifdef TARGET_WORDS_BIGENDIAN
+#if TARGET_BIG_ENDIAN
#define BIOS_FILENAME "mips_bios.bin"
#else
#define BIOS_FILENAME "mipsel_bios.bin"
diff --git a/include/hw/virtio/virtio-access.h b/include/hw/virtio/virtio-access.h
index 90cbb77..07aae69 100644
--- a/include/hw/virtio/virtio-access.h
+++ b/include/hw/virtio/virtio-access.h
@@ -28,7 +28,7 @@ static inline bool virtio_access_is_big_endian(VirtIODevice *vdev)
{
#if defined(LEGACY_VIRTIO_IS_BIENDIAN)
return virtio_is_big_endian(vdev);
-#elif defined(TARGET_WORDS_BIGENDIAN)
+#elif TARGET_BIG_ENDIAN
if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {
/* Devices conforming to VIRTIO 1.0 or later are always LE. */
return false;