mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
x86: test the right CPUID bit when checking for XSAVEOPT support
(cherry picked from commit 960d151eaa1ecde109accc30ca0c3306551d8e58)
This commit is contained in:
parent
44aac9115f
commit
b40ed1134d
2 changed files with 10 additions and 3 deletions
|
|
@ -236,9 +236,12 @@ fpurestore_fxrstor(void *addr)
|
|||
|
||||
DEFINE_IFUNC(, void, fpusave, (void *))
|
||||
{
|
||||
u_int cp[4];
|
||||
|
||||
if (!use_xsave)
|
||||
return (fpusave_fxsave);
|
||||
if ((cpu_stdext_feature & CPUID_EXTSTATE_XSAVEOPT) != 0) {
|
||||
cpuid_count(0xd, 0x1, cp);
|
||||
if ((cp[0] & CPUID_EXTSTATE_XSAVEOPT) != 0) {
|
||||
return ((cpu_stdext_feature & CPUID_STDEXT_NFPUSG) != 0 ?
|
||||
fpusave_xsaveopt64 : fpusave_xsaveopt3264);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -317,9 +317,13 @@ fpusave_fnsave(union savefpu *addr)
|
|||
|
||||
DEFINE_IFUNC(, void, fpusave, (union savefpu *))
|
||||
{
|
||||
if (use_xsave)
|
||||
return ((cpu_stdext_feature & CPUID_EXTSTATE_XSAVEOPT) != 0 ?
|
||||
u_int cp[4];
|
||||
|
||||
if (use_xsave) {
|
||||
cpuid_count(0xd, 0x1, cp);
|
||||
return ((cp[0] & CPUID_EXTSTATE_XSAVEOPT) != 0 ?
|
||||
fpusave_xsaveopt : fpusave_xsave);
|
||||
}
|
||||
if (cpu_fxsr)
|
||||
return (fpusave_fxsave);
|
||||
return (fpusave_fnsave);
|
||||
|
|
|
|||
Loading…
Reference in a new issue