all of PTE_FLAGS
This commit is contained in:
parent
036b5edf12
commit
2df42355f7
|
@ -338,7 +338,7 @@ sfence_vma()
|
||||||
|
|
||||||
#define PTE2PA(pte) (((pte) >> 10) << 12)
|
#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.
|
// extract the three 9-bit page table indices from a virtual address.
|
||||||
#define PXMASK 0x1FF // 9 bits
|
#define PXMASK 0x1FF // 9 bits
|
||||||
|
|
|
@ -95,10 +95,10 @@ usertrapret(void)
|
||||||
// now from kerneltrap() to usertrap().
|
// now from kerneltrap() to usertrap().
|
||||||
intr_off();
|
intr_off();
|
||||||
|
|
||||||
// send interrupts and exceptions to trampoline.S
|
// send syscalls, interrupts, and exceptions to trampoline.S
|
||||||
w_stvec(TRAMPOLINE + (uservec - trampoline));
|
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.
|
// the process next re-enters the kernel.
|
||||||
p->tf->kernel_satp = r_satp(); // kernel page table
|
p->tf->kernel_satp = r_satp(); // kernel page table
|
||||||
p->tf->kernel_sp = p->kstack + PGSIZE; // process's kernel stack
|
p->tf->kernel_sp = p->kstack + PGSIZE; // process's kernel stack
|
||||||
|
|
|
@ -314,9 +314,9 @@ uvmcopy(pagetable_t old, pagetable_t new, uint64 sz)
|
||||||
|
|
||||||
for(i = 0; i < sz; i += PGSIZE){
|
for(i = 0; i < sz; i += PGSIZE){
|
||||||
if((pte = walk(old, i, 0)) == 0)
|
if((pte = walk(old, i, 0)) == 0)
|
||||||
panic("copyuvm: pte should exist");
|
panic("uvmcopy: pte should exist");
|
||||||
if((*pte & PTE_V) == 0)
|
if((*pte & PTE_V) == 0)
|
||||||
panic("copyuvm: page not present");
|
panic("uvmcopy: page not present");
|
||||||
pa = PTE2PA(*pte);
|
pa = PTE2PA(*pte);
|
||||||
flags = PTE_FLAGS(*pte);
|
flags = PTE_FLAGS(*pte);
|
||||||
if((mem = kalloc()) == 0)
|
if((mem = kalloc()) == 0)
|
||||||
|
|
Loading…
Reference in a new issue