Rev 3562 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3562 | Rev 3673 | ||
---|---|---|---|
Line 47... | Line 47... | ||
47 | 47 | ||
48 | runtime_env_t runtime_env; |
48 | runtime_env_t runtime_env; |
49 | 49 | ||
50 | void program_run(void *entry, pcb_t *pcb); |
50 | void program_run(void *entry, pcb_t *pcb); |
51 | 51 | ||
52 | 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; |
55 | // module_t *rtld; |
56 | 56 | ||
57 | DPRINTF("Hello, world! (from rtld)\n"); |
57 | DPRINTF("Hello, world! (from rtld)\n"); |
Line 73... | Line 73... | ||
73 | prog.dyn.soname = "[program]"; |
73 | prog.dyn.soname = "[program]"; |
74 | 74 | ||
75 | /* Initialize list of loaded modules */ |
75 | /* Initialize list of loaded modules */ |
76 | list_initialize(&runtime_env.modules_head); |
76 | list_initialize(&runtime_env.modules_head); |
77 | list_append(&prog.modules_link, &runtime_env.modules_head); |
77 | list_append(&prog.modules_link, &runtime_env.modules_head); |
78 | // list_append(&rtld->modules_link, &runtime_env.modules_head); |
- | |
79 | 78 | ||
80 | /* Pointer to program module. Used as root of the dependency graph */ |
79 | /* Pointer to program module. Used as root of the dependency graph */ |
81 | runtime_env.program = &prog; |
80 | runtime_env.program = &prog; |
82 | 81 | ||
83 | /* |
82 | /* |
Line 96... | Line 95... | ||
96 | modules_process_relocs(); |
95 | modules_process_relocs(); |
97 | 96 | ||
98 | /* |
97 | /* |
99 | * Finally, run the main program. |
98 | * Finally, run the main program. |
100 | */ |
99 | */ |
101 | DPRINTF("Run program.. (at 0x%x)\n", (uintptr_t)__pcb->entry); |
100 | DPRINTF("Run program.. (at 0x%lx)\n", (uintptr_t)__pcb->entry); |
102 | 101 | ||
103 | #ifndef RTLD_DEBUG |
102 | #ifndef RTLD_DEBUG |
104 | close_console(); |
103 | close_console(); |
105 | #endif |
104 | #endif |
106 | //__pcb->entry(); |
- | |
107 | program_run(__pcb->entry, __pcb); |
105 | program_run(__pcb->entry, __pcb); |
108 | } |
106 | } |
109 | 107 | ||
110 | /** Fake main to satisfy dependency from libc */ |
108 | /** Fake main to satisfy dependency from libc */ |
111 | int main(int argc, char *argv[]) |
109 | int main(int argc, char *argv[]) |
112 | { |
110 | { |
- | 111 | rtld_main(); |
|
113 | return 0; |
112 | return 0; |
114 | } |
113 | } |
115 | /* |
- | |
116 | typedef void (*ep2)(void *); |
- | |
117 | - | ||
118 | void program_run(void *entry, pcb_t *pcb) |
- | |
119 | { |
- | |
120 | asm ( |
- | |
121 | // "xorl %%ebx, %%ebx\n" |
- | |
122 | // "movl 0(%%ebx), %%ecx\n" |
- | |
123 | "mov %%eax, %%ebx\n" |
- | |
124 | "jmp *%0\n" |
- | |
125 | :: "m" (entry), "a" (pcb) |
- | |
126 | ); |
- | |
127 | }*/ |
- | |
128 | 114 | ||
129 | /** @} |
115 | /** @} |
130 | */ |
116 | */ |