Module pd

Module pd 

Source
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

Structs§

L2Index
Index into the Page Directory (derived from VA bits [29:21]).
PageDirectory
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.
PdEntryKind
Decoded PDE kind.

Unions§

PdEntry
L2 PDE union — overlays non-leaf Pde and leaf Pde2M on the same 64-bit storage.