RISC-V Page Fault Example Demo
load instruction -> Sv39 walk/permission check -> cause 13 + xtval -> handler repair/reject -> retry or terminate
Load instruction and access addressPC 0x0000000000011048 / VA 0x0000004000a130
U-mode instructionUser mode executes one load; its virtual address enters translation and permission checks. satp provides the page-table context; the access type is load. A page fault is the result of failed translation or protection checks, not a standalone instruction.
This page tracks only a load page fault example.
SRET takes the original load PC from EPC; unlike the common ECALL EPC+4 path, a repaired page fault usually retries the same memory instruction.
Boundaries that often get mixed up
Page faults originate in address translation and PTE checks; the virtual-memory page shows VA splitting, PTEs, superpages, and PA composition.
After a successful repair, EPC commonly keeps the faulting load PC so the same memory access can retry.
medeleg[13] changes the trap target; it does not change the load page fault cause=13.
Real page faults include instruction page fault (cause 12), load page fault (cause 13), and store/AMO page fault (cause 15); this page fixes only the load page fault cause 13 trap path. The concrete fault is determined by translation, PTE validity/reserved bits, permissions, U/SUM/MXR, A/D rules, superpage alignment, access type, and current privilege state.