Changeset bfdb5af1 in mainline
- Timestamp:
- 2011-07-23T13:25:56Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- aa8053f1
- Parents:
- 90b8d58
- Location:
- uspace
- Files:
-
- 1 deleted
- 7 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/Makefile
r90b8d58 rbfdb5af1 69 69 generic/device/hw_res.c \ 70 70 generic/device/char_dev.c \ 71 generic/elf/elf_load.c \ 71 72 generic/event.c \ 72 73 generic/errno.c \ … … 132 133 generic/dlfcn.c \ 133 134 generic/rtld/rtld.c \ 134 generic/rtld/elf_load.c \135 135 generic/rtld/dynamic.c \ 136 136 generic/rtld/module.c \ -
uspace/lib/c/generic/elf/elf_load.c
r90b8d58 rbfdb5af1 29 29 */ 30 30 31 /** @addtogroup generic 31 /** @addtogroup generic 32 32 * @{ 33 33 */ … … 56 56 #include <entry_point.h> 57 57 58 #include "elf_load.h"58 #include <elf/elf_load.h> 59 59 60 60 #define DPRINTF(...) -
uspace/lib/c/generic/rtld/module.c
r90b8d58 rbfdb5af1 35 35 */ 36 36 37 #include <adt/list.h> 38 #include <elf/elf_load.h> 39 #include <fcntl.h> 40 #include <loader/pcb.h> 37 41 #include <stdio.h> 38 42 #include <stdlib.h> 39 43 #include <unistd.h> 40 #include <fcntl.h>41 #include <adt/list.h>42 #include <loader/pcb.h>43 44 44 45 #include <rtld/rtld.h> … … 47 48 #include <rtld/rtld_arch.h> 48 49 #include <rtld/module.h> 49 #include <elf_load.h>50 50 51 51 /** (Eagerly) process all relocation tables in a module. … … 93 93 module_t *module_find(const char *name) 94 94 { 95 link_t *head = &runtime_env->modules_head;96 97 link_t *cur;98 95 module_t *m; 99 96 const char *p, *soname; … … 110 107 111 108 /* Traverse list of all modules. Not extremely fast, but simple */ 112 DPRINTF("head = %p\n", head); 113 for (cur = head->next; cur != head; cur = cur->next) { 109 list_foreach(runtime_env->modules, cur) { 114 110 DPRINTF("cur = %p\n", cur); 115 111 m = list_get_instance(cur, module_t, modules_link); … … 177 173 178 174 /* Insert into the list of loaded modules */ 179 list_append(&m->modules_link, &runtime_env->modules _head);175 list_append(&m->modules_link, &runtime_env->modules); 180 176 181 177 return m; … … 249 245 void modules_process_relocs(module_t *start) 250 246 { 251 link_t *head = &runtime_env->modules_head; 252 253 link_t *cur; 254 module_t *m; 255 256 for (cur = head->next; cur != head; cur = cur->next) { 247 module_t *m; 248 249 list_foreach(runtime_env->modules, cur) { 257 250 m = list_get_instance(cur, module_t, modules_link); 258 251 … … 268 261 void modules_untag(void) 269 262 { 270 link_t *head = &runtime_env->modules_head; 271 272 link_t *cur; 273 module_t *m; 274 275 for (cur = head->next; cur != head; cur = cur->next) { 263 module_t *m; 264 265 list_foreach(runtime_env->modules, cur) { 276 266 m = list_get_instance(cur, module_t, modules_link); 277 267 m->bfs_tag = false; -
uspace/lib/c/generic/rtld/rtld.c
r90b8d58 rbfdb5af1 44 44 { 45 45 runtime_env = &rt_env_static; 46 list_initialize(&runtime_env->modules _head);46 list_initialize(&runtime_env->modules); 47 47 runtime_env->next_bias = 0x2000000; 48 48 runtime_env->program = NULL; -
uspace/lib/c/generic/rtld/symbol.c
r90b8d58 rbfdb5af1 38 38 #include <stdlib.h> 39 39 40 #include <elf/elf.h> 40 41 #include <rtld/rtld.h> 41 42 #include <rtld/rtld_debug.h> 42 43 #include <rtld/symbol.h> 43 #include <elf.h>44 44 45 45 /* … … 118 118 module_t *m, *dm; 119 119 elf_symbol_t *sym, *s; 120 li nk_t queue_head;120 list_t queue; 121 121 size_t i; 122 122 … … 132 132 133 133 /* Insert root (the program) into the queue and tag it */ 134 list_initialize(&queue _head);134 list_initialize(&queue); 135 135 start->bfs_tag = true; 136 list_append(&start->queue_link, &queue _head);136 list_append(&start->queue_link, &queue); 137 137 138 138 /* If the symbol is found, it will be stored in 'sym' */ … … 140 140 141 141 /* While queue is not empty */ 142 while (!list_empty(&queue _head)) {142 while (!list_empty(&queue)) { 143 143 /* Pop first element from the queue */ 144 m = list_get_instance( queue_head.next, module_t, queue_link);144 m = list_get_instance(list_first(&queue), module_t, queue_link); 145 145 list_remove(&m->queue_link); 146 146 … … 162 162 if (dm->bfs_tag == false) { 163 163 dm->bfs_tag = true; 164 list_append(&dm->queue_link, &queue _head);164 list_append(&dm->queue_link, &queue); 165 165 } 166 166 } … … 168 168 169 169 /* Empty the queue so that we leave it in a clean state */ 170 while (!list_empty(&queue _head))171 list_remove( queue_head.next);170 while (!list_empty(&queue)) 171 list_remove(list_first(&queue)); 172 172 173 173 if (!sym) { -
uspace/lib/c/include/rtld/rtld.h
r90b8d58 rbfdb5af1 49 49 50 50 /** List of all loaded modules including rtld and the program */ 51 li nk_t modules_head;51 list_t modules; 52 52 53 53 /** Temporary hack to place each module at different address. */ -
uspace/srv/loader/Makefile
r90b8d58 rbfdb5af1 39 39 LINKER_SCRIPT = $(LIBC_PREFIX)/arch/$(UARCH)/_link-loader.ld 40 40 41 EXTRA_CFLAGS = -Iinclude42 43 41 BINARY = loader 44 42 STATIC_ONLY = y … … 46 44 GENERIC_SOURCES = \ 47 45 main.c \ 48 elf_load.c \49 46 interp.s 50 47 -
uspace/srv/loader/main.c
r90b8d58 rbfdb5af1 60 60 #include <as.h> 61 61 #include <elf/elf.h> 62 63 #include "elf_load.h" 62 #include <elf/elf_load.h> 64 63 65 64 #ifdef CONFIG_RTLD … … 349 348 350 349 /* Initialize list of loaded modules */ 351 list_initialize(&runtime_env->modules _head);352 list_append(&prog_mod.modules_link, &runtime_env->modules _head);350 list_initialize(&runtime_env->modules); 351 list_append(&prog_mod.modules_link, &runtime_env->modules); 353 352 354 353 /* Pointer to program module. Used as root of the module graph. */
Note:
See TracChangeset
for help on using the changeset viewer.