loader: Add data swap option to load-elf
commit051187da95a38404e0cb1e76d8c41e21248e0cd2
authorPeter Crosthwaite <crosthwaite.peter@gmail.com>
Mon, 18 Jan 2016 01:07:03 +0000 (17 17:07 -0800)
committerPeter Crosthwaite <crosthwaite.peter@gmail.com>
Sun, 28 Feb 2016 05:49:54 +0000 (27 21:49 -0800)
treec84bfebbd1f73e0fe821f1c12aefe454e23932d5
parent2f07b47fd24acb237502f39c54adaebb055cd6c1
loader: Add data swap option to load-elf

Some CPUs are of an opposite data-endianness to other components in the
system. Sometimes elfs have the data sections layed out with this CPU
data-endianess accounting for when loaded via the CPU, byte swaps
(relative to other system components) will occur.

The leading example, is ARM's BE32 mode, which is is basically LE with
address manipulation on half-word and byte accesses to access the
hw/byte reversed address. This means that word data is invariant
accross LE and BE32. This also means that instructions are still LE.
The expectation is that the elf will be loaded via the CPU in this
endianness scheme, which means the data in the elf is reversed at
compile time.

As QEMU loads via the system memory directly, rather than the CPU, we
need a mechanism to reverse elf data endianness to implement this
possibility.

---CHANGELOG---
changed since v1:
Added doc comment (PMM review)
---END---

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
34 files changed:
hw/alpha/dp264.c
hw/arm/armv7m.c
hw/arm/boot.c
hw/core/loader.c
hw/cris/boot.c
hw/i386/multiboot.c
hw/lm32/lm32_boards.c
hw/lm32/milkymist.c
hw/m68k/an5206.c
hw/m68k/dummy_m68k.c
hw/m68k/mcf5208.c
hw/microblaze/boot.c
hw/mips/mips_fulong2e.c
hw/mips/mips_malta.c
hw/mips/mips_mipssim.c
hw/mips/mips_r4k.c
hw/moxie/moxiesim.c
hw/openrisc/openrisc_sim.c
hw/pci-host/prep.c
hw/ppc/e500.c
hw/ppc/mac_newworld.c
hw/ppc/mac_oldworld.c
hw/ppc/ppc440_bamboo.c
hw/ppc/spapr.c
hw/ppc/virtex_ml507.c
hw/s390x/ipl.c
hw/sparc/leon3.c
hw/sparc/sun4m.c
hw/sparc64/sun4u.c
hw/tricore/tricore_testboard.c
hw/xtensa/sim.c
hw/xtensa/xtfpga.c
include/hw/elf_ops.h
include/hw/loader.h