Skip to content

Lab 05

Compare
Choose a tag to compare
@JingWangTW JingWangTW released this 02 Jun 06:01
· 1 commit to LAB-05 since this release

NCTU OSDI Lab 5: Virtual memory

Documentation: Lab 5

Lab 5 Demo Release

Required

  • Required 1
    • Set up TCR_EL1.
    • Set up MAIR_EL1.
    • Set up identity mapping.
    • Modify linker script and map the upper address space.
    • Linear map kernel with finer granularity and map RAM as normal memory.
  • Requried 2
    • Implement page bookkeeping.
    • Implement the translation function between kernel virtual address, physical address, PFN and the reference to struct page.
    • Implement page_alloc and page_free.
  • Required 3
    • Implement user space paging.
    • Implement a minimum user library.
    • Implement shell as an user program and use objcopy to turn the ELF file into a raw binary.
    • Embed your shell binary to kernel image.
    • Allocate one page frame for user stack and map user task’s stack to the common address.
    • Set TTBR0_EL1 to switch between different address space when context switch.
  • Required 4
    • Implement page frame reclaim.
    • Implement simple page fault handler.

Elective

  • Elective 1
    • Implement mmap for creating a new region.
    • Implement Region page mapping.
  • Elective 2
    • Parse the ELF header.
    • Implement ELF mapping.
  • Elective 3
    • Implement demand paging.
  • Elective 4
    • Implement copy-on-write.

Questions

  • Without indirect branch, the code might still work fine, why it’s the case and why it’s mandatory to use indirect branch.
  • For mapping 1GB memory region, how many page frames are used by page tables(PGD, PUD, PMD, and PTE) in four level translation?
  • If a page frame is allocated and to be mapped at user space. Is it necessary to initialize it into 0?