Walked

Struct Walked 

Source
pub struct Walked<'a> {
    addr: Va,
    pte: &'a mut Pte,
}
Expand description

A mutable reference to a page table entry (PTE) associated with a virtual address.

Walked provides safe and convenient access for modifying an existing mapping in the page table. It is typically the result of a successful page table walk and includes both the virtual address and a mutable reference to the corresponding page table entry.

This abstraction is useful for implementing operations such as clearing mappings, updating physical page mappings, or changing permissions.

Fields§

§addr: Va§pte: &'a mut Pte

Implementations§

Source§

impl Walked<'_>

Source

pub fn clear(&mut self) -> Option<StaleTLBEntry>

Clears the current mapping by returning the physical page and a StaleTLBEntry for flushing the TLB.

§Returns
  • Some(StaleTLBEntry) if the entry is mapped.
  • None if the entry is not valid.
Source

pub fn set_page( &mut self, page: Page, flags: PteFlags, ) -> Result<(), PageTableMappingError>

Sets this page table entry to map to the given page with the specified flags.

§Parameters
  • page: The physical page to be mapped.
  • flags: The desired access permissions and attributes for the mapping.
§Errors

Returns Err(PageTableMappingError) if the physical address cannot be set (e.g., due to address alignment or capacity limits).

Methods from Deref<Target = Pte>§

Source

pub fn pa(&self) -> Option<Pa>

Get the physical address pointed to by this entry.

This function checks whether the page is present (i.e., if the “P” flag is set in the entry). If the page is present, it extracts the physical address from the entry by clearing the flags bits.

§Returns
  • Some(Pa) if the page is present, containing the physical address.
  • None if the page is not present (i.e., the “P” flag is not set).
Source

pub fn flags(&self) -> PteFlags

Get the flags associated with this page table entry.

This function extracts the flags from the entry. The flags represent various properties of the page, such as whether the page is present, read-only, user-accessible, etc.

§Returns

A PteFlags value representing the flags associated with this entry.

Trait Implementations§

Source§

impl Deref for Walked<'_>

Source§

type Target = Pte

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

§

impl<'a> Freeze for Walked<'a>

§

impl<'a> RefUnwindSafe for Walked<'a>

§

impl<'a> Send for Walked<'a>

§

impl<'a> Sync for Walked<'a>

§

impl<'a> Unpin for Walked<'a>

§

impl<'a> !UnwindSafe for Walked<'a>

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.