Skip to main content

PageTableEntry

Struct PageTableEntry 

Source
#[repr(transparent)]
pub struct PageTableEntry(pub usize);

Tuple Fields§

§0: usize

Implementations§

Source§

impl PageTableEntry

Source

pub const exec fn PROP_MASK() -> res : usize

returns
({ !PHYS_ADDR_MASK & !(PageTableFlags::HUGE()) }),
Source

pub open spec fn prop_assign_spec(self, flags: usize) -> Self

{ Self((self.0 & !Self::PROP_MASK()) | flags as usize) }
Source

pub exec fn prop_assign(&mut self, flags: usize)

ensures
final(self).0 == old(self).prop_assign_spec(flags).0,
Source

pub exec fn encode_cache(cache: CachePolicy) -> res : usize

returns
({
    match cache {
        CachePolicy::Uncacheable => PageTableFlags::NO_CACHE(),
        CachePolicy::Writethrough => PageTableFlags::WRITE_THROUGH(),
        _ => 0,
    }
}),
Source

pub open spec fn format_flags_spec(prop: PageProperty) -> usize

{
    let flags: u8 = prop.flags.bits();
    let priv_flags: u8 = prop.priv_flags.bits();
    PageTableFlags::PRESENT() | flags.map_forward(&PAGE_FLAG_MAPPING)
        | flags.map_invert_forward(&PAGE_INVERTED_FLAG_MAPPING)
        | priv_flags.map_forward(&PAGE_PRIV_MAPPING) | Self::encode_cache(prop.cache)
}
Source

pub exec fn format_flags(prop: PageProperty) -> usize

returns
Self::format_flags_spec(prop),
Source

pub exec fn format_cache(flags: usize) -> res : CachePolicy

returns
({
    if flags & PageTableFlags::NO_CACHE() != 0 {
        CachePolicy::Uncacheable
    } else if flags & PageTableFlags::WRITE_THROUGH() != 0 {
        CachePolicy::Writethrough
    } else {
        CachePolicy::Writeback
    }
}),
Source

pub open spec fn format_property_spec(entry: usize) -> PageProperty

{
    let flags: u8 = entry.map_backward(&PAGE_FLAG_MAPPING)
        | entry.map_invert_backward(&PAGE_INVERTED_FLAG_MAPPING);
    let priv_flags: u8 = entry.map_backward(&PAGE_PRIV_MAPPING);
    let cache = Self::format_cache(entry);
    PageProperty {
        flags: PageFlags::from_bits(flags).unwrap(),
        cache,
        priv_flags: PrivilegedPageFlags::from_bits(priv_flags).unwrap(),
    }
}
Source

pub exec fn format_property(entry: usize) -> PageProperty

returns
Self::format_property_spec(entry),
Source

pub exec fn format_huge_page(level: PagingLevel) -> res : u64

returns
({ if level == 1 { 0 } else { PageTableFlags::HUGE() as u64 } }),
Source§

impl PageTableEntry

Source

pub proof fn absent_pte_paddr_ok()

ensures
Self::new_absent_spec().paddr_spec() % crate::specs::arch::mm::PAGE_SIZE == 0,
Self::new_absent_spec().paddr_spec() < crate::specs::arch::mm::MAX_PADDR,

Absent (zero) PTE has well-formed paddr for match_pte.

Trait Implementations§

Source§

impl Clone for PageTableEntry

Source§

exec fn clone(&self) -> Self

1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PageTableEntry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PageTableEntryTrait for PageTableEntry

Source§

open spec fn default_spec() -> Self

{ Self { 0: 0 } }
Source§

exec fn default() -> Self

returns
Self::default_spec(),
Source§

open spec fn new_absent_spec() -> Self

{ Self::default_spec() }
Source§

exec fn new_absent() -> res : Self

Source§

open spec fn as_usize_spec(self) -> usize

{ self.0 as usize }
Source§

exec fn as_usize(self) -> usize

returns
self.as_usize_spec(),
Source§

open spec fn is_present_spec(&self) -> bool

{ self.0 & PageTableFlags::PRESENT() != 0 }
Source§

exec fn is_present(&self) -> bool

returns
self.is_present_spec(),
Source§

open spec fn set_prop_spec(&self, prop: PageProperty) -> Self

{
    let flags = Self::format_flags(prop);
    self.prop_assign_spec(flags)
}
Source§

exec fn set_prop(&mut self, prop: PageProperty)

ensures
*final(self) == old(self).set_prop_spec(prop),
Source§

open spec fn new_page_spec(paddr: Paddr, level: PagingLevel, prop: PageProperty) -> Self

{
    let addr = paddr & PHYS_ADDR_MASK;
    let hp = Self::format_huge_page(level) as usize;
    let flags = Self::format_flags(prop) as usize;
    Self(addr | hp | flags)
}
Source§

