pub trait Vcpu: Send {
// Required methods
fn run(&mut self) -> Result<VmExit>;
fn cancel(&self);
fn get_regs(&self) -> Result<Regs>;
fn set_regs(&mut self, regs: &Regs) -> Result<()>;
fn inject_irq(&mut self, irq: Irq) -> Result<()>;
}Expand description
A virtual CPU running inside a Vm.
Each implementation of Vcpu is bound to a single OS thread for the duration of its
lifetime, mirroring the hv_vcpu_create/hv_vcpu_run pthread-affinity rule on macOS
Hypervisor.framework. Callers must not move a Vcpu between threads.
Required Methods§
Sourcefn cancel(&self)
fn cancel(&self)
Cancel a concurrent Self::run call. On HVF this maps to hv_vcpus_exit; on
KVM it sends SIGRTMIN. Idempotent and safe to call from any thread.
Sourcefn set_regs(&mut self, regs: &Regs) -> Result<()>
fn set_regs(&mut self, regs: &Regs) -> Result<()>
Overwrite the architecture-tagged register file.
Sourcefn inject_irq(&mut self, irq: Irq) -> Result<()>
fn inject_irq(&mut self, irq: Irq) -> Result<()>
Inject an interrupt that will be delivered to the guest at the next entry.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".