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 PteImplementations§
Source§impl Walked<'_>
impl Walked<'_>
Sourcepub fn clear(&mut self) -> Option<StaleTLBEntry>
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.Noneif the entry is not valid.
Sourcepub fn set_page(
&mut self,
page: Page,
flags: PteFlags,
) -> Result<(), PageTableMappingError>
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>§
Sourcepub fn pa(&self) -> Option<Pa>
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.Noneif the page is not present (i.e., the “P” flag is not set).
Sourcepub fn flags(&self) -> PteFlags
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.