Rev 3673 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3673 | Rev 3677 | ||
---|---|---|---|
Line 50... | Line 50... | ||
50 | void program_run(void *entry, pcb_t *pcb); |
50 | void program_run(void *entry, pcb_t *pcb); |
51 | 51 | ||
52 | static void rtld_main(void) |
52 | static void rtld_main(void) |
53 | { |
53 | { |
54 | static module_t prog; |
54 | static module_t prog; |
55 | // module_t *rtld; |
- | |
56 | 55 | ||
57 | DPRINTF("Hello, world! (from rtld)\n"); |
56 | DPRINTF("Hello, world! (from rtld)\n"); |
58 | 57 | ||
59 | /* |
58 | /* |
60 | * First we need to process dynamic sections of the two modules |
59 | * First we need to process dynamic sections of the executable |
61 | * that have been already loaded, that is, of ourselves and of |
60 | * program and insert it into the module graph. |
62 | * the executable program. |
- | |
63 | */ |
61 | */ |
64 | 62 | ||
65 | /* rtld_dynamic and rtld->bias were filled out by the bootstrap code */ |
- | |
66 | // rtld = &runtime_env.rtld; |
- | |
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); |
- | |
69 | - | ||
70 | DPRINTF("Parse program .dynamic section at 0x%x\n", __pcb->dynamic); |
63 | DPRINTF("Parse program .dynamic section at 0x%x\n", __pcb->dynamic); |
71 | dynamic_parse(__pcb->dynamic, 0, &prog.dyn); |
64 | dynamic_parse(__pcb->dynamic, 0, &prog.dyn); |
72 | prog.bias = 0; |
65 | prog.bias = 0; |
73 | prog.dyn.soname = "[program]"; |
66 | prog.dyn.soname = "[program]"; |
74 | 67 | ||
75 | /* Initialize list of loaded modules */ |
68 | /* Initialize list of loaded modules */ |
76 | list_initialize(&runtime_env.modules_head); |
69 | list_initialize(&runtime_env.modules_head); |
77 | list_append(&prog.modules_link, &runtime_env.modules_head); |
70 | list_append(&prog.modules_link, &runtime_env.modules_head); |
78 | 71 | ||
79 | /* Pointer to program module. Used as root of the dependency graph */ |
72 | /* Pointer to program module. Used as root of the module graph. */ |
80 | runtime_env.program = &prog; |
73 | runtime_env.program = &prog; |
81 | 74 | ||
82 | /* |
75 | /* |
83 | * Now we can continue with loading all other modules. |
76 | * Now we can continue with loading all other modules. |
84 | */ |
77 | */ |
Line 103... | Line 96... | ||
103 | close_console(); |
96 | close_console(); |
104 | #endif |
97 | #endif |
105 | program_run(__pcb->entry, __pcb); |
98 | program_run(__pcb->entry, __pcb); |
106 | } |
99 | } |
107 | 100 | ||
108 | /** Fake main to satisfy dependency from libc */ |
- | |
109 | int main(int argc, char *argv[]) |
101 | int main(int argc, char *argv[]) |
110 | { |
102 | { |
111 | rtld_main(); |
103 | rtld_main(); |
112 | return 0; |
104 | return 0; |
113 | } |
105 | } |