Exercise 1. Virtual Address Layout Hex -> Binary 0x0 -> 0000 0x1 -> 0001 0x2 -> 0010 0x3 -> 0011 0x4 -> 0100 0x5 -> 0101 0x6 -> 0110 0x7 -> 0111 0x8 -> 1000 0x9 -> 1001 0xa -> 1010 0xb -> 1011 0xc -> 1100 0xd -> 1101 0xe -> 1110 0xf -> 1111 0x80fcf0f0: 1000000011|1111001111|000011110000 -> [515][975][240] 0x803ff000: __________|__________|____________ -> [____][____][_____] Exercise 2. Page Walk +--------------------+ +------------+ | +------------+ | +------------+ | 0xf0003007 |--+ | 0xf0040007 | | | 0xf0009007 | (entry: 1023) +------------+ +------------+ | +------------+ | ... | | ... | | | ... | +------------+ +------------+ | +------------+ | 0xf0002007 |--+ | 0xf0005007 | | | 0xf000a007 | (entry: 512) +------------+ | +------------+ | +------------+ | ... | | | ... | | | ... | +------------+ | +------------+ | +------------+ | 0xc5202000 | | | 0xf0006007 | | | 0xf000b000 | (entry: 0) +-> +------------+ +--> +------------+ +--> +------------+ | 0xf0001000 0xf0002000 0xf0003000 | | +------------+ +--| 0xf0001000 | CR3 +------------+ Q: What's the physical addresses after translation? 0xffd00ffc: 1111111111|1000000000|111111111100 -> [1023][512][4092] -> 0xf000affc 0x803ff000: __________|__________|____________ -> [___][____][____] -> __________ Exercise 3. Page permissions Q: What's the the meaning of following permissions? (1) PTE_P|PTE_U|PTE_W: (2) PTE_P|PTE_U: (3) PTE_W|PTE_U: Exercise 4. Debug functions print on screen: debug_printf(...) print on log file: log_printf(...) Exercise 5. Important Data Structure I How does kernel memorize which pages are available? [kernel.c] typedef struct physical_pageinfo { int8_t owner; int8_t refcount; } physical_pageinfo; static physical_pageinfo pageinfo[PAGENUMBER(MEMSIZE_PHYSICAL)]; Exercise 6. Important Data Structure II What's the page table's data structure? [x86.h] typedef uint32_t x86_pageentry_t; typedef struct __attribute__((aligned(PAGESIZE))) x86_pagetable { x86_pageentry_t entry[PAGETABLE_NENTRIES]; } x86_pagetable;