MmLoader

Trait MmLoader 

Source
pub trait MmLoader
where Self: Send + Sync,
{ // Required method fn load(&self, addr: Va) -> Page; }
Expand description

A trait for loading the contents of a virtual memory page on demand.

This trait abstracts the mechanism for supplying the contents of a page during demand paging. It is used by a lazy pager when handling a page fault for a region that has not yet been populated.

Implementors of this trait can define custom behaviors, such as reading from a file, or zero-filling anonymous pages.

Required Methods§

Source

fn load(&self, addr: Va) -> Page

Loads and returns the content for the page at the given virtual address.

The pager will call this function when a page fault occurs at addr within the corresponding VmAreaStruct. This method must return a fully initialized Page containing the data for that virtual page.

§Parameters
  • addr: The virtual address of the page to be loaded. This address is guaranteed to lie within the virtual memory area associated with this loader.
§Returns
  • A newly allocated Page containing the initialized data for the page.

Implementors§