exec fn new_page(paddr: Paddr, level: PagingLevel, prop: PageProperty) -> res : Self

Source§

open spec fn new_pt_spec(paddr: Paddr) -> Self

{
    let addr = paddr & PHYS_ADDR_MASK;
    Self(
        addr | PageTableFlags::PRESENT() | PageTableFlags::WRITABLE()
            | PageTableFlags::USER(),
    )
}
Source§

exec fn new_pt(paddr: Paddr) -> res : Self

Source§

open spec fn paddr_spec(&self) -> Paddr

{ self.0 & PHYS_ADDR_MASK }
Source§

exec fn paddr(&self) -> Paddr

returns
self.paddr_spec(),
Source§

open spec fn prop_spec(&self) -> PageProperty

{ Self::format_property(self.0) }
Source§

exec fn prop(&self) -> PageProperty

returns
self.prop_spec(),
Source§

open spec fn is_last_spec(&self, level: PagingLevel) -> bool

{ level == 1 || (self.0 & PageTableFlags::HUGE() != 0) }
Source§

exec fn is_last(&self, level: PagingLevel) -> bool

returns
self.is_last_spec(level),
Source§

proof fn set_prop_properties(self, prop: PageProperty)

Source§

proof fn new_properties()

Source§

proof fn axiom_present_paddr_aligned(&self)

Source§

fn from_usize(pte_raw: usize) -> Self

Source§

impl PartialEq for PageTableEntry

Source§

fn eq(&self, other: &PageTableEntry) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Pod for PageTableEntry

§

fn new_zeroed() -> Self

Creates a new instance of Pod type that is filled with zeroes.
§

fn new_uninit() -> Self

Creates a new instance of Pod type with uninitialized content.
§

fn as_bytes(&self) -> &[u8]

As an immutable slice of bytes.
§

fn as_bytes_mut(&mut self) -> &mut [u8]

As a mutable slice of bytes.
§

fn as_array_ptr_bytes<const N: usize>( &self, ) -> (ArrayPtr<u8, N>, Tracked<&PointsTo<u8, N>>)

As a slice of bytes via an [ArrayPtr] (with a tracked permission). Read more
Source§

impl Copy for PageTableEntry

Source§

impl PodOnce for PageTableEntry

Source§

impl StructuralPartialEq for PageTableEntry

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, VERUS_SPEC__A> FromSpec<T> for VERUS_SPEC__A
where VERUS_SPEC__A: From<T>,

§

fn obeys_from_spec() -> bool

§

fn from_spec(v: T) -> VERUS_SPEC__A

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T, VERUS_SPEC__A> IntoSpec<T> for VERUS_SPEC__A
where VERUS_SPEC__A: Into<T>,

§

fn obeys_into_spec() -> bool

§

fn into_spec(self) -> T

§

impl<T, U> IntoSpecImpl<U> for T
where U: From<T>,

§

fn obeys_into_spec() -> bool

§

fn into_spec(self) -> U

§

impl<A, Rhs> PartialEqIs<Rhs> for A
where A: PartialEq<Rhs> + ?Sized, Rhs: ?Sized,

§

fn is_eq(&self, other: &Rhs) -> bool

§

fn is_ne(&self, other: &Rhs) -> bool

§

impl<Rhs, VERUS_SPEC__A> PartialEqSpec<Rhs> for VERUS_SPEC__A
where VERUS_SPEC__A: PartialEq<Rhs> + ?Sized, Rhs: ?Sized,

§

fn obeys_eq_spec() -> bool

§

fn eq_spec(&self, other: &Rhs) -> bool

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, VERUS_SPEC__A> TryFromSpec<T> for VERUS_SPEC__A
where VERUS_SPEC__A: TryFrom<T>,

§

fn obeys_try_from_spec() -> bool

§

fn try_from_spec( v: T, ) -> Result<VERUS_SPEC__A, <VERUS_SPEC__A as TryFrom<T>>::Error>

Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T, VERUS_SPEC__A> TryIntoSpec<T> for VERUS_SPEC__A
where VERUS_SPEC__A: TryInto<T>,

§

fn obeys_try_into_spec() -> bool

§

fn try_into_spec(self) -> Result<T, <VERUS_SPEC__A as TryInto<T>>::Error>

§

impl<T, U> TryIntoSpecImpl<U> for T
where U: TryFrom<T>,

§

fn obeys_try_into_spec() -> bool

§

fn try_into_spec(self) -> Result<U, <U as TryFrom<T>>::Error>

§

impl<A> SpecEq<&A> for A
where A: ?Sized,

§

impl<A> SpecEq<&mut A> for A
where A: ?Sized,

§

impl<A> SpecEq<A> for A
where A: ?Sized,

§

impl<A> SpecEq<Ghost<A>> for A

§

impl<A> SpecEq<Tracked<A>> for A