pub trait Mmapper: Sync {
// Required methods
fn eagerly_mmap_all_spaces(&self, space_map: &[Address]);
fn mark_as_mapped(&self, start: Address, bytes: usize);
fn quarantine_address_range(
&self,
start: Address,
pages: usize,
strategy: MmapStrategy
) -> Result<()>;
fn ensure_mapped(
&self,
start: Address,
pages: usize,
strategy: MmapStrategy
) -> Result<()>;
fn is_mapped_address(&self, addr: Address) -> bool;
fn protect(&self, start: Address, pages: usize);
}
Expand description
Generic mmap and protection functionality
Required Methods§
sourcefn eagerly_mmap_all_spaces(&self, space_map: &[Address])
fn eagerly_mmap_all_spaces(&self, space_map: &[Address])
Given an address array describing the regions of virtual memory to be used by MMTk, demand zero map all of them if they are not already mapped.
Arguments:
spaceMap
: An address array containing a pairs of start and end addresses for each of the regions to be mapped
sourcefn mark_as_mapped(&self, start: Address, bytes: usize)
fn mark_as_mapped(&self, start: Address, bytes: usize)
Mark a number of pages as mapped, without making any request to the operating system. Used to mark pages that the VM has already mapped.
Arguments:
start
: Address of the first page to be mappedbytes
: Number of bytes to ensure mapped
sourcefn quarantine_address_range(
&self,
start: Address,
pages: usize,
strategy: MmapStrategy
) -> Result<()>
fn quarantine_address_range( &self, start: Address, pages: usize, strategy: MmapStrategy ) -> Result<()>
Quarantine/reserve address range. We mmap from the OS with no reserve and with PROT_NONE, which should be little overhead. This ensures that we can reserve certain address range that we can use if needed. Quarantined memory needs to be mapped before it can be used.
Arguments:
start
: Address of the first page to be quarantinedbytes
: Number of bytes to quarantine from the start
sourcefn ensure_mapped(
&self,
start: Address,
pages: usize,
strategy: MmapStrategy
) -> Result<()>
fn ensure_mapped( &self, start: Address, pages: usize, strategy: MmapStrategy ) -> Result<()>
Ensure that a range of pages is mmapped (or equivalent). If the pages are not yet mapped, demand-zero map them. Note that mapping occurs at chunk granularity, not page granularity.
Arguments:
start
: The start of the range to be mapped.pages
: The size of the range to be mapped, in pages
sourcefn is_mapped_address(&self, addr: Address) -> bool
fn is_mapped_address(&self, addr: Address) -> bool
Is the page pointed to by this address mapped? Returns true if the page at the given address is mapped.
Arguments:
addr
: Address in question