diff options
author | Peter Crosthwaite <crosthwaitepeter@gmail.com> | 2016-03-04 11:30:21 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2016-03-04 11:30:21 +0000 |
commit | 7ef295ea5b412cbaf82f719ccd49efb51296e841 (patch) | |
tree | da99e5270fcf99285c0b5dfb787c4b304687843a /hw/m68k | |
parent | 140b7ce5fff6fc660b2484dfd9d33ed2e42ec5a9 (diff) | |
download | qemu-7ef295ea5b412cbaf82f719ccd49efb51296e841.zip qemu-7ef295ea5b412cbaf82f719ccd49efb51296e841.tar.gz qemu-7ef295ea5b412cbaf82f719ccd49efb51296e841.tar.bz2 |
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-endianness accounting for when loaded via the CPU, so 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
across 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.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/m68k')
-rw-r--r-- | hw/m68k/an5206.c | 2 | ||||
-rw-r--r-- | hw/m68k/dummy_m68k.c | 2 | ||||
-rw-r--r-- | hw/m68k/mcf5208.c | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/hw/m68k/an5206.c b/hw/m68k/an5206.c index d87b945..85f7277 100644 --- a/hw/m68k/an5206.c +++ b/hw/m68k/an5206.c @@ -73,7 +73,7 @@ static void an5206_init(MachineState *machine) } kernel_size = load_elf(kernel_filename, NULL, NULL, &elf_entry, - NULL, NULL, 1, EM_68K, 0); + NULL, NULL, 1, EM_68K, 0, 0); entry = elf_entry; if (kernel_size < 0) { kernel_size = load_uimage(kernel_filename, &entry, NULL, NULL, diff --git a/hw/m68k/dummy_m68k.c b/hw/m68k/dummy_m68k.c index a213bcf..3c2174b 100644 --- a/hw/m68k/dummy_m68k.c +++ b/hw/m68k/dummy_m68k.c @@ -50,7 +50,7 @@ static void dummy_m68k_init(MachineState *machine) /* Load kernel. */ if (kernel_filename) { kernel_size = load_elf(kernel_filename, NULL, NULL, &elf_entry, - NULL, NULL, 1, EM_68K, 0); + NULL, NULL, 1, EM_68K, 0, 0); entry = elf_entry; if (kernel_size < 0) { kernel_size = load_uimage(kernel_filename, &entry, NULL, NULL, diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c index 9597e86..4f49d34 100644 --- a/hw/m68k/mcf5208.c +++ b/hw/m68k/mcf5208.c @@ -276,7 +276,7 @@ static void mcf5208evb_init(MachineState *machine) } kernel_size = load_elf(kernel_filename, NULL, NULL, &elf_entry, - NULL, NULL, 1, EM_68K, 0); + NULL, NULL, 1, EM_68K, 0, 0); entry = elf_entry; if (kernel_size < 0) { kernel_size = load_uimage(kernel_filename, &entry, NULL, NULL, |