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

DemandPagingManager

Struct DemandPagingManager 

Source
pub struct DemandPagingManager {
    pub cow_table: CowTable,
    /* private fields */
}
Expand description

Manages lazy mappings and COW state.

The manager does NOT directly modify page tables. Instead, its methods return allocation results (frame number + flags) that the caller uses to install the actual mapping via the VAS / page table infrastructure.

Fields§

§cow_table: CowTable

COW-shared frame tracking.

Implementations§

Source§

impl DemandPagingManager

Source

pub fn new() -> Self

Create a new demand paging manager.

Source

pub fn register_lazy( &mut self, start_vaddr: usize, size: usize, flags: PageFlags, backing: BackingType, )

Register a lazy mapping. No physical memory is allocated.

Source

pub fn try_demand_page( &mut self, vaddr: usize, ) -> Result<(FrameNumber, PageFlags), KernelError>

Try to resolve a demand-page fault at vaddr.

If the address falls within a registered lazy mapping that has not yet been faulted in, allocates a physical frame and returns Ok((frame, flags)). The caller is responsible for installing the mapping in the page table.

Source

pub fn handle_cow_fault(&self, vaddr: usize) -> Result<FrameNumber, KernelError>

Handle a COW fault at vaddr.

Allocates a new frame, copies the contents from the old shared frame, decrements the COW ref count, and returns the new frame.

Source

pub fn unregister_lazy(&mut self, start_vaddr: usize)

Remove a lazy mapping.

Source

pub fn mark_cow_range(&mut self, base: usize, pages: &[(usize, FrameNumber)])

Mark a range of pages as COW-shared.

Source

pub fn add_cow_entry(&mut self, vaddr: usize, frame: FrameNumber)

Add a single COW entry (used by cow_fork).

Trait Implementations§

Source§

impl Default for DemandPagingManager

Available on crate feature alloc only.
Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for DemandPagingManager

§

impl RefUnwindSafe for DemandPagingManager

§

impl Send for DemandPagingManager

§

impl Sync for DemandPagingManager

§

impl Unpin for DemandPagingManager

§

impl UnwindSafe for DemandPagingManager

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.