This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
RedBoot - use LMA in ELF loader
- From: Gary Thomas <gary at mlbassoc dot com>
- To: eCos patches <ecos-patches at sources dot redhat dot com>
- Date: 29 Sep 2003 08:50:57 -0600
- Subject: RedBoot - use LMA in ELF loader
- Organization: MLB Associates
See discussion on ecos-discuss for details.
--
Gary Thomas <gary@mlbassoc.com>
MLB Associates
Index: redboot/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/redboot/current/ChangeLog,v
retrieving revision 1.141
diff -u -5 -p -r1.141 ChangeLog
--- redboot/current/ChangeLog 26 Sep 2003 18:44:01 -0000 1.141
+++ redboot/current/ChangeLog 29 Sep 2003 14:49:28 -0000
@@ -1,5 +1,12 @@
+2003-09-29 Gary Thomas <gary@mlbassoc.com>
+
+ * src/load.c (load_elf_image): Use LMA (loader memory address), instead
+ of VMA (virtual memory address) to load code. If LMA != VMA, it's up
+ to the loaded program to figure it out.
+ Inspired by Artur Lipowski <LAL@pro.onet.pl>
+
2003-09-26 Nick Garnett <nickg@balti.calivar.com>
* doc/redboot_installing.sgml: Fixed bogus memory sizes in AT91
EB42/55 description.
Index: redboot/current/src/load.c
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/redboot/current/src/load.c,v
retrieving revision 1.34
diff -u -5 -p -r1.34 load.c
--- redboot/current/src/load.c 19 Sep 2003 17:11:34 -0000 1.34
+++ redboot/current/src/load.c 29 Sep 2003 14:47:12 -0000
@@ -338,22 +338,22 @@ 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++) {
- if (phdr[phx].p_vaddr < addr_offset) {
- addr_offset = phdr[phx].p_vaddr;
+ if (phdr[phx].p_paddr < addr_offset) {
+ addr_offset = phdr[phx].p_paddr;
}
}
addr_offset = (unsigned long)base - addr_offset;
} else {
addr_offset = 0;
}
for (phx = 0; phx < ehdr.e_phnum; phx++) {
if (phdr[phx].p_type == PT_LOAD) {
// Loadable segment
- addr = (unsigned char *)phdr[phx].p_vaddr;
+ addr = (unsigned char *)phdr[phx].p_paddr;
len = phdr[phx].p_filesz;
if ((unsigned long)addr < lowest_address) {
lowest_address = (unsigned long)addr;
}
addr += addr_offset;