Changeset 8b5690f in mainline for uspace/srv/loader
- Timestamp:
- 2011-02-03T05:11:01Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ba38f72c
- Parents:
- 22027b6e (diff), 86d7bfa (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. - Location:
- uspace/srv/loader
- Files:
-
- 4 edited
-
arch/amd64/_link.ld.in (modified) (7 diffs)
-
arch/ia32/_link.ld.in (modified) (3 diffs)
-
elf_load.c (modified) (2 diffs)
-
main.c (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/loader/arch/amd64/_link.ld.in
r22027b6e r8b5690f 1 /* 2 * The difference from _link.ld.in for regular statically-linked apps 3 * is the base address and the special interp section. 4 */ 5 1 6 STARTUP(LIBC_PREFIX/arch/UARCH/src/entry.o) 2 7 ENTRY(__entry) … … 6 11 text PT_LOAD FLAGS(5); 7 12 data PT_LOAD FLAGS(6); 13 debug PT_NOTE; 8 14 } 9 15 … … 11 17 .interp : { 12 18 *(.interp); 13 } : interp14 15 /* . = 0x0000700000001000; */19 } :interp 20 21 /* . = 0x0000700000001000; */ 16 22 . = 0x70001000; 17 23 … … 19 25 *(.init); 20 26 } :text 27 21 28 .text : { 22 29 *(.text); … … 27 34 *(.data); 28 35 } :data 36 29 37 .tdata : { 30 38 _tdata_start = .; … … 32 40 _tdata_end = .; 33 41 } :data 42 34 43 .tbss : { 35 44 _tbss_start = .; … … 37 46 _tbss_end = .; 38 47 } :data 48 39 49 _tls_alignment = MAX(ALIGNOF(.tdata), ALIGNOF(.tbss)); 50 40 51 .bss : { 41 52 *(COMMON); 42 53 *(.bss); 43 54 } :data 44 55 45 56 . = ALIGN(0x1000); 46 57 _heap = .; 58 59 #ifdef CONFIG_LINE_DEBUG 60 .comment 0 : { *(.comment); } :debug 61 .debug_abbrev 0 : { *(.debug_abbrev); } :debug 62 .debug_aranges 0 : { *(.debug_aranges); } :debug 63 .debug_info 0 : { *(.debug_info); } :debug 64 .debug_line 0 : { *(.debug_line); } :debug 65 .debug_loc 0 : { *(.debug_loc); } :debug 66 .debug_pubnames 0 : { *(.debug_pubnames); } :debug 67 .debug_pubtypes 0 : { *(.debug_pubtypes); } :debug 68 .debug_ranges 0 : { *(.debug_ranges); } :debug 69 .debug_str 0 : { *(.debug_str); } :debug 70 #endif 47 71 48 72 /DISCARD/ : { 49 73 *(*); 50 74 } 51 52 75 } -
uspace/srv/loader/arch/ia32/_link.ld.in
r22027b6e r8b5690f 3 3 * is the base address and the special interp section. 4 4 */ 5 5 6 STARTUP(LIBC_PREFIX/arch/UARCH/src/entry.o) 6 7 ENTRY(__entry) … … 10 11 text PT_LOAD FILEHDR PHDRS FLAGS(5); 11 12 data PT_LOAD FLAGS(6); 13 debug PT_NOTE; 12 14 } 13 15 … … 53 55 54 56 . = ALIGN(0x1000); 57 _heap = .; 55 58 56 _heap = .; 59 #ifdef CONFIG_LINE_DEBUG 60 .comment 0 : { *(.comment); } :debug 61 .debug_abbrev 0 : { *(.debug_abbrev); } :debug 62 .debug_aranges 0 : { *(.debug_aranges); } :debug 63 .debug_info 0 : { *(.debug_info); } :debug 64 .debug_line 0 : { *(.debug_line); } :debug 65 .debug_loc 0 : { *(.debug_loc); } :debug 66 .debug_pubnames 0 : { *(.debug_pubnames); } :debug 67 .debug_pubtypes 0 : { *(.debug_pubtypes); } :debug 68 .debug_ranges 0 : { *(.debug_ranges); } :debug 69 .debug_str 0 : { *(.debug_str); } :debug 70 #endif 57 71 58 72 /DISCARD/ : { -
uspace/srv/loader/elf_load.c
r22027b6e r8b5690f 300 300 case PT_NULL: 301 301 case PT_PHDR: 302 case PT_NOTE: 302 303 break; 303 304 case PT_LOAD: … … 310 311 case PT_DYNAMIC: 311 312 case PT_SHLIB: 312 case PT_NOTE:313 313 case PT_LOPROC: 314 314 case PT_HIPROC: -
uspace/srv/loader/main.c
r22027b6e r8b5690f 50 50 #include <fcntl.h> 51 51 #include <sys/types.h> 52 #include <ipc/ipc.h>53 52 #include <ipc/services.h> 54 53 #include <ipc/loader.h> … … 95 94 96 95 /** Used to limit number of connections to one. */ 97 static bool connected ;96 static bool connected = false; 98 97 99 98 static void ldr_get_taskid(ipc_callid_t rid, ipc_call_t *request) … … 106 105 107 106 if (!async_data_read_receive(&callid, &len)) { 108 ipc_answer_0(callid, EINVAL);109 ipc_answer_0(rid, EINVAL);107 async_answer_0(callid, EINVAL); 108 async_answer_0(rid, EINVAL); 110 109 return; 111 110 } … … 115 114 116 115 async_data_read_finalize(callid, &task_id, len); 117 ipc_answer_0(rid, EOK);116 async_answer_0(rid, EOK); 118 117 } 119 118 … … 135 134 } 136 135 137 ipc_answer_0(rid, rc);136 async_answer_0(rid, rc); 138 137 } 139 138 … … 155 154 } 156 155 157 ipc_answer_0(rid, rc);156 async_answer_0(rid, rc); 158 157 } 159 158 … … 188 187 if (_argv == NULL) { 189 188 free(buf); 190 ipc_answer_0(rid, ENOMEM);189 async_answer_0(rid, ENOMEM); 191 190 return; 192 191 } … … 220 219 } 221 220 222 ipc_answer_0(rid, rc);221 async_answer_0(rid, rc); 223 222 } 224 223 … … 244 243 if (_filv == NULL) { 245 244 free(buf); 246 ipc_answer_0(rid, ENOMEM);245 async_answer_0(rid, ENOMEM); 247 246 return; 248 247 } … … 271 270 } 272 271 273 ipc_answer_0(rid, EOK);272 async_answer_0(rid, EOK); 274 273 } 275 274 … … 287 286 if (rc != EE_OK) { 288 287 DPRINTF("Failed to load executable '%s'.\n", pathname); 289 ipc_answer_0(rid, EINVAL);288 async_answer_0(rid, EINVAL); 290 289 return 1; 291 290 } … … 304 303 /* Statically linked program */ 305 304 is_dyn_linked = false; 306 ipc_answer_0(rid, EOK);305 async_answer_0(rid, EOK); 307 306 return 0; 308 307 } … … 312 311 DPRINTF("Failed to load interpreter '%s.'\n", 313 312 prog_info.interp); 314 ipc_answer_0(rid, EINVAL);313 async_answer_0(rid, EINVAL); 315 314 return 1; 316 315 } 317 316 318 317 is_dyn_linked = true; 319 ipc_answer_0(rid, EOK);318 async_answer_0(rid, EOK); 320 319 321 320 return 0; … … 343 342 DPRINTF("Entry point: %p\n", interp_info.entry); 344 343 345 ipc_answer_0(rid, EOK);344 async_answer_0(rid, EOK); 346 345 elf_run(&interp_info, &pcb); 347 346 } else { 348 347 /* Statically linked program */ 349 ipc_answer_0(rid, EOK);348 async_answer_0(rid, EOK); 350 349 elf_run(&prog_info, &pcb); 351 350 } … … 367 366 /* Already have a connection? */ 368 367 if (connected) { 369 ipc_answer_0(iid, ELIMIT);368 async_answer_0(iid, ELIMIT); 370 369 return; 371 370 } … … 374 373 375 374 /* Accept the connection */ 376 ipc_answer_0(iid, EOK);375 async_answer_0(iid, EOK); 377 376 378 377 /* Ignore parameters, the connection is already open */ … … 414 413 DPRINTF("Responding EINVAL to method %d.\n", 415 414 IPC_GET_IMETHOD(call)); 416 ipc_answer_0(callid, EINVAL);415 async_answer_0(callid, EINVAL); 417 416 } 418 417 } … … 423 422 int main(int argc, char *argv[]) 424 423 { 425 sysarg_t phonead; 426 task_id_t id; 427 int rc; 428 429 connected = false; 430 424 /* Set a handler of incomming connections. */ 425 async_set_client_connection(ldr_connection); 426 431 427 /* Introduce this task to the NS (give it our task ID). */ 432 id = task_get_id();433 rc = async_req_2_0(PHONE_NS, NS_ID_INTRO, LOWER32(id), UPPER32(id));428 task_id_t id = task_get_id(); 429 int rc = async_req_2_0(PHONE_NS, NS_ID_INTRO, LOWER32(id), UPPER32(id)); 434 430 if (rc != EOK) 435 431 return -1; 436 437 /* Set a handler of incomming connections. */438 async_set_client_connection(ldr_connection);439 432 440 433 /* Register at naming service. */ 441 if ( ipc_connect_to_me(PHONE_NS, SERVICE_LOAD, 0, 0, &phonead) != 0)434 if (service_register(SERVICE_LOAD) != EOK) 442 435 return -2; 443 436 444 437 async_manager(); 445 438
Note:
See TracChangeset
for help on using the changeset viewer.
