Expand description
§x86-64 Page Directory (PD / L2)
This module models the second paging level (L2, Page Directory):
L2Index: index type for virtual-address bits[29:21].PdEntry: a PD entry that is either a pointer to a PT (PS=0) or a 2 MiB leaf (PS=1).PdEntryKind: decoded view of an entry (next PT vs 2 MiB leaf).PageDirectory: a 4 KiB-aligned array of 512 PD entries.
§Semantics
At L2, the PS bit selects the role of an entry:
PS=0: entry points to a next-level Page Table (PT), whose base is 4 KiB-aligned.PS=1: entry is a 2 MiB leaf mapping; base must be 2 MiB-aligned.
§Invariants & Notes
PageDirectoryis 4 KiB-aligned and contains exactly 512 entries.PdEntry::present_next_withforcesPS=0;PdEntry::present_leaf_withforcesPS=1.- Raw constructors don’t validate consistency; callers must ensure correctness.
 - TLB maintenance is the caller’s responsibility after mutating active mappings.
 
Structs§
- L2Index
 - Index into the Page Directory (derived from VA bits 
[29:21]). - Page
Directory  - The Page Directory (L2): 512 entries, 4 KiB-aligned.
 - Pde
 - L2 PDE — pointer to a Page Table (non-leaf; PS = 0).
 - Pde2M
 - L2 PDE (2 MiB leaf) — maps a single 2 MiB page (
PS = 1). 
Enums§
- L2View
 - Borrowed view into an L2 PDE.
 - PdEntry
Kind  - Decoded PDE kind.