Struct kvm::RunnableVcpu
source · pub struct RunnableVcpu {
pub(crate) vcpu: Vcpu,
pub(crate) phantom: PhantomData<*mut u8>,
}
Expand description
A Vcpu that has a thread and can be run. Created by calling to_runnable
on a Vcpu
.
Implements Deref
to a Vcpu
so all Vcpu
methods are usable, with the addition of the run
function to execute the guest.
Fields§
§vcpu: Vcpu
§phantom: PhantomData<*mut u8>
Implementations§
Methods from Deref<Target = Vcpu>§
sourcepub fn set_data(&self, data: &[u8]) -> Result<()>
pub fn set_data(&self, data: &[u8]) -> Result<()>
Sets the data received by a mmio read, ioport in, or hypercall instruction.
This function should be called after Vcpu::run
returns an VcpuExit::IoIn
,
VcpuExit::MmioRead
, or ’VcpuExit::HypervHcall`.
sourcepub fn set_immediate_exit(&self, exit: bool)
pub fn set_immediate_exit(&self, exit: bool)
Sets the bit that requests an immediate exit.
sourcepub fn set_fpu(&self, fpu: &kvm_fpu) -> Result<()>
pub fn set_fpu(&self, fpu: &kvm_fpu) -> Result<()>
X86 specific call to setup the FPU
See the documentation for KVM_SET_FPU.
sourcepub fn get_debugregs(&self) -> Result<kvm_debugregs>
pub fn get_debugregs(&self) -> Result<kvm_debugregs>
Gets the VCPU debug registers.
sourcepub fn set_debugregs(&self, dregs: &kvm_debugregs) -> Result<()>
pub fn set_debugregs(&self, dregs: &kvm_debugregs) -> Result<()>
Sets the VCPU debug registers
sourcepub fn get_msrs(&self, msr_entries: &mut Vec<kvm_msr_entry>) -> Result<()>
pub fn get_msrs(&self, msr_entries: &mut Vec<kvm_msr_entry>) -> Result<()>
X86 specific call to get the MSRS
See the documentation for KVM_SET_MSRS.
sourcepub fn set_msrs(&self, msrs: &kvm_msrs) -> Result<()>
pub fn set_msrs(&self, msrs: &kvm_msrs) -> Result<()>
X86 specific call to setup the MSRS
See the documentation for KVM_SET_MSRS.
sourcepub fn set_cpuid2(&self, cpuid: &CpuId) -> Result<()>
pub fn set_cpuid2(&self, cpuid: &CpuId) -> Result<()>
X86 specific call to setup the CPUID registers
See the documentation for KVM_SET_CPUID2.
sourcepub fn get_hyperv_cpuid(&self) -> Result<CpuId>
pub fn get_hyperv_cpuid(&self) -> Result<CpuId>
X86 specific call to get the system emulated hyper-v CPUID values
sourcepub fn get_lapic(&self) -> Result<kvm_lapic_state>
pub fn get_lapic(&self) -> Result<kvm_lapic_state>
X86 specific call to get the state of the “Local Advanced Programmable Interrupt Controller”.
See the documentation for KVM_GET_LAPIC.
sourcepub fn set_lapic(&self, klapic: &kvm_lapic_state) -> Result<()>
pub fn set_lapic(&self, klapic: &kvm_lapic_state) -> Result<()>
X86 specific call to set the state of the “Local Advanced Programmable Interrupt Controller”.
See the documentation for KVM_SET_LAPIC.
sourcepub fn get_mp_state(&self) -> Result<kvm_mp_state>
pub fn get_mp_state(&self) -> Result<kvm_mp_state>
Gets the vcpu’s current “multiprocessing state”.
See the documentation for KVM_GET_MP_STATE. This call can only succeed after
a call to Vm::create_irq_chip
.
Note that KVM defines the call for both x86 and s390 but we do not expect anyone to run crosvm on s390.
sourcepub fn set_mp_state(&self, state: &kvm_mp_state) -> Result<()>
pub fn set_mp_state(&self, state: &kvm_mp_state) -> Result<()>
Sets the vcpu’s current “multiprocessing state”.
See the documentation for KVM_SET_MP_STATE. This call can only succeed after
a call to Vm::create_irq_chip
.
Note that KVM defines the call for both x86 and s390 but we do not expect anyone to run crosvm on s390.
sourcepub fn get_vcpu_events(&self) -> Result<kvm_vcpu_events>
pub fn get_vcpu_events(&self) -> Result<kvm_vcpu_events>
Gets the vcpu’s currently pending exceptions, interrupts, NMIs, etc
See the documentation for KVM_GET_VCPU_EVENTS.
sourcepub fn set_vcpu_events(&self, events: &kvm_vcpu_events) -> Result<()>
pub fn set_vcpu_events(&self, events: &kvm_vcpu_events) -> Result<()>
Sets the vcpu’s currently pending exceptions, interrupts, NMIs, etc
See the documentation for KVM_SET_VCPU_EVENTS.
sourcepub unsafe fn kvm_enable_cap(&self, cap: &kvm_enable_cap) -> Result<()>
pub unsafe fn kvm_enable_cap(&self, cap: &kvm_enable_cap) -> Result<()>
Enable the specified capability. See documentation for KVM_ENABLE_CAP.
§Safety
This function is marked as unsafe because cap
may contain values which are interpreted as
pointers by the kernel.
sourcepub fn set_signal_mask(&self, signals: &[c_int]) -> Result<()>
pub fn set_signal_mask(&self, signals: &[c_int]) -> Result<()>
Specifies set of signals that are blocked during execution of KVM_RUN. Signals that are not blocked will cause KVM_RUN to return with -EINTR.
See the documentation for KVM_SET_SIGNAL_MASK