pub struct KvmVcpu { /* private fields */ }Expand description
Virtual CPU implementation for Linux KVM.
Each vCPU represents a virtual processor that can execute guest code. vCPUs are created via the KVM VM file descriptor and run using the KVM_RUN ioctl.
Implementations§
Source§impl KvmVcpu
impl KvmVcpu
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Returns whether the vCPU is currently running.
Sourcepub fn running_flag(&self) -> Arc<AtomicBool>
pub fn running_flag(&self) -> Arc<AtomicBool>
Returns a clone of the running flag for external monitoring.
Sourcepub fn signal_exit(&self)
pub fn signal_exit(&self)
Signals the vCPU to exit immediately.
This causes the next KVM_RUN to return immediately.
Sourcepub fn setup_linux_boot(
&self,
entry_point: u64,
boot_params_addr: u64,
) -> Result<(), HypervisorError>
pub fn setup_linux_boot( &self, entry_point: u64, boot_params_addr: u64, ) -> Result<(), HypervisorError>
Sets up initial register state for Linux boot (x86_64).
Sourcepub fn set_io_in_data(&self, data: &[u8])
pub fn set_io_in_data(&self, data: &[u8])
Provides data for an I/O IN instruction.
Sourcepub fn set_mmio_read_data(&self, data: &[u8])
pub fn set_mmio_read_data(&self, data: &[u8])
Provides data for an MMIO read.
Trait Implementations§
Source§impl Vcpu for KvmVcpu
impl Vcpu for KvmVcpu
Source§fn run(&mut self) -> Result<VcpuExit, HypervisorError>
fn run(&mut self) -> Result<VcpuExit, HypervisorError>
Runs the vCPU until a VM exit occurs. Read more
Source§fn get_regs(&self) -> Result<Registers, HypervisorError>
fn get_regs(&self) -> Result<Registers, HypervisorError>
Gets the current register state. Read more
Source§fn set_regs(&mut self, regs: &Registers) -> Result<(), HypervisorError>
fn set_regs(&mut self, regs: &Registers) -> Result<(), HypervisorError>
Sets the register state. Read more
Source§fn 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. Read more
Source§fn 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. Read more
Source§fn snapshot(&self) -> Result<VcpuSnapshot, HypervisorError>
fn snapshot(&self) -> Result<VcpuSnapshot, HypervisorError>
Creates a snapshot of the vCPU state. Read more
Source§fn restore(&mut self, snapshot: &VcpuSnapshot) -> Result<(), HypervisorError>
fn restore(&mut self, snapshot: &VcpuSnapshot) -> Result<(), HypervisorError>
Restores the vCPU state from a snapshot. Read more
Auto Trait Implementations§
impl Freeze for KvmVcpu
impl RefUnwindSafe for KvmVcpu
impl Send for KvmVcpu
impl !Sync for KvmVcpu
impl Unpin for KvmVcpu
impl UnsafeUnpin for KvmVcpu
impl UnwindSafe for KvmVcpu
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more