Skip to content

Latest commit

 

History

History
44 lines (34 loc) · 1.3 KB

page-tables.md

File metadata and controls

44 lines (34 loc) · 1.3 KB

Lab: page tables

原始要求请点 这里

任务

  • Speed up system calls (easy)

    kernel/proc.c文件:在allocproc分配页面、在freeproc释放页面;在proc_pagetable做页表映射、在proc_freepagetable取消映射

  • Print a page table (easy)

    递归打印即可,注意判断页表项不是叶子节点的方法是(pte & (PTE_R|PTE_W|PTE_X)) == 0

  • Detecting which pages have been accessed (hard)

    参考kernel/vm.c文件的walk函数实现虚拟地址到页表项的转换,之后判断PTE_A位即可

测试结果

$ make grade
...
make[1]: Leaving directory '/home/chaiq/xv6-labs-2021'
== Test pgtbltest == 
$ make qemu-gdb
(2.5s) 
== Test   pgtbltest: ugetpid == 
  pgtbltest: ugetpid: OK 
== Test   pgtbltest: pgaccess == 
  pgtbltest: pgaccess: OK 
== Test pte printout == 
$ make qemu-gdb
pte printout: OK (0.8s) 
== Test answers-pgtbl.txt == answers-pgtbl.txt: OK 
== Test usertests == 
$ make qemu-gdb
(114.5s) 
== Test   usertests: all tests == 
  usertests: all tests: OK 
== Test time == 
time: OK 
Score: 46/46