Changeset 544a2e4 in mainline for uspace/srv/loader/elf_load.c
- Timestamp:
- 2011-05-30T21:37:43Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7b712b60
- Parents:
- 18ba2e4f (diff), 0743493a (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
r18ba2e4f r544a2e4 2 2 * Copyright (c) 2006 Sergey Bondari 3 3 * Copyright (c) 2006 Jakub Jermar 4 * Copyright (c) 20 08Jiri Svoboda4 * Copyright (c) 2011 Jiri Svoboda 5 5 * All rights reserved. 6 6 * … … 53 53 #include <smc.h> 54 54 #include <loader/pcb.h> 55 #include <entry_point.h> 55 56 56 57 #include "elf.h" 57 58 #include "elf_load.h" 58 #include "arch.h"59 59 60 60 #define DPRINTF(...) … … 103 103 * 104 104 */ 105 int elf_load_file(const char *file_name, size_t so_bias, elf_info_t *info) 105 int elf_load_file(const char *file_name, size_t so_bias, eld_flags_t flags, 106 elf_info_t *info) 106 107 { 107 108 elf_ld_t elf; … … 118 119 elf.fd = fd; 119 120 elf.info = info; 121 elf.flags = flags; 120 122 121 123 rc = elf_load(&elf, so_bias); … … 124 126 125 127 return rc; 126 }127 128 /** Run an ELF executable.129 *130 * Transfers control to the entry point of an ELF executable loaded131 * earlier with elf_load_file(). This function does not return.132 *133 * @param info Info structure filled earlier by elf_load_file()134 *135 */136 void elf_run(elf_info_t *info, pcb_t *pcb)137 {138 program_run(info->entry, pcb);139 140 /* not reached */141 128 } 142 129 … … 153 140 pcb->entry = info->entry; 154 141 pcb->dynamic = info->dynamic; 142 pcb->rtld_runtime = NULL; 155 143 } 156 144 … … 306 294 break; 307 295 case PT_INTERP: 308 /* Assume silently interp == "/ rtld.so" */309 elf->info->interp = "/ rtld.so";296 /* Assume silently interp == "/app/dload" */ 297 elf->info->interp = "/app/dload"; 310 298 break; 311 299 case PT_DYNAMIC: 300 /* Record pointer to dynamic section into info structure */ 301 elf->info->dynamic = 302 (void *)((uint8_t *)entry->p_vaddr + elf->bias); 303 DPRINTF("dynamic section found at 0x%x\n", 304 (uintptr_t)elf->info->dynamic); 305 break; 306 case 0x70000000: 307 /* FIXME: MIPS reginfo */ 308 break; 312 309 case PT_SHLIB: 313 case PT_LOPROC:314 case PT_HIPROC:310 // case PT_LOPROC: 311 // case PT_HIPROC: 315 312 default: 316 313 DPRINTF("Segment p_type %d unknown.\n", entry->p_type); … … 383 380 AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE); 384 381 if (a == (void *)(-1)) { 385 DPRINTF("Memory mapping failed.\n"); 382 DPRINTF("memory mapping failed (0x%x, %d)\n", 383 base+bias, mem_sz); 386 384 return EE_MEMORY; 387 385 } … … 425 423 } 426 424 425 /* 426 * The caller wants to modify the segments first. He will then 427 * need to set the right access mode and ensure SMC coherence. 428 */ 429 if ((elf->flags & ELDF_RW) != 0) return EE_OK; 430 431 // printf("set area flags to %d\n", flags); 427 432 rc = as_area_change_flags(seg_ptr, flags); 428 433 if (rc != 0) {
Note:
See TracChangeset
for help on using the changeset viewer.