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: CowTableCOW-shared frame tracking.
Implementations§
Source§impl DemandPagingManager
impl DemandPagingManager
Sourcepub fn register_lazy(
&mut self,
start_vaddr: usize,
size: usize,
flags: PageFlags,
backing: BackingType,
)
pub fn register_lazy( &mut self, start_vaddr: usize, size: usize, flags: PageFlags, backing: BackingType, )
Register a lazy mapping. No physical memory is allocated.
Sourcepub fn try_demand_page(
&mut self,
vaddr: usize,
) -> Result<(FrameNumber, PageFlags), KernelError>
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.
Sourcepub fn handle_cow_fault(&self, vaddr: usize) -> Result<FrameNumber, KernelError>
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.
Sourcepub fn unregister_lazy(&mut self, start_vaddr: usize)
pub fn unregister_lazy(&mut self, start_vaddr: usize)
Remove a lazy mapping.
Sourcepub fn mark_cow_range(&mut self, base: usize, pages: &[(usize, FrameNumber)])
pub fn mark_cow_range(&mut self, base: usize, pages: &[(usize, FrameNumber)])
Mark a range of pages as COW-shared.
Sourcepub fn add_cow_entry(&mut self, vaddr: usize, frame: FrameNumber)
pub fn add_cow_entry(&mut self, vaddr: usize, frame: FrameNumber)
Add a single COW entry (used by cow_fork).