diff options
Diffstat (limited to 'vm/vm_map.c')
-rw-r--r-- | vm/vm_map.c | 79 |
1 files changed, 72 insertions, 7 deletions
diff --git a/vm/vm_map.c b/vm/vm_map.c index 657f4b59..01e0ed5d 100644 --- a/vm/vm_map.c +++ b/vm/vm_map.c @@ -19,11 +19,11 @@ * needed for kernel allocation. */ +#include <assert.h> #include <stddef.h> #include <stdint.h> #include <stdio.h> -#include <kern/assert.h> #include <kern/error.h> #include <kern/init.h> #include <kern/kmem.h> @@ -31,8 +31,10 @@ #include <kern/macros.h> #include <kern/mutex.h> #include <kern/panic.h> -#include <kern/param.h> #include <kern/rbtree.h> +#include <kern/shell.h> +#include <kern/task.h> +#include <machine/page.h> #include <machine/pmap.h> #include <vm/vm_adv.h> #include <vm/vm_inherit.h> @@ -695,18 +697,81 @@ vm_map_init(struct vm_map *map, struct pmap *pmap, map->pmap = pmap; } -void __init -vm_map_setup(void) +#ifdef X15_SHELL + +static void +vm_map_shell_info(int argc, char **argv) +{ + const struct task *task; + + if (argc < 2) { + goto error; + } else { + task = task_lookup(argv[1]); + + if (task == NULL) { + goto error; + } + + vm_map_info(task_get_vm_map(task)); + } + + return; + +error: + printf("vm_map: info: invalid arguments\n"); +} + +static struct shell_cmd vm_map_shell_cmds[] = { + SHELL_CMD_INITIALIZER("vm_map_info", vm_map_shell_info, + "vm_map_info <task_name>", + "display information about a VM map"), +}; + +static int __init +vm_map_setup_shell(void) +{ + SHELL_REGISTER_CMDS(vm_map_shell_cmds); + return 0; +} + +INIT_OP_DEFINE(vm_map_setup_shell, + INIT_OP_DEP(mutex_setup, true), + INIT_OP_DEP(printf_setup, true), + INIT_OP_DEP(shell_setup, true), + INIT_OP_DEP(task_setup, true), + INIT_OP_DEP(vm_map_setup, true)); + +#endif /* X15_SHELL */ + +static int __init +vm_map_bootstrap(void) { vm_map_init(kernel_map, kernel_pmap, - VM_MIN_KMEM_ADDRESS, VM_MAX_KMEM_ADDRESS); + PMAP_MIN_KMEM_ADDRESS, PMAP_MAX_KMEM_ADDRESS); kmem_cache_init(&vm_map_entry_cache, "vm_map_entry", sizeof(struct vm_map_entry), 0, NULL, KMEM_CACHE_PAGE_ONLY); + return 0; +} + +INIT_OP_DEFINE(vm_map_bootstrap, + INIT_OP_DEP(kmem_bootstrap, true), + INIT_OP_DEP(thread_bootstrap, true)); + +static int __init +vm_map_setup(void) +{ kmem_cache_init(&vm_map_cache, "vm_map", sizeof(struct vm_map), - 0, NULL, 0); + 0, NULL, KMEM_CACHE_PAGE_ONLY); + return 0; } +INIT_OP_DEFINE(vm_map_setup, + INIT_OP_DEP(pmap_setup, true), + INIT_OP_DEP(printf_setup, true), + INIT_OP_DEP(vm_map_bootstrap, true)); + int vm_map_create(struct vm_map **mapp) { @@ -727,7 +792,7 @@ vm_map_create(struct vm_map **mapp) goto error_pmap; } - vm_map_init(map, pmap, VM_MIN_ADDRESS, VM_MAX_ADDRESS); + vm_map_init(map, pmap, PMAP_MIN_ADDRESS, PMAP_MAX_ADDRESS); *mapp = map; return 0; |