diff --git a/kernel/riscv.h b/kernel/riscv.h index 9df3cc0..f46ba59 100644 --- a/kernel/riscv.h +++ b/kernel/riscv.h @@ -338,7 +338,7 @@ sfence_vma() #define PTE2PA(pte) (((pte) >> 10) << 12) -#define PTE_FLAGS(pte) ((pte) & (PTE_V|PTE_R|PTE_W|PTE_X|PTE_U)) +#define PTE_FLAGS(pte) ((pte) & 0x3FF) // extract the three 9-bit page table indices from a virtual address. #define PXMASK 0x1FF // 9 bits diff --git a/kernel/trap.c b/kernel/trap.c index e96a542..ca732f2 100644 --- a/kernel/trap.c +++ b/kernel/trap.c @@ -95,10 +95,10 @@ usertrapret(void) // now from kerneltrap() to usertrap(). intr_off(); - // send interrupts and exceptions to trampoline.S + // send syscalls, interrupts, and exceptions to trampoline.S w_stvec(TRAMPOLINE + (uservec - trampoline)); - // set up values that uservec will need when + // set up trapframe values that uservec will need when // the process next re-enters the kernel. p->tf->kernel_satp = r_satp(); // kernel page table p->tf->kernel_sp = p->kstack + PGSIZE; // process's kernel stack diff --git a/kernel/vm.c b/kernel/vm.c index 7524998..e0bc728 100644 --- a/kernel/vm.c +++ b/kernel/vm.c @@ -314,9 +314,9 @@ uvmcopy(pagetable_t old, pagetable_t new, uint64 sz) for(i = 0; i < sz; i += PGSIZE){ if((pte = walk(old, i, 0)) == 0) - panic("copyuvm: pte should exist"); + panic("uvmcopy: pte should exist"); if((*pte & PTE_V) == 0) - panic("copyuvm: page not present"); + panic("uvmcopy: page not present"); pa = PTE2PA(*pte); flags = PTE_FLAGS(*pte); if((mem = kalloc()) == 0)