fix mapkstack

This commit is contained in:
Frans Kaashoek 2019-07-22 20:58:15 -04:00
parent 62091abae9
commit 6c78af4a57
3 changed files with 5 additions and 5 deletions

View file

@ -193,7 +193,7 @@ uint64 walkaddr(pagetable_t, uint64);
int copyout(pagetable_t, uint64, char *, uint64); int copyout(pagetable_t, uint64, char *, uint64);
int copyin(pagetable_t, char *, uint64, uint64); int copyin(pagetable_t, char *, uint64, uint64);
int copyinstr(pagetable_t, char *, uint64, uint64); int copyinstr(pagetable_t, char *, uint64, uint64);
char* map_kstack(); char* mapkstack(uint64);
uint64 kernelpa(uint64); uint64 kernelpa(uint64);
void clearpteu(pagetable_t, uint64); void clearpteu(pagetable_t, uint64);

View file

@ -29,8 +29,8 @@ procinit(void)
for(p = proc; p < &proc[NPROC]; p++) { for(p = proc; p < &proc[NPROC]; p++) {
initlock(&p->lock, "proc"); initlock(&p->lock, "proc");
// Allocate a page for the kernel stack. // Allocate a page for the kernel stack.
char *kstack = (char *) KSTACK((int) (p - proc)); uint64 kstack = KSTACK((int) (p - proc));
if((p->kstack = map_kstack(kstack)) == 0) { if((p->kstack = mapkstack(kstack)) == 0) {
panic("procinit"); panic("procinit");
} }
} }

View file

@ -406,13 +406,13 @@ copyinstr(pagetable_t pagetable, char *dst, uint64 srcva, uint64 max)
} }
char * char *
map_kstack(uint64 kstack) mapkstack(uint64 kstack)
{ {
char *k = kalloc(); char *k = kalloc();
if(k == 0) { if(k == 0) {
return 0; return 0;
} }
if (mappages(kernel_pagetable, (uint64) kstack, PGSIZE, if (mappages(kernel_pagetable, kstack, PGSIZE,
(uint64) k, PTE_R | PTE_W) == 0) { (uint64) k, PTE_R | PTE_W) == 0) {
kvminithart(); kvminithart();
return (char *) kstack; return (char *) kstack;