Chapter 2 - Page Tables

概念


功能


Page Table Entry


Two-Level Tree


Address Space


Physical Memory Allocation


程式流程


資料結構

static struct kmap { void *virt; // virtual address 起始位置 uint phys_start; // physical address 起始位置 uint phys_end; // physical address 結束位置 int perm; // flag } kmap[] = { { (void*)KERNBASE, 0, EXTMEM, PTE_W}, // I/O space { (void*)KERNLINK, V2P(KERNLINK), V2P(data), 0}, // kern text+rodata { (void*)data, V2P(data), PHYSTOP, PTE_W}, // kern data+memory { (void*)DEVSPACE, DEVSPACE, 0, PTE_W}, // more devices };
struct run { struct run *next; // free 的空間 }; struct { struct spinlock lock; // lock int use_lock; // 是否使用 struct run *freelist; // free list (head) } kmem;