diff options
author | marcus <marcus> | 2004-04-15 11:07:59 +0000 |
---|---|---|
committer | marcus <marcus> | 2004-04-15 11:07:59 +0000 |
commit | 9718cb3f5e0586e3454239d87573667b73855110 (patch) | |
tree | 4f356530ac52977b8491f32cb8f17f97c4e37518 /physmem | |
parent | 0c374283096ee151ab02495039fe51ea74d05acd (diff) |
2004-04-15 Marcus Brinkmann <marcus@gnu.org>
* container.c (container_map): New function.
(container_demux): Call container_map.
Diffstat (limited to 'physmem')
-rw-r--r-- | physmem/ChangeLog | 5 | ||||
-rw-r--r-- | physmem/container.c | 64 |
2 files changed, 67 insertions, 2 deletions
diff --git a/physmem/ChangeLog b/physmem/ChangeLog index ea5c7cc..2f79873 100644 --- a/physmem/ChangeLog +++ b/physmem/ChangeLog @@ -1,3 +1,8 @@ +2004-04-15 Marcus Brinkmann <marcus@gnu.org> + + * container.c (container_map): New function. + (container_demux): Call container_map. + 2004-04-11 Marcus Brinkmann <marcus@gnu.org> * physmem.c (get_task_cap): New function. diff --git a/physmem/container.c b/physmem/container.c index 2fe42d2..f9580df 100644 --- a/physmem/container.c +++ b/physmem/container.c @@ -25,7 +25,7 @@ #include <stdlib.h> -#include <l4/space.h> +#include <l4.h> #include <hurd/cap-server.h> #include "physmem.h" @@ -69,12 +69,72 @@ container_reinit (hurd_cap_class_t cap_class, hurd_cap_obj_t obj) error_t -container_demuxer (hurd_cap_rpc_context_t ctx) +container_map (hurd_cap_rpc_context_t ctx) { + container_t container = (container_t) ctx->obj; + l4_word_t offset = l4_page_trunc (l4_msg_word (ctx->msg, 1)); + l4_word_t rights = l4_msg_word (ctx->msg, 1) & 0x7; + l4_word_t size = l4_page_round (l4_msg_word (ctx->msg, 2)); + l4_word_t vaddr = l4_page_trunc (l4_msg_word (ctx->msg, 3)); + l4_word_t start; + l4_word_t end; + l4_word_t nr_fpages; + l4_fpage_t fpages[L4_FPAGE_SPAN_MAX]; + l4_word_t i; + + /* FIXME FIXME FIXME */ + if (offset > 0x8000000) + { + /* Allocation. */ + start = zalloc (size); + end = start + size - 1; + } + else + { + /* FIXME: Currently, we just trust that everything is all-right. */ + start = l4_address (container->fpages[0]) + offset; + end = start + size - 1; + } + + l4_msg_clear (ctx->msg); + nr_fpages = l4_fpage_span (start, end, fpages); + + for (i = 0; i < nr_fpages; i++) + { + l4_map_item_t map_item; + l4_fpage_t fpage; + + fpage = fpages[i]; + l4_set_rights (&fpage, rights); + map_item = l4_map_item (fpage, vaddr); + l4_msg_append_map_item (ctx->msg, map_item); + vaddr += l4_size (fpage); + } + return 0; } +error_t +container_demuxer (hurd_cap_rpc_context_t ctx) +{ + error_t err = 0; + + switch (l4_msg_label (ctx->msg)) + { + /* PHYSMEM_MAP */ + case 128: + err = container_map (ctx); + break; + + default: + err = EOPNOTSUPP; + } + + return err; +} + + static struct hurd_cap_class container_class; |