Preserve guest floating-point and extended CPU state on Windows - #1340
Preserve guest floating-point and extended CPU state on Windows#1340Weiteng Chen (CvvT) wants to merge 6 commits into
Conversation
| } | ||
| } | ||
|
|
||
| const XSAVE_LEGACY_SIZE: usize = |
There was a problem hiding this comment.
Weiteng Chen (@CvvT) This part of code is more like platform-independent but architecture-dependent. Should we consider making it sharable between linux and windows platforms?
There was a problem hiding this comment.
How do we handle this in the Linux userland platform?
There was a problem hiding this comment.
Linux should be similar. I will move the common code when I add the support for Linux userland.
|
Sangho Lee (@sangho2) can you help review this PR? Thanks! |
|
🤖 SemverChecks 🤖 No breaking API changes detected Note: this does not mean API is unchanged, or even that there are no breaking changes; simply, none of the detections triggered. |
|
Do we need to worry about the below? perhaps out of this PR's scope (AArch64 Linux variant somehow handles it). |
Sangho Lee (sangho2)
left a comment
There was a problem hiding this comment.
Overall, looks good to me. We might want to use XSAVEC or XAVEOPT later, but better to have a correct implementation first.
| ); | ||
| let features = core::arch::x86_64::__cpuid_count(0x0d, 0); | ||
| let mask = unsafe { core::arch::x86_64::_xgetbv(0) }; | ||
| assert_eq!(mask & 3, 3, "x87 and SSE state must be enabled"); |
There was a problem hiding this comment.
does it mean that AVX/AVX2 are optional?
There was a problem hiding this comment.
Yes, it is optional. The code only assumes XSAVE_FORMAT that requires x87 and SSE state.
Yes, we should, but probably after I also fix Linux userland platform. |
Preserve guest floating-point and SIMD state across syscalls, exceptions, and host interrupts, while ensuring host Rust code runs with Windows ABI floating-point controls.
rip, save guest state with XSAVE and restore it with XRSTOR on the fast resume path.rip, save guest state with XSAVE but restore it with NtContinue.