@@ -11,15 +11,15 @@
#include "qemu/bswap.h"
/**
- * 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_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!
+ * qemu_binary_is_bigendian: Returns QEMU binary default endianness
+ *
+ * Returns whether the QEMU binary is built for big endianness flavor
+ * by default.
+ * vCPUs use this flavor by default when their endianness is not specified.
+ *
+ * This is not a clear API so please do *not* use this function.
*/
-bool target_words_bigendian(void);
+bool qemu_binary_is_bigendian(void);
/*
* If we're in target-specific code, we can hard-code the swapping
@@ -28,7 +28,7 @@ bool target_words_bigendian(void);
#ifdef COMPILING_PER_TARGET
#define target_needs_bswap() (HOST_BIG_ENDIAN != TARGET_BIG_ENDIAN)
#else
-#define target_needs_bswap() (HOST_BIG_ENDIAN != target_words_bigendian())
+#define target_needs_bswap() (HOST_BIG_ENDIAN != qemu_binary_is_bigendian())
#endif /* COMPILING_PER_TARGET */
static inline uint16_t tswap16(uint16_t s)
@@ -463,7 +463,7 @@ out:
}
#endif
-bool target_words_bigendian(void)
+bool qemu_binary_is_bigendian(void)
{
return TARGET_BIG_ENDIAN;
}
@@ -61,7 +61,7 @@ void disas_initialize_debug_target(CPUDebug *s, CPUState *cpu)
s->cpu = cpu;
s->info.print_address_func = print_address;
- if (target_words_bigendian()) {
+ if (qemu_binary_is_bigendian()) {
s->info.endian = BFD_ENDIAN_BIG;
} else {
s->info.endian = BFD_ENDIAN_LITTLE;
@@ -129,7 +129,7 @@ bool cpu_virtio_is_big_endian(CPUState *cpu)
if (cc->sysemu_ops->virtio_is_big_endian) {
return cc->sysemu_ops->virtio_is_big_endian(cpu);
}
- return target_words_bigendian();
+ return qemu_binary_is_bigendian();
}
GuestPanicInformation *cpu_get_crash_info(CPUState *cpu)
@@ -134,7 +134,7 @@ static void generic_loader_realize(DeviceState *dev, Error **errp)
s->cpu = first_cpu;
}
- big_endian = target_words_bigendian();
+ big_endian = qemu_binary_is_bigendian();
if (s->file) {
AddressSpace *as = s->cpu ? s->cpu->as : NULL;
@@ -2116,7 +2116,7 @@ static bool vga_endian_state_needed(void *opaque)
* default one, thus ensuring backward compatibility for
* migration of the common case
*/
- return s->big_endian_fb != target_words_bigendian();
+ return s->big_endian_fb != qemu_binary_is_bigendian();
}
static const VMStateDescription vmstate_vga_endian = {
@@ -2264,7 +2264,7 @@ bool vga_common_init(VGACommonState *s, Object *obj, Error **errp)
* into a device attribute set by the machine/platform to remove
* all target endian dependencies from this file.
*/
- s->big_endian_fb = target_words_bigendian();
+ s->big_endian_fb = qemu_binary_is_bigendian();
vga_dirty_log_start(s);
@@ -2248,7 +2248,7 @@ int virtio_set_status(VirtIODevice *vdev, uint8_t val)
static enum virtio_device_endian virtio_default_endian(void)
{
- if (target_words_bigendian()) {
+ if (qemu_binary_is_bigendian()) {
return VIRTIO_DEVICE_ENDIAN_BIG;
} else {
return VIRTIO_DEVICE_ENDIAN_LITTLE;
@@ -704,7 +704,7 @@ static void qtest_process_command(CharBackend *chr, gchar **words)
qtest_send(chr, "OK\n");
} else if (strcmp(words[0], "endianness") == 0) {
qtest_send_prefix(chr);
- if (target_words_bigendian()) {
+ if (qemu_binary_is_bigendian()) {
qtest_sendf(chr, "OK big\n");
} else {
qtest_sendf(chr, "OK little\n");
target_words_bigendian() doesn't return whether a target vCPU expects data in big-endian order, but whether the *binary* has been compiled with big-endian flavor by default. Rename it appropriately to reduce confusion. Mechanical change doing: $ sed -i -e s/target_words_bigendian/qemu_binary_is_bigendian/ \ $(git grep -l target_words_bigendian) Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- include/exec/tswap.h | 18 +++++++++--------- cpu-target.c | 2 +- disas/disas-common.c | 2 +- hw/core/cpu-sysemu.c | 2 +- hw/core/generic-loader.c | 2 +- hw/display/vga.c | 4 ++-- hw/virtio/virtio.c | 2 +- system/qtest.c | 2 +- 8 files changed, 17 insertions(+), 17 deletions(-)