diff options
author | marcus <marcus> | 2004-04-09 22:00:08 +0000 |
---|---|---|
committer | marcus <marcus> | 2004-04-09 22:00:08 +0000 |
commit | 74e22e81f0c766242d90ba90d78f3196bee3eeb0 (patch) | |
tree | 9e4c51aa30428c17eefebaf1c69880844399b032 /wortel | |
parent | de44ed86e468c2165728c27d9791f669aa4876b2 (diff) |
wortel/
2004-04-09 Marcus Brinkmann <marcus@gnu.org>
* wortel.c (serve_bootstrap_requests): Replace start and end in
the WORTEL_MSG_GET_CAP_REQUEST reply with startup.
(physmem_master): Change type to hurd_cap_handle_t.
(hurd_task_id_t): Remove typedef.
(HURD_TASK_ID_NULL): Remove macro.
physmem/
2004-04-09 Marcus Brinkmann <marcus@gnu.org>
* physmem.h: Include <stdbool.h>.
* container.c (struct container): Add member mapped.
(container_alloc): Add new argument mapped. Initialize
CONTAINER->mapped.
Diffstat (limited to 'wortel')
-rw-r--r-- | wortel/ChangeLog | 12 | ||||
-rw-r--r-- | wortel/shutdown.h | 1 | ||||
-rw-r--r-- | wortel/wortel.c | 67 | ||||
-rw-r--r-- | wortel/wortel.h | 15 |
4 files changed, 71 insertions, 24 deletions
diff --git a/wortel/ChangeLog b/wortel/ChangeLog index 3f2ac7d..dfee1a9 100644 --- a/wortel/ChangeLog +++ b/wortel/ChangeLog @@ -1,3 +1,15 @@ +2004-04-09 Marcus Brinkmann <marcus@gnu.org> + + * wortel.c (serve_bootstrap_requests): Replace start and end in + the WORTEL_MSG_GET_CAP_REQUEST reply with startup. + (physmem_master): Change type to hurd_cap_handle_t. + (hurd_task_id_t): Remove typedef. + (HURD_TASK_ID_NULL): Remove macro. + + * wortel.h: Include <hurd/types.h>, not <hurd/caps.h>. + (struct wortel_module): New member startup and startup_cont. + Change typ of member mem_cont and task_ctrl to hurd_cap_handle_t. + 2004-03-30 Marcus Brinkmann <marcus@gnu.org> * loader.c (loader_elf_dest, loader_elf_load): Use 32 and 64 diff --git a/wortel/shutdown.h b/wortel/shutdown.h index 64cbf2e..65572bc 100644 --- a/wortel/shutdown.h +++ b/wortel/shutdown.h @@ -51,6 +51,7 @@ extern const char program_name[]; printf ("%s: error: ", program_name); \ printf (__VA_ARGS__); \ putchar ('\n'); \ + asm ("int $3");\ shutdown (); \ }) diff --git a/wortel/wortel.c b/wortel/wortel.c index cf05f1b..93deeb4 100644 --- a/wortel/wortel.c +++ b/wortel/wortel.c @@ -62,16 +62,12 @@ unsigned int mods_count; /* The physical memory server master control capability for the root filesystem. */ -hurd_cap_scid_t physmem_master; +hurd_cap_handle_t physmem_master; /* The maximum number of tasks allowed to use the rootserver. */ #define MAX_USERS 16 -/* FIXME: Needs to be somewhere else. */ -typedef l4_word_t hurd_task_id_t; -#define HURD_TASK_ID_NULL 0 - /* The allowed user tasks. */ static hurd_task_id_t cap_list[MAX_USERS]; @@ -475,7 +471,8 @@ serve_bootstrap_requests (void) l4_msg_store (tag, msg); if (!WORTEL_CAP_VALID (l4_msg_word (msg, 0), l4_version (from))) /* FIXME: Shouldn't be a panic of course. */ - panic ("Unprivileged user attemps to access wortel rootserver"); + panic ("Unprivileged user 0x%x attemps to access wortel rootserver", + from); #define WORTEL_MSG_PUTCHAR 1 #define WORTEL_MSG_SHUTDOWN 2 @@ -578,20 +575,38 @@ serve_bootstrap_requests (void) nr_fpages = make_fpages (mods[mod_idx].start, mods[mod_idx].end, fpages); - /* We can not pass more than 30 grant items in our + /* We can not pass more than 31 grant items in our message, because there are only 64 message registers, - we need 4 for the label, the task ID, the start and - end address, and each grant item takes up two message - registers. */ - if (nr_fpages > 30) + we need 2 for the task ID and the startup fpage, and + each grant item takes up two message registers. */ + if (nr_fpages > 31) panic ("%s: Module %s is too large and has an " "unfortunate alignment", __func__, mods[mod_idx].name); +#if 0 + if (current_mod_idx_points_to_a_task) + { +#endif + /* FIXME: We need to find some (temporary) free + virtual address space of size startup_code_size * + number of modules. For now, use something a bit + below 3 GB. */ + mods[mod_idx].startup = l4_fpage (3UL * 1024 * 1024 * 1024 + -2* 32 * 1024 * mods_count + + 32 * 1024 * mod_idx, + 32 * 1024); +#if 0 + } + else + { + mods[mod_idx].startup = l4_nilpage; + } +#endif + l4_msg_clear (msg); l4_set_msg_label (msg, 0); l4_msg_append_word (msg, server_task); - l4_msg_append_word (msg, mods[mod_idx].start); - l4_msg_append_word (msg, mods[mod_idx].end); + l4_msg_append_word (msg, mods[mod_idx].startup); while (nr_fpages--) { l4_grant_item_t grant_item; @@ -606,16 +621,27 @@ serve_bootstrap_requests (void) } else if (label == WORTEL_MSG_GET_CAP_REPLY) { - if (l4_untyped_words (tag) != 2 - || l4_typed_words (tag) != 0) - panic ("Invalid format of get cap reply msg"); - if (mod_idx > mods_count) panic ("Invalid get cap reply message"); else if (mod_idx == mods_count) - physmem_master = l4_msg_word (msg, 1); + { + if (l4_untyped_words (tag) != 2 + || l4_typed_words (tag) != 0) + panic ("Invalid format of get cap reply msg"); + + physmem_master = l4_msg_word (msg, 1); + } else - mods[mod_idx].mem_cont = l4_msg_word (msg, 1); + { + if (l4_untyped_words (tag) != 3 + || l4_typed_words (tag) != 0) + panic ("Invalid format of get cap reply msg"); + + mods[mod_idx].mem_cont = l4_msg_word (msg, 1); + + /* Only valid if current module is a task. */ + mods[mod_idx].startup_cont = l4_msg_word (msg, 2); + } /* Does not require a reply. */ mod_idx++; @@ -659,7 +685,8 @@ serve_requests (void) l4_msg_store (msg_tag, msg); if (!WORTEL_CAP_VALID (l4_msg_word (msg, 0), l4_version (from))) /* FIXME: Shouldn't be a panic of course. */ - panic ("Unprivileged user attemps to access wortel rootserver"); + panic ("Unprivileged user 0x%x attemps to access wortel rootserver", + from); #define WORTEL_MSG_PUTCHAR 1 if (label == WORTEL_MSG_PUTCHAR) diff --git a/wortel/wortel.h b/wortel/wortel.h index fd9ae22..e5b9cd7 100644 --- a/wortel/wortel.h +++ b/wortel/wortel.h @@ -24,7 +24,7 @@ #include <string.h> -#include <hurd/cap.h> +#include <hurd/types.h> #include <l4.h> @@ -78,11 +78,19 @@ struct wortel_module module. Valid for all modules except for the physical memory server itself. Initialized after the physical memory server starts up. */ - hurd_cap_scid_t mem_cont; + hurd_cap_handle_t mem_cont; /* The following informartion is only valid if a task will be created from the module. */ + /* The FPAGE that contains the startup code. Initialized before + requesting MEM_CONT and STARTUP_CONT from physmem. */ + l4_fpage_t startup; + + /* The container capability that contains the startup code. + Provided by physmem. */ + l4_fpage_t startup_cont; + /* The entry point of the executable. Initialized just before the task is started. */ l4_word_t ip; @@ -95,7 +103,7 @@ struct wortel_module /* The task control capability for this module. Only valid if this is not the task server task itself. Initialized after the task server starts up. */ - hurd_cap_scid_t task_ctrl; + hurd_cap_handle_t task_ctrl; /* Server thread and the initial main thread of the task made from this module. Initialized just before the task is started. */ @@ -106,7 +114,6 @@ struct wortel_module while they have the same version ID. Initialized just before the task is started. */ unsigned int nr_extra_threads; - }; |