Lab 05
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.
- Set up
- 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
andpage_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.
- Implement
- 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?