Changeset 04803bf in mainline for uspace/srv/loader/elf_load.c
- Timestamp:
- 2011-03-21T22:00:17Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 143932e
- Parents:
- b50b5af2 (diff), 7308e84 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/loader/elf_load.c
rb50b5af2 r04803bf 60 60 #define DPRINTF(...) 61 61 62 static c har *error_codes[] = {62 static const char *error_codes[] = { 63 63 "no error", 64 64 "invalid image", … … 95 95 * pointed to by @a info. 96 96 * 97 * @param file_name 98 * @param so_bias 99 * @param info 100 * 97 * @param file_name Path to the ELF file. 98 * @param so_bias Bias to use if the file is a shared object. 99 * @param info Pointer to a structure for storing information 100 * extracted from the binary. 101 101 * 102 102 * @return EOK on success or negative error code. 103 */ 104 int elf_load_file(char *file_name, size_t so_bias, eld_flags_t flags, 103 * 104 */ 105 int elf_load_file(const char *file_name, size_t so_bias, eld_flags_t flags, 105 106 elf_info_t *info) 106 107 { … … 109 110 int fd; 110 111 int rc; 111 112 112 113 fd = open(file_name, O_RDONLY); 113 114 if (fd < 0) { … … 269 270 * @return NULL terminated description of error. 270 271 */ 271 c har *elf_error(unsigned int rc)272 const char *elf_error(unsigned int rc) 272 273 { 273 274 assert(rc < sizeof(error_codes) / sizeof(char *)); … … 287 288 case PT_NULL: 288 289 case PT_PHDR: 290 case PT_NOTE: 289 291 break; 290 292 case PT_LOAD: … … 306 308 break; 307 309 case PT_SHLIB: 308 case PT_NOTE:309 310 // case PT_LOPROC: 310 311 // case PT_HIPROC: … … 340 341 seg_ptr = (void *) seg_addr; 341 342 342 DPRINTF("Load segment at addr 0x%x, size 0x%x\n",seg_addr,343 entry->p_memsz); 343 DPRINTF("Load segment at addr %p, size 0x%x\n", (void *) seg_addr, 344 entry->p_memsz); 344 345 345 346 if (entry->p_align > 1) { … … 368 369 mem_sz = entry->p_memsz + (entry->p_vaddr - base); 369 370 370 DPRINTF("Map to seg_addr=0x%x-0x%x.\n", seg_addr, 371 entry->p_vaddr + bias + ALIGN_UP(entry->p_memsz, PAGE_SIZE)); 371 DPRINTF("Map to seg_addr=%p-%p.\n", (void *) seg_addr, 372 (void *) (entry->p_vaddr + bias + 373 ALIGN_UP(entry->p_memsz, PAGE_SIZE))); 372 374 373 375 /* … … 383 385 } 384 386 385 DPRINTF("as_area_create( 0x%lx, 0x%x, %d) -> 0x%lx\n",386 base + bias, mem_sz, flags, (uintptr_t)a);387 DPRINTF("as_area_create(%p, %#zx, %d) -> %p\n", 388 (void *) (base + bias), mem_sz, flags, (void *) a); 387 389 388 390 /* … … 464 466 break; 465 467 case SHT_DYNAMIC: 468 /* Record pointer to dynamic section into info structure */ 469 elf->info->dynamic = 470 (void *)((uint8_t *)entry->sh_addr + elf->bias); 471 DPRINTF("Dynamic section found at %p.\n", 472 (void *) elf->info->dynamic); 466 473 break; 467 474 default:
Note:
See TracChangeset
for help on using the changeset viewer.