From 6c78af4a577aa88cc499ea777556a4a16dd4a7fe Mon Sep 17 00:00:00 2001 From: Frans Kaashoek Date: Mon, 22 Jul 2019 20:58:15 -0400 Subject: [PATCH] fix mapkstack --- kernel/defs.h | 2 +- kernel/proc.c | 4 ++-- kernel/vm.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/kernel/defs.h b/kernel/defs.h index fb2672e..2d8f85b 100644 --- a/kernel/defs.h +++ b/kernel/defs.h @@ -193,7 +193,7 @@ uint64 walkaddr(pagetable_t, uint64); int copyout(pagetable_t, uint64, char *, uint64); int copyin(pagetable_t, char *, uint64, uint64); int copyinstr(pagetable_t, char *, uint64, uint64); -char* map_kstack(); +char* mapkstack(uint64); uint64 kernelpa(uint64); void clearpteu(pagetable_t, uint64); diff --git a/kernel/proc.c b/kernel/proc.c index d10c952..81c0e98 100644 --- a/kernel/proc.c +++ b/kernel/proc.c @@ -29,8 +29,8 @@ procinit(void) for(p = proc; p < &proc[NPROC]; p++) { initlock(&p->lock, "proc"); // Allocate a page for the kernel stack. - char *kstack = (char *) KSTACK((int) (p - proc)); - if((p->kstack = map_kstack(kstack)) == 0) { + uint64 kstack = KSTACK((int) (p - proc)); + if((p->kstack = mapkstack(kstack)) == 0) { panic("procinit"); } } diff --git a/kernel/vm.c b/kernel/vm.c index cbea684..7dc84ba 100644 --- a/kernel/vm.c +++ b/kernel/vm.c @@ -406,13 +406,13 @@ copyinstr(pagetable_t pagetable, char *dst, uint64 srcva, uint64 max) } char * -map_kstack(uint64 kstack) +mapkstack(uint64 kstack) { char *k = kalloc(); if(k == 0) { return 0; } - if (mappages(kernel_pagetable, (uint64) kstack, PGSIZE, + if (mappages(kernel_pagetable, kstack, PGSIZE, (uint64) k, PTE_R | PTE_W) == 0) { kvminithart(); return (char *) kstack;