summary refs log tree commit diff stats
path: root/hw/core/loader.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2025-03-19 12:54:31 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2025-03-21 12:51:16 +0100
commit134ab17fffb32a3f86debb4eec9df12f7f833a3b (patch)
tree46f26c5fff8280a3a17ce4ca4a7723b76d60cba9 /hw/core/loader.c
parentcc3d262aa93a42e19c38f6acb6d0f6012a71eb4b (diff)
downloadfocaccia-qemu-134ab17fffb32a3f86debb4eec9df12f7f833a3b.tar.gz
focaccia-qemu-134ab17fffb32a3f86debb4eec9df12f7f833a3b.zip
load_aout: replace bswap_needed with big_endian
Targets know whether they are big-endian more than they know if
the endianness is different from the host: the former is mostly
a constant, at least in machine creation code, while the latter
has to be computed with TARGET_BIG_ENDIAN != HOST_BIG_ENDIAN or
something like that.

load_aout, however, takes a "bswap_needed" argument.  Replace
it with a "big_endian" argument; even though all users are
big-endian, it is cheap enough to keep the optional swapping
functionality even for little-endian boards.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/core/loader.c')
-rw-r--r--hw/core/loader.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/core/loader.c b/hw/core/loader.c
index ce6ff1b52e..2e35f0aa90 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -226,7 +226,7 @@ static void bswap_ahdr(struct exec *e)
 
 
 ssize_t load_aout(const char *filename, hwaddr addr, int max_sz,
-                  int bswap_needed, hwaddr target_page_size)
+                  bool big_endian, hwaddr target_page_size)
 {
     int fd;
     ssize_t size, ret;
@@ -241,7 +241,7 @@ ssize_t load_aout(const char *filename, hwaddr addr, int max_sz,
     if (size < 0)
         goto fail;
 
-    if (bswap_needed) {
+    if (big_endian != HOST_BIG_ENDIAN) {
         bswap_ahdr(&e);
     }