Skip to main content

Module fpu

Module fpu 

Source
Expand description

s9vm : host/guest FPU and SIMD state switching around a guest entry.

Neither VT-x nor AMD-V switches x87/SSE/AVX state: after vmrun/vmlaunch the registers hold whatever the guest left. The kernel switches FPU state only at task context switches, so a guest entered from a syscall would destroy the calling task’s live SIMD registers, and the host would destroy the guest’s between two exits. FpuSwitch saves the host state, loads the guest’s, and does the opposite on the way out.

The XCR0 of the guest can differ from the host’s (AMD-V runs the guest with the real XCR0). It is switched together with the state it describes.

Re-exports§

use alloc::vec::Vec; 🔒
use super::svm_state::validate_xcr0; 🔒

Structs§

Chunk 🔒
One 64-byte unit, so a Vec of them is 64-byte aligned (XSAVE alignment).
FpuArea 🔒
A zero-initialized, 64-byte aligned XSAVE/FXSAVE area.
FpuSwitch
Host and guest FPU/SIMD state of one vCPU.
HostFpu
Proof that FpuSwitch::enter ran, carrying the host XCR0 to restore.

Enums§

FpuError
FPU switching errors.

Constants§

XCR0_SSE 🔒
XCR0.SSE.

Functions§

restore 🔒 ⚠
Restores the FPU/SIMD state of the current CPU from area.
save 🔒 ⚠
Saves the FPU/SIMD state of the current CPU into area.