comparison packages/redboot/current/src/load.c @ 1253:9ecd8873f657

Use LMA, not VMA
author gthomas
date Mon, 29 Sep 2003 14:49:46 +0000
parents dbcfe4e0dbd2
children 94e373b3fc8d
comparison
equal deleted inserted replaced
1252:4dfb5c337649 1253:9ecd8873f657
338 } 338 }
339 if (base) { 339 if (base) {
340 // Set address offset based on lowest address in file. 340 // Set address offset based on lowest address in file.
341 addr_offset = 0xFFFFFFFF; 341 addr_offset = 0xFFFFFFFF;
342 for (phx = 0; phx < ehdr.e_phnum; phx++) { 342 for (phx = 0; phx < ehdr.e_phnum; phx++) {
343 if (phdr[phx].p_vaddr < addr_offset) { 343 if (phdr[phx].p_paddr < addr_offset) {
344 addr_offset = phdr[phx].p_vaddr; 344 addr_offset = phdr[phx].p_paddr;
345 } 345 }
346 } 346 }
347 addr_offset = (unsigned long)base - addr_offset; 347 addr_offset = (unsigned long)base - addr_offset;
348 } else { 348 } else {
349 addr_offset = 0; 349 addr_offset = 0;
350 } 350 }
351 for (phx = 0; phx < ehdr.e_phnum; phx++) { 351 for (phx = 0; phx < ehdr.e_phnum; phx++) {
352 if (phdr[phx].p_type == PT_LOAD) { 352 if (phdr[phx].p_type == PT_LOAD) {
353 // Loadable segment 353 // Loadable segment
354 addr = (unsigned char *)phdr[phx].p_vaddr; 354 addr = (unsigned char *)phdr[phx].p_paddr;
355 len = phdr[phx].p_filesz; 355 len = phdr[phx].p_filesz;
356 if ((unsigned long)addr < lowest_address) { 356 if ((unsigned long)addr < lowest_address) {
357 lowest_address = (unsigned long)addr; 357 lowest_address = (unsigned long)addr;
358 } 358 }
359 addr += addr_offset; 359 addr += addr_offset;