On Tue, 20 Jan 2026 15:42:50 -0500
Joel Fernandes <[email protected]> wrote:
> Add unified Pte, Pde, and DualPde wrapper enums that abstract over
> MMU v2 and v3 page table entry formats. These enums allow the page
> table walker and VMM to work with both MMU versions.
> 

snip

> +impl DualPde {
> +    /// Create a [`DualPde`] from raw 128-bit value (two `u64`s) for
> the given MMU version.
> +    pub(crate) fn new(version: MmuVersion, big: u64, small: u64) ->
> Self {
> +        match version {
> +            MmuVersion::V2 => Self::V2(ver2::DualPde::new(big, small)),
> +            MmuVersion::V3 => Self::V3(ver3::DualPde::new(big, small)),
> +        }
> +    }
> +
> +    /// Create a [`DualPde`] with only the small page table pointer set.
> +    pub(crate) fn new_small(version: MmuVersion, table_pfn: Pfn) ->
> Self {
> +        match version {
> +            MmuVersion::V2 =>
> Self::V2(ver2::DualPde::new_small(table_pfn)),
> +            MmuVersion::V3 =>
> Self::V3(ver3::DualPde::new_small(table_pfn)),
> +        }
> +    }
> +
> +    /// Check if the small page table pointer is valid.
> +    pub(crate) fn has_small(&self) -> bool {
> +        match self {
> +            Self::V2(d) => d.has_small(),
> +            Self::V3(d) => d.has_small(),
> +        }
> +    }
> +

Should we also have a has_big here as well?

Z.

> +    /// Get the small page table VRAM address.
> +    pub(crate) fn small_vram_address(&self) -> VramAddress {
> +        match self {
> +            Self::V2(d) => d.small.table_vram_address(),
> +            Self::V3(d) => d.small.table_vram_address(),
> +        }
> +    }
> +
> +    /// Get the raw `u64` value of the big PDE.
> +    pub(crate) fn big_raw_u64(&self) -> u64 {
> +        match self {
> +            Self::V2(d) => d.big.raw_u64(),
> +            Self::V3(d) => d.big.raw_u64(),
> +        }
> +    }
> +
> +    /// Get the raw `u64` value of the small PDE.
> +    pub(crate) fn small_raw_u64(&self) -> u64 {
> +        match self {
> +            Self::V2(d) => d.small.raw_u64(),
> +            Self::V3(d) => d.small.raw_u64(),
> +        }
> +    }
> +}

Reply via email to