pub struct VirtualCpu { /* private fields */ }Expand description
vCPU for a Virtual Machine.
Implementations§
Source§impl VirtualCpu
impl VirtualCpu
Sourcepub fn get_handle(&self) -> hv_vcpu_t
pub fn get_handle(&self) -> hv_vcpu_t
Gets vCPU handle.
Sourcepub fn get_register(&mut self, register: Register) -> Result<u64>
pub fn get_register(&mut self, register: Register) -> Result<u64>
Gets a register value.
This should be called in the thread that will run the vCPU as it’s resident inside it.
Sourcepub fn set_register(&mut self, register: Register, value: u64) -> Result<()>
pub fn set_register(&mut self, register: Register, value: u64) -> Result<()>
Sets a register value.
This should be called in the thread that will run the vCPU as it’s resident inside it.
Sourcepub fn get_system_register(&mut self, register: SystemRegister) -> Result<u64>
pub fn get_system_register(&mut self, register: SystemRegister) -> Result<u64>
Gets a system register value.
This should be called in the thread that will run the vCPU as it’s resident inside it.
Sourcepub fn set_system_register(
&mut self,
register: SystemRegister,
value: u64,
) -> Result<()>
pub fn set_system_register( &mut self, register: SystemRegister, value: u64, ) -> Result<()>
Sets a system register value.
This should be called in the thread that will run the vCPU as it’s resident inside it.
Sourcepub fn get_pending_interrupt(
&mut self,
interrupt_type: InterruptType,
) -> Result<bool>
pub fn get_pending_interrupt( &mut self, interrupt_type: InterruptType, ) -> Result<bool>
Gets pending interrupts.
This should be called in the thread that will run the vCPU as it’s resident inside it.
Sourcepub fn set_pending_interrupt(
&mut self,
interrupt_type: InterruptType,
value: bool,
) -> Result<()>
pub fn set_pending_interrupt( &mut self, interrupt_type: InterruptType, value: bool, ) -> Result<()>
Sets pending interrupts.
This should be called in the thread that will run the vCPU as it’s resident inside it. Pending interrupts automatically get cleared after vCPU run and must be resetup before every call to run.
Sourcepub fn get_trap_debug_exceptions(&mut self) -> Result<bool>
pub fn get_trap_debug_exceptions(&mut self) -> Result<bool>
Gets whether debug exceptions exit the vCPU.
This should be called in the thread that will run the vCPU as it’s resident inside it.
Sourcepub fn set_trap_debug_exceptions(&mut self, value: bool) -> Result<()>
pub fn set_trap_debug_exceptions(&mut self, value: bool) -> Result<()>
Gets whether debug exceptions exit the vCPU.
This should be called in the thread that will run the vCPU as it’s resident inside it.
Sourcepub fn get_trap_debug_reg_accesses(&mut self) -> Result<bool>
pub fn get_trap_debug_reg_accesses(&mut self) -> Result<bool>
Gets whether debug-register accesses exit the vCPU.
This should be called in the thread that will run the vCPU as it’s resident inside it.
Sourcepub fn set_trap_debug_reg_accesses(&mut self, value: bool) -> Result<()>
pub fn set_trap_debug_reg_accesses(&mut self, value: bool) -> Result<()>
Gets whether debug-register accesses exit the vCPU.
This should be called in the thread that will run the vCPU as it’s resident inside it.
Sourcepub fn run(&mut self) -> Result<VirtualCpuExitReason>
pub fn run(&mut self) -> Result<VirtualCpuExitReason>
Runs the vCPU.
This should be called in the thread that will run the vCPU as it’s resident inside it.
Sourcepub fn get_exec_time(&mut self) -> Result<u64>
pub fn get_exec_time(&mut self) -> Result<u64>
Gets cumulative execution time of a vCPU in mach_absolute_time().
This should be called in the thread that will run the vCPU as it’s resident inside it.
Sourcepub fn get_vtimer_mask(&mut self) -> Result<bool>
pub fn get_vtimer_mask(&mut self) -> Result<bool>
Gets Virtual Timer mask.
Sourcepub fn set_vtimer_mask(&mut self, value: bool) -> Result<()>
pub fn set_vtimer_mask(&mut self, value: bool) -> Result<()>
Sets Virtual Timer mask.
Sourcepub fn get_vtimer_offset(&mut self) -> Result<u64>
pub fn get_vtimer_offset(&mut self) -> Result<u64>
Gets Virtual Timer offset (CNTVOFF_EL2).
Sourcepub fn set_vtimer_offset(&mut self, value: u64) -> Result<()>
pub fn set_vtimer_offset(&mut self, value: u64) -> Result<()>
Sets Virtual Timer offset (CNTVOFF_EL2).