@@ -875,11 +875,11 @@ impl HyperlightVm {
875875 Ok ( ( ) )
876876 }
877877
878- // Resets the following vCPU state:
879- // - General purpose registers
880- // - Debug registers
881- // - XSAVE (includes FPU/SSE state with proper FCW and MXCSR defaults)
882- // - Special registers (with saved PML4 if feature enabled)
878+ /// Resets the following vCPU state:
879+ /// - General purpose registers
880+ /// - Debug registers
881+ /// - XSAVE (includes FPU/SSE state with proper FCW and MXCSR defaults)
882+ /// - Special registers (with saved PML4 if feature enabled)
883883 // TODO: check if other state needs to be reset
884884 pub ( crate ) fn reset_vcpu ( & self ) -> std:: result:: Result < ( ) , RegisterError > {
885885 self . vm . set_regs ( & CommonRegisters {
@@ -2344,7 +2344,8 @@ mod tests {
23442344 normalize_fpu_mxcsr_for_kvm ( & mut expected_dirty, fpu. mxcsr ) ;
23452345 assert_eq ! ( fpu, expected_dirty) ;
23462346
2347- // Verify MXCSR via xsave on KVM (since fpu() doesn't return it)
2347+ // KVM's get_fpu/set_fpu ioctls don't include MXCSR (it's in the SSE state,
2348+ // not x87 FPU state). We must use xsave to verify MXCSR on KVM.
23482349 #[ cfg( kvm) ]
23492350 if available_hv == HypervisorType :: Kvm {
23502351 let xsave = hyperlight_vm. vm . xsave ( ) . unwrap ( ) ;
@@ -2358,7 +2359,7 @@ mod tests {
23582359 // Check FPU is reset to defaults
23592360 assert_fpu_reset ( hyperlight_vm. vm . as_ref ( ) ) ;
23602361
2361- // Verify MXCSR via xsave on KVM
2362+ // Verify MXCSR via xsave on KVM (fpu() doesn't include it)
23622363 #[ cfg( kvm) ]
23632364 if available_hv == HypervisorType :: Kvm {
23642365 let xsave = hyperlight_vm. vm . xsave ( ) . unwrap ( ) ;
0 commit comments