Mercurial > ecos
diff packages/redboot/current/src/load.c @ 1724:549e69d9a7d0
* cdl/redboot.cdl:
* src/net/net_io.c: added CDL to allow the default server to
be configured. Also respect the CYGSEM_REDBOOT_DEFAULT_NO_BOOTP
setting.
* cdl/redboot.cdl:
* src/load.c: Added cdl to control the size of the buffer used
by getc. The size can have significant affect on load speed
when loading from a filesystem.
* cdl/redboot.cdl
* src/load.c (load_elf_image): Added a CDL option to configure
if the physical or virtual address in the headers should be used
when loading the image.
* cdl/redboot.cdl
* src/fs/fileio.c (do_ls) Added an ls command so we can see what
is inside the mounted filesystem.
| author | asl |
|---|---|
| date | Sat, 21 Aug 2004 12:43:31 +0000 |
| parents | 43a89c18d005 |
| children | b2a8f9509f6f |
line wrap: on
line diff
--- a/packages/redboot/current/src/load.c +++ b/packages/redboot/current/src/load.c @@ -104,7 +104,7 @@ CYG_HAL_TABLE_END( __RedBoot_LOAD_TAB_EN extern struct load_io_entry __RedBoot_LOAD_TAB__[], __RedBoot_LOAD_TAB_END__; // Buffers, data used by redboot_getc -#define BUF_SIZE 256 +#define BUF_SIZE CYGNUM_REDBOOT_GETC_BUFFER struct { getc_io_funcs_t *io; int (*fun)(char *, int len, int *err); @@ -346,9 +346,14 @@ load_elf_image(getc_t getc, unsigned lon if (base) { // Set address offset based on lowest address in file. addr_offset = 0xFFFFFFFF; - for (phx = 0; phx < ehdr.e_phnum; phx++) { + for (phx = 0; phx < ehdr.e_phnum; phx++) { +#ifdef CYGOPT_REDBOOT_ELF_VIRTUAL_ADDRESS + if ((phdr[phx].p_type == PT_LOAD) && (phdr[phx].p_vaddr < addr_offset)) { + addr_offset = phdr[phx].p_vaddr; +#else if ((phdr[phx].p_type == PT_LOAD) && (phdr[phx].p_paddr < addr_offset)) { addr_offset = phdr[phx].p_paddr; +#endif } } addr_offset = (unsigned long)base - addr_offset; @@ -358,7 +363,11 @@ load_elf_image(getc_t getc, unsigned lon for (phx = 0; phx < ehdr.e_phnum; phx++) { if (phdr[phx].p_type == PT_LOAD) { // Loadable segment +#ifdef CYGOPT_REDBOOT_ELF_VIRTUAL_ADDRESS + addr = (unsigned char *)phdr[phx].p_vaddr; +#else addr = (unsigned char *)phdr[phx].p_paddr; +#endif len = phdr[phx].p_filesz; if ((unsigned long)addr < lowest_address) { lowest_address = (unsigned long)addr; @@ -379,6 +388,7 @@ load_elf_image(getc_t getc, unsigned lon offset++; } } + // Copy data into memory while (len-- > 0) { #ifdef CYGSEM_REDBOOT_VALIDATE_USER_RAM_LOADS @@ -400,6 +410,7 @@ load_elf_image(getc_t getc, unsigned lon } } } + // Save load base/top and entry if (base) { load_address = base;
