xv6SysTrap - riscv2os/riscv2os GitHub Wiki

xv6: 系統呼叫時,是如何切入核心模式,又如何切回來的?

p->state indicates whether the process is allocated, ready to run, running, waiting for I/O, or exiting.

p->pagetable holds the process’s page table, in the format that the RISC-V hardware expects.

xv6 causes the paging hardware to use a process’s p->pagetable when executing that process in user space. A process’s page table also serves as the record of the addresses of the physical pages allocated to store the process’s memory.