= Sv39 page table
{c}
The actual <Sv39 page table> geometry uses three nine-<bit> indices and a twelve-<bit> offset for base 4096-<byte> <memory pages>. Each table contains 512 eight-<byte> <page table entries>, exactly one 4096-<byte> <memory page>; the `satp` <processor register> identifies the root. A 64-<bit> <virtual address> must repeat bit 38 in bits 63 through 39. Higher-level terminal entries can also map aligned larger <memory pages>, shortening the <page table walk>. These rules differ from the 16-<bit>, four-<byte>-entry <two-level address translation> model. <The RISC-V Instruction Set Manual, Volume II: Privileged Architecture by RISC-V International>[Version 20260120, section 12.4.1, printed pp. 136–137, Figures 68–70: address fields, entry sizes, root, and larger pages]{ref}
For ordinary <Sv39 page tables>, valid nonterminal <page table entries> reference the next table with read, write, and execute flags clear; those clear flags do not prohibit reading the eventual data. The terminal entry supplies access permissions, with additional <processor privilege level> and status checks. An invalid entry, malformed encoding, or denied access can cause a <page fault>. Thus the model's <set intersection> of read/write permissions at both levels must not be applied mechanically to <Sv39 page tables>. <The RISC-V Instruction Set Manual, Volume II: Privileged Architecture by RISC-V International>[Version 20260120, section 12.3.2, printed p. 134, steps 2–8; section 12.4.1, printed p. 137: Sv39 uses the same algorithm with LEVELS=3 and PTESIZE=8]{ref}
In <xv6 RISC-V source code>, root allocation is separate from lower-level allocation: `uvmcreate()` allocates and clears a root <page table>, while `walk()` with allocation enabled allocates and clears missing lower-level tables and installs valid references to them. With allocation disabled, a missing table makes `walk()` return failure. This software routine finds a <page table entry> for the <operating system>; it is not the hardware's complete permission-checking <page table walk>. <xv6 RISC-V source code/vm.c>[walk(): three-level index comment and alloc-controlled creation; uvmcreate(): root allocation and initialization]{ref}
Back to article page