summaryrefslogtreecommitdiff
path: root/libhurd-mm/mm-init.c
diff options
context:
space:
mode:
authorneal <neal>2005-04-06 16:30:37 +0000
committerneal <neal>2005-04-06 16:30:37 +0000
commitbf11bbd527b36cca883715231a19d2ece20f17d2 (patch)
treefb856d0133fb53243d469f09d2aabfca8e602a71 /libhurd-mm/mm-init.c
parent60099e7c8556f17f88262bbf783178a0c4147799 (diff)
2005-04-06 Neal H. Walfield <neal@gnu.org>
* vm.h (hurd_vm_allocate): Remove declaration. (hurd_vm_release): Rename from hurd_vm_deallocate. Update callers. (VM_HERE): Remove. (VM_ZEROFILL): Remove. * vm.c (hurd_vm_allocate): Remove function. (hurd_vm_release): Rename from hurd_vm_deallocate. * mm.h: Include <stdint.h>, <sys/types.h>, <l4/types.h> and <hurd/physmem.h>. (hurd_store_t): New typedef. (hurd_memory_t): Likewise. (hurd_memory_use): New declaration. (hurd_memory_transfer): Likewise. (hurd_store_fault_t): New typedef. (hurd_store_init): New declaration. (hurd_store_size): New declaration. (HURD_VM_HERE): New definition. (hurd_store_bind_to_vm): New declaration. (hurd_store_flush): New declaration. * priv.h: Include "vm.h" and "mm.h". (here): New debugging macro. (struct region): Move to... * mm.h: ...here. (struct hurd_memory): Rename from struct frame. Rename field dc_start to cont_start. Add field cont. Remove field refs. Update users. (memory_slab): Rename from frame_slab. Update users. (memory_alloc_into): Rename from frame_alloc_into. Update users. (frame_alloc): Move to... * priv.h (frame_insert): Move to... * mm.h (hurd_store_cache): ...here. * priv.h (frame_find_first): Move to... * mm.h (hurd_store_find_cached): ...here. * priv.h (frame_map): Move to... * mm.h (hurd_memory_map): ...here. * priv.h (frame_dealloc): Move to... * mm.h (hurd_memory_dealloc): ...here. * priv.h (struct hurd_store): Rename from struct store. Remove fields server and handle. Add fields hook and fault. Rename field frames to memory. Update users. (store_find_free): Remove declaration. (struct map): Add field store_offset. (default_container): Likewise. (map_init): Likewise. (map_free): Rename from map_dealloc. Update callers. (map_init): New declaration. (map_find_first): Rename from map_find. Update callers. (as_find_free): Rename from map_find_free. Update callers. (container_find_free): Remove declaration. (core_slab_allocate_buffer): Rename from mem_slab_allocate_buffer. Update users. (core_slab_deallocate_buffer): Rename from mem_slab_deallocate_buffer. Update users. (frame_spare): Rename to memory_spare. Update users. (core_store): New declaration. * map.c (VIRTUAL_MEMORY_START): Move from here... * priv.h: ...to here. * map.c (as): Move from here... * as.c: ...to here. (map_system_init): Rename from map_init. Reserve the UTCB and the KIP. (memory_spare): Rename from frame_spare. (core_slab_allocate_buffer): Rename from mem_slab_allocate_buffer. (core_slab_deallocate_buffer): Rename from mem_slab_deallocate_buffer. (map_init): New function. (map_free): Rename from map_dealloc. (map_find): Rename from map_find_first. Avoid gratuitous hurd_btree_map_prev. (map_find_free): Remove function. (store_find_free): Move from here... * as.c (as_find_free): ...to here. * frame.c: Move from here... * memory.c: ...to here. Include <hurd/startup.h>. (swap_store): Remove definition. (memory_slab): Rename from frame_slab. (default_container): New static global. (dc_offset): New function. (memory_system_init): Likewise. (memory_alloc_into): Rename from frame_alloc_into. (hurd_memory_new): New function. Refactored from frame_alloc. (hurd_memory_delete): New function. (hurd_memory_alloc): Rename from frame_alloc. Rewritten to use hurd_memory_new. (frame_insert): Move from here... * store.c (hurd_store_cache): ...to here. * memory.c (hurd_memory_use): New function. (hurd_memory_transfer): New function. (hurd_memory_dealloc): Rename from frame_dealloc. Don't deallocate too eagerly: split memory which is only partially deallocated. (frame_find_first): Move from here... * store.c (hurd_store_find_cached): ...to here. * memory.c (hurd_memory_map): Rename from frame_map. Loop mapping all of the requested if a single RPC is insufficient. * mm-init.c (default_container): Remove definition. (hurd_mm_init): Don't initialize DEFAULT_CONTAINER. Don't initialize the store data structures. Call memory_system_init, core_system_init, hurd_anonymous_init, and map_system_init. Use core_allocate rather than hurd_vm_allocate to allocate a stack for the pager thread. * pager.c (pager): Don't round ADDR. Call MAP->STORE->FAULT if the physical memory is not cached. * physmem-user.h: Include <hurd/physmem.h>. Improve documentation. (hurd_pm_control_t): Remove redundant typedef. (hurd_pm_container_t): Likewise. (hurd_pm_container_access_t): Remove typedef. (HURD_PM_CONT_ALLOC_PARTIAL): Remove redundant define. (HURD_PM_CONT_ALLOC_SQUASH): Likewise. (HURD_PM_CONT_ALLOC_EXTRA): Likewise. (HURD_PM_CONT_ALLOC_DMA): Likewise. (hurd_pm_container_share): Change ACCESSS from a hurd_pm_container_access_t * to a hurd_pm_container_t *. (hurd_pm_container_map): Rename parameter rights to flags. Add new parameter AMOUNT. Update callers. * physmem-user.c (container_ops): Remove redundant enumeration. (hurd_pm_container_create): Use hurd_pm_container_create_id as the RPC identifier. (hurd_pm_container_share): Use hurd_pm_container_share_id as the RPC identifier. (hurd_pm_container_allocate): Use hurd_pm_container_allocate_id as the RPC identifier. (hurd_pm_container_deallocate): Use hurd_pm_container_deallocate_id as the RPC identifier. (hurd_pm_container_map): Use hurd_pm_container_map_id as the RPC identifier. If AMOUNTP is non-NULL, return the number of bytes mapped in *AMOUNTP. Remove debugging code. (hurd_pm_container_copy): Use hurd_pm_container_copy_id as the RPC identifier. * anonymous.h: New file. * anonymous.c: New file. * as.c: New file. * core.c: New file. * frame.c: Remove file. * store.c: New file. * Makefile.am (libhurd_mm_a_SOURCES): Add as.c, store.c, memory.c, core.c, anonymous.c and anonymous.h. Remove frame.c. * headers.m4: Install anonymous.h as <hurd/anonymous.h>.
Diffstat (limited to 'libhurd-mm/mm-init.c')
-rw-r--r--libhurd-mm/mm-init.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/libhurd-mm/mm-init.c b/libhurd-mm/mm-init.c
index 7abac2e..927cc6b 100644
--- a/libhurd-mm/mm-init.c
+++ b/libhurd-mm/mm-init.c
@@ -29,17 +29,13 @@
#include <l4.h>
#include <hurd/startup.h>
-#include "mm.h"
+#include "anonymous.h"
#include "vm.h"
-
#include "priv.h"
/* Physmem's server thread. */
l4_thread_id_t physmem;
-/* By default, we allocate all anonymous memory in this container. */
-hurd_pm_container_t default_container;
-
/* True once the MM is up and running. */
int mm_init_done;
@@ -57,25 +53,29 @@ hurd_mm_init (l4_thread_id_t pager_tid)
physmem. */
physmem = __hurd_startup_data->image.server;
- /* Create the primary anonymous memory container. */
- /* FIXME: We use the image cap handle as the memory control object.
- This is wrong. */
- err = hurd_pm_container_create (__hurd_startup_data->image.cap_handle,
- &default_container);
- assert_perror (err);
+#define INIT(service) \
+ do \
+ { \
+ void service##_system_init (void); \
+ service##_system_init (); \
+ } \
+ while (0)
+
+ /* Initialize the core. */
+ INIT (memory);
- swap_store.server = physmem;
- swap_store.handle = default_container;
- hurd_btree_frame_tree_init (&swap_store.frames);
+ /* Initialize the system pagers. */
+ INIT (core);
+ INIT (hurd_anonymous);
/* Initialize the mapping database. */
- map_init ();
+ INIT (map);
/* The mapping database is now bootstrapped. */
mm_init_done = 1;
/* Allocate a stack for the pager thread. */
- err = hurd_vm_allocate (&stack, getpagesize (), 0, 1);
+ err = core_allocate (&stack, getpagesize (), 0, 1);
if (err)
panic ("Unable to allocate a stack for the pager thread.\n");