Rev 3552 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3552 | Rev 3562 | ||
---|---|---|---|
Line 52... | Line 52... | ||
52 | void _rtld_main(void) |
52 | void _rtld_main(void) |
53 | { |
53 | { |
54 | static module_t prog; |
54 | static module_t prog; |
55 | // module_t *rtld; |
55 | // module_t *rtld; |
56 | 56 | ||
57 | printf("Hello, world! (from rtld)\n"); |
57 | DPRINTF("Hello, world! (from rtld)\n"); |
58 | 58 | ||
59 | /* |
59 | /* |
60 | * First we need to process dynamic sections of the two modules |
60 | * First we need to process dynamic sections of the two modules |
61 | * that have been already loaded, that is, of ourselves and of |
61 | * that have been already loaded, that is, of ourselves and of |
62 | * the executable program. |
62 | * the executable program. |
63 | */ |
63 | */ |
64 | 64 | ||
65 | /* rtld_dynamic and rtld->bias were filled out by the bootstrap code */ |
65 | /* rtld_dynamic and rtld->bias were filled out by the bootstrap code */ |
66 | // rtld = &runtime_env.rtld; |
66 | // rtld = &runtime_env.rtld; |
67 | // printf("Parse rtld .dynamic section at 0x%x\n", runtime_env.rtld_dynamic); |
67 | // DPRINTF("Parse rtld .dynamic section at 0x%x\n", runtime_env.rtld_dynamic); |
68 | // dynamic_parse(runtime_env.rtld_dynamic, rtld->bias, &rtld->dyn); |
68 | // dynamic_parse(runtime_env.rtld_dynamic, rtld->bias, &rtld->dyn); |
69 | 69 | ||
70 | printf("Parse program .dynamic section at 0x%x\n", __pcb->dynamic); |
70 | DPRINTF("Parse program .dynamic section at 0x%x\n", __pcb->dynamic); |
71 | dynamic_parse(__pcb->dynamic, 0, &prog.dyn); |
71 | dynamic_parse(__pcb->dynamic, 0, &prog.dyn); |
72 | prog.bias = 0; |
72 | prog.bias = 0; |
73 | prog.dyn.soname = "[program]"; |
73 | prog.dyn.soname = "[program]"; |
74 | 74 | ||
75 | /* Initialize list of loaded modules */ |
75 | /* Initialize list of loaded modules */ |
Line 82... | Line 82... | ||
82 | 82 | ||
83 | /* |
83 | /* |
84 | * Now we can continue with loading all other modules. |
84 | * Now we can continue with loading all other modules. |
85 | */ |
85 | */ |
86 | 86 | ||
87 | printf("Load all program dependencies\n"); |
87 | DPRINTF("Load all program dependencies\n"); |
88 | module_load_deps(&prog); |
88 | module_load_deps(&prog); |
89 | 89 | ||
90 | /* |
90 | /* |
91 | * Now relocate/link all modules together. |
91 | * Now relocate/link all modules together. |
92 | */ |
92 | */ |
93 | 93 | ||
94 | /* Process relocations in all modules */ |
94 | /* Process relocations in all modules */ |
95 | printf("Relocate all modules\n"); |
95 | DPRINTF("Relocate all modules\n"); |
96 | modules_process_relocs(); |
96 | modules_process_relocs(); |
97 | 97 | ||
98 | /* |
98 | /* |
99 | * Finally, run the main program. |
99 | * Finally, run the main program. |
100 | */ |
100 | */ |
101 | printf("Run program.. (at 0x%x)\n", (uintptr_t)__pcb->entry); |
101 | DPRINTF("Run program.. (at 0x%x)\n", (uintptr_t)__pcb->entry); |
- | 102 | ||
- | 103 | #ifndef RTLD_DEBUG |
|
- | 104 | close_console(); |
|
- | 105 | #endif |
|
102 | //__pcb->entry(); |
106 | //__pcb->entry(); |
103 | program_run(__pcb->entry, __pcb); |
107 | program_run(__pcb->entry, __pcb); |
104 | } |
108 | } |
105 | 109 | ||
106 | /** Fake main to satisfy dependency from libc */ |
110 | /** Fake main to satisfy dependency from libc */ |