From 448cf32233851b36e1d5f6004ee248573d2cc6ff Mon Sep 17 00:00:00 2001 From: Richard Braun Date: Tue, 18 Dec 2012 21:41:52 +0100 Subject: vm/vm_map: VM map creation --- vm/vm_map.c | 21 ++++++++++++++++++++- vm/vm_map.h | 5 +++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/vm/vm_map.c b/vm/vm_map.c index a29849ff..814a8760 100644 --- a/vm/vm_map.c +++ b/vm/vm_map.c @@ -118,9 +118,10 @@ static size_t vm_map_kentry_slab_size; static struct kmem_cache vm_map_kentry_cache; /* - * Cache for normal map entries. + * Caches for normal map entries and maps. */ static struct kmem_cache vm_map_entry_cache; +static struct kmem_cache vm_map_cache; static struct vm_map_kentry_slab * vm_map_kentry_alloc_slab(void) @@ -935,6 +936,24 @@ vm_map_setup(void) kmem_cache_init(&vm_map_entry_cache, "vm_map_entry", sizeof(struct vm_map_entry), 0, NULL, NULL, NULL, 0); + kmem_cache_init(&vm_map_cache, "vm_map", sizeof(struct vm_map), + 0, NULL, NULL, NULL, 0); +} + +int +vm_map_create(struct vm_map **mapp) +{ + struct vm_map *map; + + map = kmem_cache_alloc(&vm_map_cache); + + if (map == NULL) + return ERROR_NOMEM; + + /* TODO Create pmap */ + vm_map_init(map, NULL, VM_MIN_ADDRESS, VM_MAX_ADDRESS); + *mapp = map; + return 0; } void diff --git a/vm/vm_map.h b/vm/vm_map.h index fdd24f5a..5b4edbcf 100644 --- a/vm/vm_map.h +++ b/vm/vm_map.h @@ -121,6 +121,11 @@ void vm_map_remove(struct vm_map *map, unsigned long start, unsigned long end); */ void vm_map_setup(void); +/* + * Create a VM map. + */ +int vm_map_create(struct vm_map **mapp); + /* * Display information about a memory map. */ -- cgit v1.2.3