mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 01:03:55 -06:00
hw/loader: Pass ELFDATA endian order argument to load_elf_as()
Rather than passing a boolean 'is_big_endian' argument, directly pass the ELFDATA, which can be unspecified using the ELFDATANONE value. Update the call sites: 0 -> ELFDATA2LSB 1 -> ELFDATA2MSB Note, this allow removing the target_words_bigendian() call in the GENERIC_LOADER device, where we pass ELFDATANONE. Suggested-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20250127113824.50177-6-philmd@linaro.org>
This commit is contained in:
parent
3cd6dbce75
commit
90f5c86acb
6 changed files with 16 additions and 20 deletions
|
@ -31,7 +31,6 @@
|
|||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "exec/tswap.h"
|
||||
#include "system/dma.h"
|
||||
#include "system/reset.h"
|
||||
#include "hw/boards.h"
|
||||
|
@ -66,7 +65,6 @@ static void generic_loader_realize(DeviceState *dev, Error **errp)
|
|||
{
|
||||
GenericLoaderState *s = GENERIC_LOADER(dev);
|
||||
hwaddr entry;
|
||||
int big_endian;
|
||||
ssize_t size = 0;
|
||||
|
||||
s->set_pc = false;
|
||||
|
@ -134,14 +132,12 @@ static void generic_loader_realize(DeviceState *dev, Error **errp)
|
|||
s->cpu = first_cpu;
|
||||
}
|
||||
|
||||
big_endian = target_words_bigendian();
|
||||
|
||||
if (s->file) {
|
||||
AddressSpace *as = s->cpu ? s->cpu->as : NULL;
|
||||
|
||||
if (!s->force_raw) {
|
||||
size = load_elf_as(s->file, NULL, NULL, NULL, &entry, NULL, NULL,
|
||||
NULL, big_endian, 0, 0, 0, as);
|
||||
NULL, ELFDATANONE, 0, 0, 0, as);
|
||||
|
||||
if (size < 0) {
|
||||
size = load_uimage_as(s->file, &entry, NULL, NULL, NULL, NULL,
|
||||
|
|
|
@ -413,7 +413,8 @@ ssize_t load_elf(const char *filename,
|
|||
int elf_machine, int clear_lsb, int data_swab)
|
||||
{
|
||||
return load_elf_as(filename, elf_note_fn, translate_fn, translate_opaque,
|
||||
pentry, lowaddr, highaddr, pflags, big_endian,
|
||||
pentry, lowaddr, highaddr, pflags,
|
||||
big_endian ? ELFDATA2MSB : ELFDATA2LSB,
|
||||
elf_machine, clear_lsb, data_swab, NULL);
|
||||
}
|
||||
|
||||
|
@ -422,14 +423,13 @@ ssize_t load_elf_as(const char *filename,
|
|||
uint64_t (*elf_note_fn)(void *, void *, bool),
|
||||
uint64_t (*translate_fn)(void *, uint64_t),
|
||||
void *translate_opaque, uint64_t *pentry, uint64_t *lowaddr,
|
||||
uint64_t *highaddr, uint32_t *pflags, int big_endian,
|
||||
uint64_t *highaddr, uint32_t *pflags, int elf_data_order,
|
||||
int elf_machine, int clear_lsb, int data_swab,
|
||||
AddressSpace *as)
|
||||
{
|
||||
return load_elf_ram_sym(filename, elf_note_fn,
|
||||
translate_fn, translate_opaque,
|
||||
pentry, lowaddr, highaddr, pflags,
|
||||
big_endian ? ELFDATA2MSB : ELFDATA2LSB,
|
||||
pentry, lowaddr, highaddr, pflags, elf_data_order,
|
||||
elf_machine, clear_lsb, data_swab, as,
|
||||
true, NULL);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue