pub trait Vm: Send + Sync {
// Required methods
fn map_memory(&self, region: &GuestMemoryRegion) -> Result<()>;
fn unmap_memory(&self, region: &GuestMemoryRegion) -> Result<()>;
fn protect_memory(&self, range: GuestRange, prot: Protection) -> Result<()>;
fn create_vcpu(&self, index: u32) -> Result<Box<dyn Vcpu>>;
}Expand description
A live virtual machine handle owned by a HypervisorBackend.
The trait is split from HypervisorBackend because a backend may host multiple VMs
(in principle) and because vCPU lifetimes are scoped to a single Vm.
Required Methods§
Sourcefn map_memory(&self, region: &GuestMemoryRegion) -> Result<()>
fn map_memory(&self, region: &GuestMemoryRegion) -> Result<()>
Map a region of guest-physical memory.
Sourcefn unmap_memory(&self, region: &GuestMemoryRegion) -> Result<()>
fn unmap_memory(&self, region: &GuestMemoryRegion) -> Result<()>
Unmap a previously-mapped region.
Sourcefn protect_memory(&self, range: GuestRange, prot: Protection) -> Result<()>
fn protect_memory(&self, range: GuestRange, prot: Protection) -> Result<()>
Change the protection of an already-mapped range. Used for software dirty-page tracking on backends without a native dirty bitmap.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".