From ca20cf32ab3d945155141ef737f5d08ebb373e1d Mon Sep 17 00:00:00 2001 From: Blue Swirl Date: Sun, 20 Sep 2009 14:58:02 +0000 Subject: Compile loader only once Callers must pass ELF machine, byte swapping and symbol LSB clearing information to ELF loader. A.out loader needs page size information, pass that too as a parameter. Extract prototypes to a separate file. Move loader.[ch] and elf_ops.h under hw. Adjust callers. Also use target_phys_addr_t instead of target_ulong for addresses: loader addresses aren't virtual. Signed-off-by: Blue Swirl --- hw/loader.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 hw/loader.h (limited to 'hw/loader.h') diff --git a/hw/loader.h b/hw/loader.h new file mode 100644 index 0000000..3632008 --- /dev/null +++ b/hw/loader.h @@ -0,0 +1,21 @@ +#ifndef LOADER_H +#define LOADER_H + +/* loader.c */ +int get_image_size(const char *filename); +int load_image(const char *filename, uint8_t *addr); /* deprecated */ +int load_image_targphys(const char *filename, target_phys_addr_t, int max_sz); +int load_elf(const char *filename, int64_t address_offset, + uint64_t *pentry, uint64_t *lowaddr, uint64_t *highaddr, + int big_endian, int elf_machine, int clear_lsb); +int load_aout(const char *filename, target_phys_addr_t addr, int max_sz, + int bswap_needed, target_phys_addr_t target_page_size); +int load_uimage(const char *filename, target_phys_addr_t *ep, + target_phys_addr_t *loadaddr, int *is_linux); + +int fread_targphys(target_phys_addr_t dst_addr, size_t nbytes, FILE *f); +int fread_targphys_ok(target_phys_addr_t dst_addr, size_t nbytes, FILE *f); +int read_targphys(int fd, target_phys_addr_t dst_addr, size_t nbytes); +void pstrcpy_targphys(target_phys_addr_t dest, int buf_size, + const char *source); +#endif -- cgit v1.1