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
impl Pager for EagerPager
Source§fn new() -> Self
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>
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>
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)>
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.