diff options
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_sched.c | 10 | ||||
-rw-r--r-- | sys/kern/kern_syscall.c | 3 |
2 files changed, 13 insertions, 0 deletions
diff --git a/sys/kern/kern_sched.c b/sys/kern/kern_sched.c index 877c55d..214032a 100644 --- a/sys/kern/kern_sched.c +++ b/sys/kern/kern_sched.c @@ -265,6 +265,10 @@ sched_create_td(uintptr_t rip, char *argvp[], char *envp[], struct auxval auxv, td->tf = tf; td->addrsp = vas; td->is_user = is_user; + for (size_t i = 0; i < MTAB_ENTRIES; ++i) { + /* Init the memory mapping table */ + TAILQ_INIT(&td->mapspace.mtab[i]); + } if (prog_range != NULL) { memcpy(exec_range, prog_range, sizeof(struct vm_range)); } @@ -288,6 +292,7 @@ static void sched_destroy_td(struct proc *td) { const struct vm_range *stack_range = &td->addr_range[ADDR_RANGE_STACK]; + vm_mapq_t *mapq; processor_free_pcb(td); @@ -308,6 +313,11 @@ sched_destroy_td(struct proc *td) fd_close_fdnum(td, i); } + for (size_t i = 0; i < MTAB_ENTRIES; ++i) { + mapq = &td->mapspace.mtab[i]; + vm_free_mapq(mapq); + } + pmap_free_vas(vm_get_ctx(), td->addrsp); dynfree(td); } diff --git a/sys/kern/kern_syscall.c b/sys/kern/kern_syscall.c index a630195..b4a86f3 100644 --- a/sys/kern/kern_syscall.c +++ b/sys/kern/kern_syscall.c @@ -32,6 +32,7 @@ #include <sys/cdefs.h> #include <sys/types.h> #include <sys/filedesc.h> +#include <vm/map.h> __noreturn static uint64_t sys_exit(struct syscall_args *args) @@ -47,4 +48,6 @@ uint64_t(*g_syscall_table[__MAX_SYSCALLS])(struct syscall_args *args) = { sys_close, sys_read, sys_lseek, + sys_mmap, + sys_munmap }; |