pub trait Vcpu: Send {
// Required methods
fn run(&mut self) -> Result<VcpuExit, HypervisorError>;
fn get_regs(&self) -> Result<Registers, HypervisorError>;
fn set_regs(&mut self, regs: &Registers) -> Result<(), HypervisorError>;
fn id(&self) -> u32;
fn set_io_result(&mut self, value: u64) -> Result<(), HypervisorError>;
fn set_mmio_result(&mut self, value: u64) -> Result<(), HypervisorError>;
fn snapshot(&self) -> Result<VcpuSnapshot, HypervisorError>;
fn restore(
&mut self,
snapshot: &VcpuSnapshot,
) -> Result<(), HypervisorError>;
}Expand description
Virtual CPU trait for executing guest code.
Required Methods§
Sourcefn run(&mut self) -> Result<VcpuExit, HypervisorError>
fn run(&mut self) -> Result<VcpuExit, HypervisorError>
Sourcefn get_regs(&self) -> Result<Registers, HypervisorError>
fn get_regs(&self) -> Result<Registers, HypervisorError>
Sourcefn set_io_result(&mut self, value: u64) -> Result<(), HypervisorError>
fn set_io_result(&mut self, value: u64) -> Result<(), HypervisorError>
Sets the result of an I/O read operation.
This is called after handling an IoIn exit to provide the value
that should be returned to the guest.
§Errors
Returns an error if the result cannot be set.
Sourcefn set_mmio_result(&mut self, value: u64) -> Result<(), HypervisorError>
fn set_mmio_result(&mut self, value: u64) -> Result<(), HypervisorError>
Sets the result of an MMIO read operation.
This is called after handling an MmioRead exit to provide the value
that should be returned to the guest.
§Errors
Returns an error if the result cannot be set.