mirror of
https://github.com/reactos/reactos.git
synced 2025-04-21 12:40:33 +00:00
HACK WIP [NTOS:KE] Detect AVX, AVX2 and AVX512
This commit is contained in:
parent
f846244e3a
commit
2f58cd792e
3 changed files with 16 additions and 3 deletions
|
@ -210,6 +210,8 @@ KiGetFeatureBits(VOID)
|
|||
if (VersionInfo.Ecx.Bits.XSAVE) FeatureBits |= KF_XSTATE;
|
||||
if (VersionInfo.Ecx.Bits.RDRAND) FeatureBits |= KF_RDRAND;
|
||||
|
||||
if (VersionInfo.Ecx.Bits.AVX) FeatureBits |= KF_AVX;
|
||||
|
||||
/* Check if the CPU has hyper-threading */
|
||||
if (VersionInfo.Edx.Bits.HTT)
|
||||
{
|
||||
|
@ -250,6 +252,9 @@ KiGetFeatureBits(VOID)
|
|||
if (ExtFlags.Ebx.Bits.SMEP) FeatureBits |= KF_SMEP;
|
||||
if (ExtFlags.Ebx.Bits.FSGSBASE) FeatureBits |= KF_RDWRFSGSBASE;
|
||||
if (ExtFlags.Ebx.Bits.SMAP) FeatureBits |= KF_SMAP;
|
||||
|
||||
if (ExtFlags.Ebx.Bits.AVX2) FeatureBits |= KF_AVX2;
|
||||
if (ExtFlags.Ebx.Bits.AVX512F) FeatureBits |= KF_AVX512F;
|
||||
}
|
||||
|
||||
/* Check if CPUID_EXTENDED_STATE (0x0D) is supported */
|
||||
|
|
|
@ -399,9 +399,12 @@ KiInitializeKernelMachineDependent(
|
|||
(FeatureBits & KF_SSE4_1) ? TRUE : FALSE;
|
||||
SharedUserData->ProcessorFeatures[PF_SSE4_2_INSTRUCTIONS_AVAILABLE] =
|
||||
(FeatureBits & KF_SSE4_2) ? TRUE : FALSE;
|
||||
SharedUserData->ProcessorFeatures[PF_AVX_INSTRUCTIONS_AVAILABLE] = FALSE; // FIXME
|
||||
SharedUserData->ProcessorFeatures[PF_AVX2_INSTRUCTIONS_AVAILABLE] = FALSE; // FIXME
|
||||
SharedUserData->ProcessorFeatures[PF_AVX512F_INSTRUCTIONS_AVAILABLE] = FALSE; // FIXME
|
||||
SharedUserData->ProcessorFeatures[PF_AVX_INSTRUCTIONS_AVAILABLE] =
|
||||
(FeatureBits & KF_AVX) ? TRUE : FALSE;
|
||||
SharedUserData->ProcessorFeatures[PF_AVX2_INSTRUCTIONS_AVAILABLE] =
|
||||
(FeatureBits & KF_AVX2) ? TRUE : FALSE;
|
||||
SharedUserData->ProcessorFeatures[PF_AVX512F_INSTRUCTIONS_AVAILABLE] =
|
||||
(FeatureBits & KF_AVX512F) ? TRUE : FALSE;
|
||||
|
||||
/* Set the default NX policy (opt-in) */
|
||||
SharedUserData->NXSupportPolicy = NX_SUPPORT_POLICY_OPTIN;
|
||||
|
|
|
@ -73,6 +73,11 @@ Author:
|
|||
#define KF_SSE4_1 0x0001000000000000ULL
|
||||
#define KF_SSE4_2 0x0002000000000000ULL
|
||||
|
||||
// Hacks
|
||||
#define KF_AVX 0x1000000000000000ULL
|
||||
#define KF_AVX2 0x2000000000000000ULL
|
||||
#define KF_AVX512F 0x4000000000000000ULL
|
||||
|
||||
#define KF_XSAVEOPT_BIT 15 // From ksamd64.inc (0x0F -> 0x8000)
|
||||
#define KF_XSTATE_BIT 23 // From ksamd64.inc (0x17 -> 0x800000)
|
||||
#define KF_RDWRFSGSBASE_BIT 28 // From ksamd64.inc (0x1C -> 0x10000000)
|
||||
|
|
Loading…
Reference in a new issue