diff options
-rw-r--r-- | vm/vm_map.c | 21 | ||||
-rw-r--r-- | vm/vm_map.h | 5 |
2 files changed, 25 insertions, 1 deletions
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 @@ -122,6 +122,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. */ void vm_map_info(struct vm_map *map); |