Message ID | 20250127113824.50177-4-philmd@linaro.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | hw/loader: Pass ELFDATA endian order argument to load_elf() | expand |
On Mon, 27 Jan 2025, Philippe Mathieu-Daudé wrote: > load_elf_ram_sym() compares target_data_order versus > host data_order. Rename 'data_order' -> 'host_data_order' > to ease code review. > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu> > --- > hw/core/loader.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/hw/core/loader.c b/hw/core/loader.c > index ead10fb6cb5..fc2e8f91267 100644 > --- a/hw/core/loader.c > +++ b/hw/core/loader.c > @@ -443,7 +443,7 @@ ssize_t load_elf_ram_sym(const char *filename, > int clear_lsb, int data_swab, > AddressSpace *as, bool load_rom, symbol_fn_t sym_cb) > { > - int fd, data_order, target_data_order, must_swab; > + int fd, host_data_order, target_data_order, must_swab; > ssize_t ret = ELF_LOAD_FAILED; > uint8_t e_ident[EI_NIDENT]; > > @@ -462,11 +462,11 @@ ssize_t load_elf_ram_sym(const char *filename, > goto fail; > } > #if HOST_BIG_ENDIAN > - data_order = ELFDATA2MSB; > + host_data_order = ELFDATA2MSB; > #else > - data_order = ELFDATA2LSB; > + host_data_order = ELFDATA2LSB; > #endif > - must_swab = data_order != e_ident[EI_DATA]; > + must_swab = host_data_order != e_ident[EI_DATA]; > if (big_endian) { > target_data_order = ELFDATA2MSB; > } else { >
On 1/27/25 03:38, Philippe Mathieu-Daudé wrote: > load_elf_ram_sym() compares target_data_order versus > host data_order. Rename 'data_order' -> 'host_data_order' > to ease code review. > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> > --- > hw/core/loader.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) Reviewed-by: Richard Henderson <richard.henderson@linaro.org> r~
On 1/27/25 03:38, Philippe Mathieu-Daudé wrote: > #if HOST_BIG_ENDIAN > - data_order = ELFDATA2MSB; > + host_data_order = ELFDATA2MSB; > #else > - data_order = ELFDATA2LSB; > + host_data_order = ELFDATA2LSB; > #endif Worth squashing host_data_order = HOST_BIG_ENDIAN ? ELFDATA2MSB : ELFDATA2LSB; ? r~
diff --git a/hw/core/loader.c b/hw/core/loader.c index ead10fb6cb5..fc2e8f91267 100644 --- a/hw/core/loader.c +++ b/hw/core/loader.c @@ -443,7 +443,7 @@ ssize_t load_elf_ram_sym(const char *filename, int clear_lsb, int data_swab, AddressSpace *as, bool load_rom, symbol_fn_t sym_cb) { - int fd, data_order, target_data_order, must_swab; + int fd, host_data_order, target_data_order, must_swab; ssize_t ret = ELF_LOAD_FAILED; uint8_t e_ident[EI_NIDENT]; @@ -462,11 +462,11 @@ ssize_t load_elf_ram_sym(const char *filename, goto fail; } #if HOST_BIG_ENDIAN - data_order = ELFDATA2MSB; + host_data_order = ELFDATA2MSB; #else - data_order = ELFDATA2LSB; + host_data_order = ELFDATA2LSB; #endif - must_swab = data_order != e_ident[EI_DATA]; + must_swab = host_data_order != e_ident[EI_DATA]; if (big_endian) { target_data_order = ELFDATA2MSB; } else {
load_elf_ram_sym() compares target_data_order versus host data_order. Rename 'data_order' -> 'host_data_order' to ease code review. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- hw/core/loader.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)