Trait virt::PartitionMemoryMap

source ·
pub trait PartitionMemoryMap: Send + Sync {
    // Required methods
    fn unmap_range(&self, addr: u64, size: u64) -> Result<(), Error>;
    unsafe fn map_range(
        &self,
        data: *mut u8,
        size: usize,
        addr: u64,
        writable: bool,
        exec: bool,
    ) -> Result<(), Error>;

    // Provided methods
    fn prefetch_range(&self, _addr: u64, _size: u64) -> Result<(), Error> { ... }
    fn pin_range(&self, _addr: u64, _size: u64) -> Result<(), Error> { ... }
}
Expand description

Trait for mapping process memory into a partition.

Required Methods§

source

fn unmap_range(&self, addr: u64, size: u64) -> Result<(), Error>

Unmaps any ranges in the given guest physical address range.

The specified range may overlap zero, one, or many ranges mapped with map_range. Any overlapped ranges must be completely contained in the specified range.

The hypervisor must ensure that this operation does not fail as long as the preconditions are satisfied.

source

unsafe fn map_range( &self, data: *mut u8, size: usize, addr: u64, writable: bool, exec: bool, ) -> Result<(), Error>

Maps a range from process memory into the VM.

This may fail if the range overlaps any other mapped range.

§Safety

The caller must ensure that the VA region (data..data+size) is not reused for the lifetime of this mapping.

Provided Methods§

source

fn prefetch_range(&self, _addr: u64, _size: u64) -> Result<(), Error>

Prefetches any memory in the given range so that it can be accessed quickly by the partition without exits.

source

fn pin_range(&self, _addr: u64, _size: u64) -> Result<(), Error>

Pins a range in memory so that it can be accessed by assigned devices.

Implementors§