diff options
author | neal <neal> | 2008-01-25 17:40:49 +0000 |
---|---|---|
committer | neal <neal> | 2008-01-25 17:40:49 +0000 |
commit | 71e088e90865b4c7ced3a4fb30a3dc181beaf3c7 (patch) | |
tree | 84d296f313f9ac99d5c6da7bb5519e9d5ce61ecf /viengoos/viengoos.c | |
parent | 36e52965d767ed3ad156f7a0cbd350bce9516ff7 (diff) |
libc-parts/
2008-01-25 Neal H. Walfield <neal@gnu.org>
* loader.h: Include <stdint.h> and <stdbool.h>. Don't include
<l4/types.h>, "cap.h", or "as.h".
(struct activity): Remove forward.
(struct thread): Remove forward.
(loader_allocate_object_callback_t): New definition.
(loader_lookup_object_callback_t): New definition.
(loader_elf_load): Change prototype to take an allocation, a
lookup, a start, an end, and an entry arguments. Return a
boolean.
* loader.c: Don't include "cap.h", "object.h", "as.h" or
"thread.h". Include <l4.h>.
(loader_elf_load): Change prototype to take an
allocation, a lookup, a start, an end, and an entry arguments.
Return a boolean. Don't panic on an error. Instead, print some
debugging output and return false. On success, return true.
Update to use alloc and lookup callback functions.
* elf.h: Move here from ../viengoos.
* Makefile.am (common_sources): Add elf.h, loader.h and loader.c.
viengoos/
2008-01-25 Neal H. Walfield <neal@gnu.org>
* viengoos.c: Include <loader.h>. Don't include "loader.h".
(system_task_load): Update user of loader_elf_load to new API.
* loader.h: Move to ../libc-parts.
* loader.c: Move to ../libc-parts.
* elf.h: Move to ../libc-parts.
* Makefile.am (viengoos_SOURCES): Remove elf.h, loader.h and
loader.c.
Diffstat (limited to 'viengoos/viengoos.c')
-rw-r--r-- | viengoos/viengoos.c | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/viengoos/viengoos.c b/viengoos/viengoos.c index 2b09b2c..7bf7fee 100644 --- a/viengoos/viengoos.c +++ b/viengoos/viengoos.c @@ -41,11 +41,12 @@ int ss_lock_trace_count; #include <hurd/stddef.h> #include <hurd/thread.h> +#include <loader.h> + #include "viengoos.h" #include "sigma0.h" #include "memory.h" #include "boot-modules.h" -#include "loader.h" #include "cap.h" #include "object.h" #include "activity.h" @@ -350,9 +351,36 @@ system_task_load (void) thread->sp = STARTUP_DATA_ADDR; /* Load the binary. */ - loader_elf_load (allocate_object, root_activity, thread, - "system", boot_modules[0].start, boot_modules[0].end, - &thread->ip); + { + void *alloc (uintptr_t ptr) + { + addr_t addr = addr_chop (PTR_TO_ADDR (ptr), PAGESIZE_LOG2); + + struct cap cap = allocate_object (cap_page, addr).cap; + + struct object *page = cap_to_object (root_activity, &cap); + as_insert (root_activity, ADDR_VOID, &thread->aspace, addr, + ADDR_VOID, object_to_cap (page), ADDR_VOID, allocate_object); + + return page; + } + + void *lookup (uintptr_t ptr) + { + addr_t addr = addr_chop (PTR_TO_ADDR (ptr), PAGESIZE_LOG2); + + struct cap cap = object_lookup_rel (root_activity, + &thread->aspace, addr, + cap_page, NULL); + return cap_to_object (root_activity, &cap); + } + + if (! loader_elf_load (alloc, lookup, + (void *) boot_modules[0].start, + (void *) boot_modules[0].end, + &thread->ip)) + panic ("Failed to binary %s", boot_modules[0].command_line); + } /* Add the argument vector. If it would overflow the page, we |