⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

PageMapper

Struct PageMapper 

Source
pub struct PageMapper { /* private fields */ }
Expand description

Page mapper for modifying page tables

Implementations§

Source§

impl PageMapper

Source

pub unsafe fn new(l4_table: *mut PageTable) -> Self

Create a new page mapper (unsafe: requires valid mapped L4 table)

§Safety

The l4_table pointer must:

  • Point to a valid, mapped page table
  • Remain valid for the lifetime of the PageMapper
  • Not be accessed through any other means while this exists
Source

pub unsafe fn new_with_recursive( l4_table: *mut PageTable, recursive_index: PageTableIndex, ) -> Self

Create a new page mapper with recursive mapping

§Safety

Same requirements as new, plus:

  • The recursive_index must be set up for recursive mapping
Source

pub fn map_page( &mut self, page: VirtualAddress, frame: FrameNumber, flags: PageFlags, allocator: &mut impl FrameAllocator, ) -> Result<(), KernelError>

Map a page to a frame

Source

pub fn translate_page( &self, page: VirtualAddress, ) -> Result<(FrameNumber, PageFlags), KernelError>

Look up the physical frame mapped at a virtual address.

Walks the page table hierarchy and returns the frame number and flags of the L1 (leaf) entry if the page is present at all four levels.

Source

pub fn update_page_flags( &mut self, page: VirtualAddress, new_flags: PageFlags, ) -> Result<PageFlags, KernelError>

Update the flags on an existing page table entry without changing the mapped frame.

Returns the old flags on success.

Source

pub fn unmap_page( &mut self, page: VirtualAddress, ) -> Result<FrameNumber, KernelError>

Unmap a page

Auto Trait Implementations§

§

impl Freeze for PageMapper

§

impl RefUnwindSafe for PageMapper

§

impl !Send for PageMapper

§

impl !Sync for PageMapper

§

impl Unpin for PageMapper

§

impl UnwindSafe for PageMapper

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