pub struct FpuSwitch {
host: FpuArea,
guest: FpuArea,
uses_xsave: bool,
supported_xcr0: u64,
guest_xcr0: u64,
}Expand description
Host and guest FPU/SIMD state of one vCPU.
Fields§
§host: FpuArea§guest: FpuArea§uses_xsave: bool§supported_xcr0: u64XCR0 bits the host supports (upper bound for the guest).
guest_xcr0: u64XCR0 the guest believes it has; 0 = follow the host’s XCR0.
Implementations§
Source§impl FpuSwitch
impl FpuSwitch
Sourcepub fn guest_xcr0(&self) -> Option<u64>
pub fn guest_xcr0(&self) -> Option<u64>
XCR0 as seen by the guest (None while it follows the host’s).
Sourcepub fn set_guest_xcr0(&mut self, value: u64) -> bool
pub fn set_guest_xcr0(&mut self, value: u64) -> bool
Sets the guest XCR0 after an xsetbv. Returns false, changing
nothing, when the value is architecturally invalid or unsupported.
Sourcefn hardware_guest_xcr0(&self, host_xcr0: u64) -> u64
fn hardware_guest_xcr0(&self, host_xcr0: u64) -> u64
XCR0 programmed while the guest runs.
SSE is always included: the XMM registers must be switched even when
the guest never enabled them in XCR0, otherwise the host’s XMM contents
would be visible to (and clobbered by) the guest.
Sourcepub unsafe fn enter(&mut self) -> HostFpu
pub unsafe fn enter(&mut self) -> HostFpu
Saves the host state, then loads the guest’s (and its XCR0).
§Safety
Local interrupts must be disabled from this call until the matching
Self::leave: a context switch in between would save the guest state
into the interrupted task’s area.
Sourcepub unsafe fn leave(&mut self, token: HostFpu)
pub unsafe fn leave(&mut self, token: HostFpu)
Saves the guest state, then restores the host’s (and its XCR0).
§Safety
Same as Self::enter; token must come from the matching enter.
Auto Trait Implementations§
impl Forget for FpuSwitch
impl Freeze for FpuSwitch
impl Move for FpuSwitch
impl RefUnwindSafe for FpuSwitch
impl Send for FpuSwitch
impl Sync for FpuSwitch
impl Unpin for FpuSwitch
impl UnsafeUnpin for FpuSwitch
impl UnwindSafe for FpuSwitch
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