Struct page_table_entry::PageTableEntry
source · pub struct PageTableEntry(/* private fields */);
Expand description
A page table entry, which is a u64
value under the hood.
It contains a the physical address of the Frame
being mapped by this entry
and the access bits (encoded PteFlags
) that describes how it’s mapped,
e.g., readable, writable, no exec, etc.
There isn’t and shouldn’t be any way to create/instantiate a new PageTableEntry
directly.
You can only obtain a reference to an PageTableEntry
by going through a page table’s Table
struct itself.
Implementations§
source§impl PageTableEntry
impl PageTableEntry
sourcepub fn is_unused(&self) -> bool
pub fn is_unused(&self) -> bool
Returns true
if this entry is unused, i.e., cleared/zeroed out.
sourcepub fn set_unmapped(&mut self) -> UnmapResult
pub fn set_unmapped(&mut self) -> UnmapResult
Removes the mapping represented by this page table entry.
If the frame(s) pointed to by this entry were mapped exlusively, i.e., owned by this entry and not mapped anywhere else by any other entries, then this function returns those frames. This is useful because those returned frames can then be safely deallocated.
sourcepub fn pointed_frame(&self) -> Option<Frame>
pub fn pointed_frame(&self) -> Option<Frame>
Returns the physical Frame
pointed to (mapped by) this PageTableEntry
.
If this page table entry is not PRESENT
, this returns None
.
sourcepub fn set_entry<P: PageSize>(
&mut self,
frame: AllocatedFrame<'_, P>,
flags: PteFlagsArch
)
pub fn set_entry<P: PageSize>( &mut self, frame: AllocatedFrame<'_, P>, flags: PteFlagsArch )
Sets this PageTableEntry
to map the given frame
with the given flags
.
This is the actual mapping action that informs the MMU of a new mapping.
Note: this performs no checks about the current value of this page table entry.
sourcepub fn set_flags(&mut self, new_flags: PteFlagsArch)
pub fn set_flags(&mut self, new_flags: PteFlagsArch)
Sets the flags components of this PageTableEntry
to new_flags
.
This does not modify the frame part of the page table entry.