EagerPager

Struct EagerPager 

Source
pub struct EagerPager {
    mappings: BTreeMap<Va, Mapping>,
}
Expand description

EagerPager is a struct that implements the Pager trait. It represents a pager strategy that is responsible for eager memory paging.

Fields§

§mappings: BTreeMap<Va, Mapping>

Trait Implementations§

Source§

impl Pager for EagerPager

Source§

fn new() -> Self

Creates a new instance of EagerPager.

This constructor initializes an empty EagerPager struct.

Source§

fn mmap( &mut self, page_table: &mut PageTable, addr: Va, size: usize, prot: Permission, file: Option<&RegularFile>, offset: usize, ) -> Result<usize, KernelError>

Memory map function (mmap) for eager paging.

This function maps the given memory region into page table. Returns an address for the mapped area.

Source§

fn munmap( &mut self, page_table: &mut PageTable, addr: Va, ) -> Result<usize, KernelError>

Memory unmap function (munmap) for eager paging.

This function would unmap a previously mapped memory region, releasing any associated resources.

Source§

fn get_user_page( &mut self, page_table: &mut PageTable, addr: Va, ) -> Option<(PageRef<'_>, Permission)>

Find a mapped page at the given virtual address.

This function searches for a memory page mapped at addr and, if found, returns a tuple of PageRef to the page and its corresponding Permission flags.

Source§

fn access_ok(&self, va: Va, is_write: bool) -> bool

Checks whether access to the given virtual address is permitted.

This function verifies that a virtual address va is part of a valid memory mapping and that the requested access type (read or write) is allowed by the page’s protection flags.

Auto Trait Implementations§

§

impl Freeze for EagerPager

§

impl RefUnwindSafe for EagerPager

§

impl Send for EagerPager

§

impl Sync for EagerPager

§

impl Unpin for EagerPager

§

impl UnwindSafe for EagerPager

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.