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

source

pub fn is_unused(&self) -> bool

Returns true if this entry is unused, i.e., cleared/zeroed out.

source

pub fn zero(&mut self)

Zeroes out this entry, setting it as “unused”.

source

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.

source

pub fn flags(&self) -> PteFlagsArch

Returns this PageTableEntry’s flags.

source

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.

source

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.

source

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.

source

pub fn value(&self) -> u64

Trait Implementations§

source§

impl FromBytes for PageTableEntry

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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.

source§

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

§

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.
source§

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

§

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.