Skip to content
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

List of flags in README and flags checked for are not identical #7

Open
HenrikBengtsson opened this issue Apr 25, 2023 · 1 comment

Comments

@HenrikBengtsson
Copy link
Owner

No description provided.

@mmilburn
Copy link

mmilburn commented Mar 1, 2024

Hi Henrik,
I wanted to look at this issue and see if it could be addressed. Is this something you'd take outside contributions on?

I've done a bit of cursory investigation to see if I can understand some of the intent here (and because I'm not an x86 expert).
The first flag I ran across that is not directly exposed by /proc/cpuinfo is OSFXSR. I checked up on the cpuinfo documentation to get an idea of how the kernel exposes feature flags.
Looking at some documentation for the cpuid instruction, bit 24 of the double word result we get in EDX appears to indicate support for both FXSR and OSFXSR (it also implies that the OS is responsible for setting the OSFXSR bit). In addition, the comment in cpufeatures.h is consistent with this.

We do not have direct access to the CR4 register in userspace to check the OSFXSR bit (see the description field for bit 9 of CR4 on wikipedia), but we do know that the kernel only shows the sse (xmm) feature flag if the fxsr feature flag is also set.

There is the possibility of a pathological case where non-sse fxsr is supported, but the kernel setting the sse flag without true OSFXSR support would break all sse code.

So in a hypothetical pull request, I might note in the README that we cannot directly check for OSFXSR but that the presence of the sse feature flag implies OSFXSR support.

Anyway, I've laid all this out to demonstrate how I intend to approach the issue.

-Mark

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

No branches or pull requests

2 participants