Struct applevisor::Vcpu
source · pub struct Vcpu { /* private fields */ }
Expand description
Represents a Virtual CPU.
Implementations
sourceimpl Vcpu
impl Vcpu
sourcepub fn with_config(config: VcpuConfig) -> Result<Self>
pub fn with_config(config: VcpuConfig) -> Result<Self>
Creates a new vCPU with a user-provided config.
sourcepub fn get_instance(&self) -> VcpuInstance
pub fn get_instance(&self) -> VcpuInstance
Returns the VcpuInstance
associated with the Vcpu.
sourcepub fn get_id(&self) -> u64
pub fn get_id(&self) -> u64
Returns the Vcpu ID (the integer associated to the corresponding VcpuInstance
).
sourcepub fn get_max_count() -> Result<u32>
pub fn get_max_count() -> Result<u32>
Returns the maximum number of vCPUs that can be created by the hypervisor.
sourcepub fn stop(vcpus: &[VcpuInstance]) -> Result<()>
pub fn stop(vcpus: &[VcpuInstance]) -> Result<()>
Stops all vCPUs in the input array.
sourcepub fn get_exit_info(&self) -> VcpuExit
pub fn get_exit_info(&self) -> VcpuExit
Gets vCPU exit info.
sourcepub fn get_pending_interrupt(&self, intr: InterruptType) -> Result<bool>
pub fn get_pending_interrupt(&self, intr: InterruptType) -> Result<bool>
Gets pending interrupts for a vCPU.
sourcepub fn set_pending_interrupt(
&self,
intr: InterruptType,
pending: bool
) -> Result<()>
pub fn set_pending_interrupt(
&self,
intr: InterruptType,
pending: bool
) -> Result<()>
Sets pending interrupts for a vCPU.
sourcepub fn get_reg(&self, reg: Reg) -> Result<u64>
pub fn get_reg(&self, reg: Reg) -> Result<u64>
Gets the value of a vCPU general purpose register.
sourcepub fn set_reg(&self, reg: Reg, value: u64) -> Result<()>
pub fn set_reg(&self, reg: Reg, value: u64) -> Result<()>
Sets the value of a vCPU general purpose register.
sourcepub fn get_simd_fp_reg(&self, reg: SimdFpReg) -> Result<i8x16>
pub fn get_simd_fp_reg(&self, reg: SimdFpReg) -> Result<i8x16>
Gets the value of a vCPU floating point register
sourcepub fn set_simd_fp_reg(&self, reg: SimdFpReg, value: i8x16) -> Result<()>
pub fn set_simd_fp_reg(&self, reg: SimdFpReg, value: i8x16) -> Result<()>
Sets the value of a vCPU floating point register
sourcepub fn get_sys_reg(&self, reg: SysReg) -> Result<u64>
pub fn get_sys_reg(&self, reg: SysReg) -> Result<u64>
Gets the value of a vCPU system register.
sourcepub fn set_sys_reg(&self, reg: SysReg, value: u64) -> Result<()>
pub fn set_sys_reg(&self, reg: SysReg, value: u64) -> Result<()>
Sets the value of a vCPU general purpose register.
sourcepub fn get_trap_debug_exceptions(&self) -> Result<bool>
pub fn get_trap_debug_exceptions(&self) -> Result<bool>
Gets whether debug exceptions exit the guest.
sourcepub fn set_trap_debug_exceptions(&self, value: bool) -> Result<()>
pub fn set_trap_debug_exceptions(&self, value: bool) -> Result<()>
Sets whether debug exceptions exit the guest.
sourcepub fn get_trap_debug_reg_accesses(&self) -> Result<bool>
pub fn get_trap_debug_reg_accesses(&self) -> Result<bool>
Gets whether debug-register accesses exit the guest.
sourcepub fn set_trap_debug_reg_accesses(&self, value: bool) -> Result<()>
pub fn set_trap_debug_reg_accesses(&self, value: bool) -> Result<()>
Sets whether debug-register accesses exit the guest.
sourcepub fn get_exec_time(&self) -> Result<u64>
pub fn get_exec_time(&self) -> Result<u64>
Returns the cumulative execution time of a vCPU, in nanoseconds.
sourcepub fn get_vtimer_mask(&self) -> Result<bool>
pub fn get_vtimer_mask(&self) -> Result<bool>
Gets the virtual timer mask.
sourcepub fn set_vtimer_mask(&self, vtimer_is_masked: bool) -> Result<()>
pub fn set_vtimer_mask(&self, vtimer_is_masked: bool) -> Result<()>
Sets or clears the virtual timer mask.
sourcepub fn get_vtimer_offset(&self) -> Result<u64>
pub fn get_vtimer_offset(&self) -> Result<u64>
Returns the vTimer offset for the vCPU ID you specify.
sourcepub fn set_vtimer_offset(&self, vtimer_offset: u64) -> Result<()>
pub fn set_vtimer_offset(&self, vtimer_offset: u64) -> Result<()>
Sets the vTimer offset to a value that you provide.