Skip to content

Fix: xstate load and restore now checks cpuid to avoid #GP or #UD on older CPUs #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 21, 2025

Conversation

aarkegz
Copy link
Contributor

@aarkegz aarkegz commented Apr 21, 2025

No description provided.

@aarkegz aarkegz requested review from hky1999 and Copilot April 21, 2025 04:23
@aarkegz aarkegz self-assigned this Apr 21, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the handling of extended processor state management in the VM by checking CPU support using CPUID before reading or writing XSAVE/XSAVES registers, thereby avoiding potential #GP or #UD exceptions on older CPUs. Key changes include:

  • Adding boolean fields to track XSAVE and XSAVES support.
  • Introducing helper functions (xsave_available, xsaves_available) for CPUID-based feature detection.
  • Refactoring host and guest state switching to use the new helper functions.

Copy link
Contributor

@hky1999 hky1999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@aarkegz
Copy link
Contributor Author

aarkegz commented Apr 21, 2025

lgtm

Thx.🙏

@aarkegz aarkegz merged commit ab5d194 into master Apr 21, 2025
6 checks passed
@aarkegz aarkegz deleted the fix_xstate branch April 21, 2025 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants