pub struct PagedSegment<'a> { /* private fields */ }Expand description
Memory segment that allows customized page fault handling in user space.
Implementations§
Source§impl<'a> PagedSegment<'a>
impl<'a> PagedSegment<'a>
Sourcepub unsafe fn from_raw<S: PageStore + Send + 'static>(
base: *mut u8,
size: usize,
store: S,
page_size: Option<usize>,
) -> Result<PagedSegment<'static>, Error>
pub unsafe fn from_raw<S: PageStore + Send + 'static>( base: *mut u8, size: usize, store: S, page_size: Option<usize>, ) -> Result<PagedSegment<'static>, Error>
Make the user-space paged segement at an existing memory location.
Sourcepub fn new<S: PageStore + Send + 'static>(
length: usize,
store: S,
page_size: Option<usize>,
) -> Result<PagedSegment<'static>, Error>
pub fn new<S: PageStore + Send + 'static>( length: usize, store: S, page_size: Option<usize>, ) -> Result<PagedSegment<'static>, Error>
Allocate a new segment to be user-space paged.
pub fn as_slice_mut(&mut self) -> &mut [u8] ⓘ
pub fn as_slice(&self) -> &[u8] ⓘ
pub fn as_raw_parts(&self) -> (*mut u8, usize)
Sourcepub fn reset_write_detection(
&self,
offset: usize,
size: usize,
) -> Result<(), Error>
pub fn reset_write_detection( &self, offset: usize, size: usize, ) -> Result<(), Error>
Mark the entire PagedSegment to be aware of all subsequent writes, this will trigger write-access page faults again when write operation is made in the future, even though the location was previously written.
Sourcepub fn release_page(&self, page_offset: usize) -> Result<(), Error>
pub fn release_page(&self, page_offset: usize) -> Result<(), Error>
Release the OS page with its content loaded from PageStore. The next access to an address within this page will trigger a page fault.
This operation punches “holes” on the managed segment to free the pages back to the OS.
page_offset must be aligned to the beginning of a page. It should be one of the offsets
historically passed to PageStore::page_fault.
Sourcepub fn release_all_pages(&self) -> Result<(), Error>
pub fn release_all_pages(&self) -> Result<(), Error>
Release all OS pages with their contents in this PagedSegment.
Patch a SharedMemory to a part of this memory segment. The given shm will start with an
offset from the beginning of PagedSegment, and cannot overrun the end of the segment. The
given SharedMemory outlives this object once patched (even if it is shadowed by subsequent patches).