pub enum HwVcpu {
Vmx(Vcpu),
Svm(SvmBackendVcpu),
}Expand description
A virtual CPU of either backend.
Variants§
Implementations§
Source§impl HwVcpu
impl HwVcpu
Sourcepub fn new(caps: &HwCaps, pointer: u64) -> Result<Self, VcpuError>
pub fn new(caps: &HwCaps, pointer: u64) -> Result<Self, VcpuError>
Creates the hardware context of a vCPU for the active backend.
pointer is the value given by WorldMemory::second_level_pointer:
an EPTP on Intel, the nCR3 on AMD.
Sourcepub unsafe fn configure_host(&mut self) -> Result<(), VcpuError>
pub unsafe fn configure_host(&mut self) -> Result<(), VcpuError>
Sourcepub unsafe fn refresh_system_state(&mut self) -> Result<(), VcpuError>
pub unsafe fn refresh_system_state(&mut self) -> Result<(), VcpuError>
Imports the architectural state the guest produced since the last RUN.
§Safety
VT-x: the control block must be loaded and the guest inactive.
Sourcepub unsafe fn configure(
&mut self,
caps: &HwCaps,
guest: &GuestState,
) -> Result<(), VcpuError>
pub unsafe fn configure( &mut self, caps: &HwCaps, guest: &GuestState, ) -> Result<(), VcpuError>
Sourcepub unsafe fn inject_nmi(&mut self) -> Result<(), VcpuError>
pub unsafe fn inject_nmi(&mut self) -> Result<(), VcpuError>
Queues an NMI for the next entry.
§Safety
VT-x: the control block must be loaded and the guest inactive.
Sourcepub unsafe fn inject_interrupt(&mut self, vector: u8) -> Result<(), VcpuError>
pub unsafe fn inject_interrupt(&mut self, vector: u8) -> Result<(), VcpuError>
Queues an external interrupt for the next entry.
§Safety
VT-x: the control block must be loaded and the guest inactive.
Sourcepub unsafe fn set_interrupt_window_exiting(
&mut self,
caps: &HwCaps,
enabled: bool,
) -> Result<bool, VcpuError>
pub unsafe fn set_interrupt_window_exiting( &mut self, caps: &HwCaps, enabled: bool, ) -> Result<bool, VcpuError>
Arms or disarms interrupt-window exiting. Returns whether the control is armed as requested.
§Safety
VT-x: the control block must be loaded and the guest inactive.
Sourcepub unsafe fn set_external_interrupt_exiting(
&mut self,
caps: &HwCaps,
enabled: bool,
) -> Result<bool, VcpuError>
pub unsafe fn set_external_interrupt_exiting( &mut self, caps: &HwCaps, enabled: bool, ) -> Result<bool, VcpuError>
Re-arms external-interrupt exiting.
§Safety
VT-x: the control block must be loaded and the guest inactive.
Sourcepub unsafe fn interruptibility(&self) -> Result<u32, VcpuError>
pub unsafe fn interruptibility(&self) -> Result<u32, VcpuError>
Interruptibility state (bit 0: STI / MOV-SS blocking).
§Safety
VT-x: the control block must be loaded.
Sourcepub unsafe fn run(&mut self) -> Result<ExitInfo, VcpuError>
pub unsafe fn run(&mut self) -> Result<ExitInfo, VcpuError>
Enters the guest and returns on the next exit, in the VT-x shape.
§Safety
VT-x: the control block must be loaded. AMD-V: nothing beyond the activation, which is done on demand on the current CPU.
Sourcepub unsafe fn sync_msr_state(&mut self) -> Result<(), VcpuError>
pub unsafe fn sync_msr_state(&mut self) -> Result<(), VcpuError>
Pushes the MSR shadows into the hardware state.
§Safety
VT-x: the control block must be loaded and the guest inactive.
Sourcepub unsafe fn guest_diagnostics(&self) -> String
pub unsafe fn guest_diagnostics(&self) -> String
Sourcepub fn as_vmx(&self) -> Option<&Vcpu>
pub fn as_vmx(&self) -> Option<&Vcpu>
The VT-x vCPU, if that is the active backend (DOS boot and the VT-x self-tests need VT-x specifics).
Sourcepub fn flush_second_level(&mut self)
pub fn flush_second_level(&mut self)
Invalidates the guest TLB after a second-level mapping change.
Trait Implementations§
Source§impl VcpuOps for HwVcpu
impl VcpuOps for HwVcpu
Source§fn second_level_pointer(&self) -> u64
fn second_level_pointer(&self) -> u64
EPTP or nCR3).Source§fn guest(&self) -> &GuestState
fn guest(&self) -> &GuestState
Source§fn paging_enabled(&self) -> bool
fn paging_enabled(&self) -> bool
Source§fn guest_gpr(&self, register: u8) -> u64
fn guest_gpr(&self, register: u8) -> u64
Source§unsafe fn set_guest_gpr(&mut self, register: u8, value: u64)
unsafe fn set_guest_gpr(&mut self, register: u8, value: u64)
Source§unsafe fn set_guest_rip(&mut self, rip: u64)
unsafe fn set_guest_rip(&mut self, rip: u64)
Auto Trait Implementations§
impl Forget for HwVcpu
impl Freeze for HwVcpu
impl Move for HwVcpu
impl RefUnwindSafe for HwVcpu
impl Send for HwVcpu
impl Sync for HwVcpu
impl Unpin for HwVcpu
impl UnsafeUnpin for HwVcpu
impl UnwindSafe for HwVcpu
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more