Trait hypervisor::x86_64::VcpuX86_64
source · pub trait VcpuX86_64: Vcpu {
Show 29 methods
fn set_interrupt_window_requested(&self, requested: bool);
fn ready_for_interrupt(&self) -> bool;
fn interrupt(&self, irq: u32) -> Result<()>;
fn inject_nmi(&self) -> Result<()>;
fn get_regs(&self) -> Result<Regs>;
fn set_regs(&self, regs: &Regs) -> Result<()>;
fn get_sregs(&self) -> Result<Sregs>;
fn set_sregs(&self, sregs: &Sregs) -> Result<()>;
fn get_fpu(&self) -> Result<Fpu>;
fn set_fpu(&self, fpu: &Fpu) -> Result<()>;
fn get_debugregs(&self) -> Result<DebugRegs>;
fn set_debugregs(&self, debugregs: &DebugRegs) -> Result<()>;
fn get_xcrs(&self) -> Result<Vec<Register>>;
fn set_xcrs(&self, xcrs: &[Register]) -> Result<()>;
fn get_xsave(&self) -> Result<Xsave>;
fn set_xsave(&self, xsave: &Xsave) -> Result<()>;
fn get_interrupt_state(&self) -> Result<Value>;
fn set_interrupt_state(&self, data: Value) -> Result<()>;
fn get_msrs(&self, msrs: &mut Vec<Register>) -> Result<()>;
fn get_all_msrs(&self) -> Result<Vec<Register>>;
fn set_msrs(&self, msrs: &[Register]) -> Result<()>;
fn set_cpuid(&self, cpuid: &CpuId) -> Result<()>;
fn get_hyperv_cpuid(&self) -> Result<CpuId>;
fn set_guest_debug(
&self,
addrs: &[GuestAddress],
enable_singlestep: bool
) -> Result<()>;
fn handle_cpuid(&mut self, entry: &CpuIdEntry) -> Result<()>;
fn get_tsc_offset(&self) -> Result<u64>;
fn set_tsc_offset(&self, offset: u64) -> Result<()>;
fn snapshot(&self) -> Result<VcpuSnapshot> { ... }
fn restore(&mut self, snapshot: &VcpuSnapshot) -> Result<()> { ... }
}
Expand description
A wrapper around creating and using a VCPU on x86_64.
Required Methods§
sourcefn set_interrupt_window_requested(&self, requested: bool)
fn set_interrupt_window_requested(&self, requested: bool)
Sets or clears the flag that requests the VCPU to exit when it becomes possible to inject interrupts into the guest.
sourcefn ready_for_interrupt(&self) -> bool
fn ready_for_interrupt(&self) -> bool
Checks if we can inject an interrupt into the VCPU.
sourcefn inject_nmi(&self) -> Result<()>
fn inject_nmi(&self) -> Result<()>
Injects a non-maskable interrupt into the VCPU.
sourcefn get_debugregs(&self) -> Result<DebugRegs>
fn get_debugregs(&self) -> Result<DebugRegs>
Gets the VCPU debug registers.
sourcefn set_debugregs(&self, debugregs: &DebugRegs) -> Result<()>
fn set_debugregs(&self, debugregs: &DebugRegs) -> Result<()>
Sets the VCPU debug registers.
sourcefn set_xsave(&self, xsave: &Xsave) -> Result<()>
fn set_xsave(&self, xsave: &Xsave) -> Result<()>
Sets the VCPU x87 FPU, MMX, XMM, YMM and MXCSR registers.
sourcefn get_interrupt_state(&self) -> Result<Value>
fn get_interrupt_state(&self) -> Result<Value>
Gets interrupt state (hypervisor specific) for this VCPU that must be saved/restored for snapshotting.
sourcefn set_interrupt_state(&self, data: Value) -> Result<()>
fn set_interrupt_state(&self, data: Value) -> Result<()>
Sets interrupt state (hypervisor specific) for this VCPU. Only used for snapshotting.
sourcefn get_msrs(&self, msrs: &mut Vec<Register>) -> Result<()>
fn get_msrs(&self, msrs: &mut Vec<Register>) -> Result<()>
Gets the model-specific registers. msrs
specifies the MSR indexes to be queried, and
on success contains their indexes and values.
sourcefn get_all_msrs(&self) -> Result<Vec<Register>>
fn get_all_msrs(&self) -> Result<Vec<Register>>
Gets the model-specific registers. Returns all the MSRs for the VCPU.
sourcefn set_cpuid(&self, cpuid: &CpuId) -> Result<()>
fn set_cpuid(&self, cpuid: &CpuId) -> Result<()>
Sets up the data returned by the CPUID instruction.
sourcefn get_hyperv_cpuid(&self) -> Result<CpuId>
fn get_hyperv_cpuid(&self) -> Result<CpuId>
Gets the system emulated hyper-v CPUID values.
sourcefn set_guest_debug(
&self,
addrs: &[GuestAddress],
enable_singlestep: bool
) -> Result<()>
fn set_guest_debug(
&self,
addrs: &[GuestAddress],
enable_singlestep: bool
) -> Result<()>
Sets up debug registers and configure vcpu for handling guest debug events.
sourcefn handle_cpuid(&mut self, entry: &CpuIdEntry) -> Result<()>
fn handle_cpuid(&mut self, entry: &CpuIdEntry) -> Result<()>
This function should be called after Vcpu::run
returns VcpuExit::Cpuid
, and entry
should represent the result of emulating the CPUID instruction. The handle_cpuid
function
will then set the appropriate registers on the vcpu.
sourcefn get_tsc_offset(&self) -> Result<u64>
fn get_tsc_offset(&self) -> Result<u64>
Get the guest->host TSC offset
sourcefn set_tsc_offset(&self, offset: u64) -> Result<()>
fn set_tsc_offset(&self, offset: u64) -> Result<()>
Set the guest->host TSC offset
Provided Methods§
sourcefn snapshot(&self) -> Result<VcpuSnapshot>
fn snapshot(&self) -> Result<VcpuSnapshot>
Snapshot vCPU state
fn restore(&mut self, snapshot: &VcpuSnapshot) -> Result<()>
Implementations§
source§impl dyn VcpuX86_64
impl dyn VcpuX86_64
sourcepub fn is<__T: VcpuX86_64>(&self) -> bool
pub fn is<__T: VcpuX86_64>(&self) -> bool
Returns true if the trait object wraps an object of type __T
.
sourcepub fn downcast<__T: VcpuX86_64>(self: Box<Self>) -> Result<Box<__T>, Box<Self>>
pub fn downcast<__T: VcpuX86_64>(self: Box<Self>) -> Result<Box<__T>, Box<Self>>
Returns a boxed object from a boxed trait object if the underlying object is of type
__T
. Returns the original boxed trait if it isn’t.
sourcepub fn downcast_rc<__T: VcpuX86_64>(self: Rc<Self>) -> Result<Rc<__T>, Rc<Self>>
pub fn downcast_rc<__T: VcpuX86_64>(self: Rc<Self>) -> Result<Rc<__T>, Rc<Self>>
Returns an Rc
-ed object from an Rc
-ed trait object if the underlying object is of
type __T
. Returns the original Rc
-ed trait if it isn’t.
sourcepub fn downcast_ref<__T: VcpuX86_64>(&self) -> Option<&__T>
pub fn downcast_ref<__T: VcpuX86_64>(&self) -> Option<&__T>
Returns a reference to the object within the trait object if it is of type __T
, or
None
if it isn’t.
sourcepub fn downcast_mut<__T: VcpuX86_64>(&mut self) -> Option<&mut __T>
pub fn downcast_mut<__T: VcpuX86_64>(&mut self) -> Option<&mut __T>
Returns a mutable reference to the object within the trait object if it is of type
__T
, or None
if it isn’t.