[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v1 16/17] loader: Add data swap option to load-e
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH v1 16/17] loader: Add data swap option to load-elf |
Date: |
Tue, 19 Jan 2016 17:53:28 +0000 |
On 18 January 2016 at 07:12, Peter Crosthwaite
<address@hidden> wrote:
> 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.
>
> Signed-off-by: Peter Crosthwaite <address@hidden>
> diff --git a/include/hw/loader.h b/include/hw/loader.h
> index 33067f8..e542575 100644
> --- a/include/hw/loader.h
> +++ b/include/hw/loader.h
> @@ -35,7 +35,7 @@ const char *load_elf_strerror(int error);
> int load_elf(const char *filename, uint64_t (*translate_fn)(void *,
> uint64_t),
> void *translate_opaque, uint64_t *pentry, uint64_t *lowaddr,
> uint64_t *highaddr, int big_endian, int elf_machine,
> - int clear_lsb);
> + int clear_lsb, int data_swab);
> void load_elf_hdr(const char *filename, void *hdr, bool *is64, Error **errp);
> int load_aout(const char *filename, hwaddr addr, int max_sz,
> int bswap_needed, hwaddr target_page_size);
Can we have a doc comment so we have something that defines what
values data_swab accepts? (it's not just a bool).
Otherwise
Reviewed-by: Peter Maydell <address@hidden>
thanks
-- PMM
- [Qemu-devel] [PATCH v1 10/17] target-arm: implement setend, (continued)
- [Qemu-devel] [PATCH v1 10/17] target-arm: implement setend, Peter Crosthwaite, 2016/01/18
- [Qemu-devel] [PATCH v1 13/17] arm: linux-user: don't set CPSR.E in BE32 mode, Peter Crosthwaite, 2016/01/18
- [Qemu-devel] [PATCH v1 14/17] target-arm: implement BE32 mode in system emulation, Peter Crosthwaite, 2016/01/18
- [Qemu-devel] [PATCH v1 12/17] target-arm: implement SCTLR.B, drop bswap_code, Peter Crosthwaite, 2016/01/18
- [Qemu-devel] [PATCH v1 16/17] loader: Add data swap option to load-elf, Peter Crosthwaite, 2016/01/18
- Re: [Qemu-devel] [PATCH v1 16/17] loader: Add data swap option to load-elf,
Peter Maydell <=
- [Qemu-devel] [PATCH v1 17/17] arm: boot: Support big-endian elfs, Peter Crosthwaite, 2016/01/18
- [Qemu-devel] [PATCH v1 15/17] loader: add API to load elf header, Peter Crosthwaite, 2016/01/18
- Re: [Qemu-devel] [PATCH v1 00/17] ARM big-endian and setend support, Peter Maydell, 2016/01/19