mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-12 11:28:26 -06:00
For code logic clarity, add check for xgetbv support in CPU before using it.
This commit is contained in:
@@ -305,7 +305,7 @@ void DetectX86Features()
|
|||||||
g_hasMMX = (cpuid1[3] & (1 << 23)) != 0;
|
g_hasMMX = (cpuid1[3] & (1 << 23)) != 0;
|
||||||
if ((cpuid1[3] & (1 << 26)) != 0)
|
if ((cpuid1[3] & (1 << 26)) != 0)
|
||||||
g_hasSSE2 = TrySSE2();
|
g_hasSSE2 = TrySSE2();
|
||||||
if (g_hasSSE2 && (cpuid1[2] & (1 << 28)) && (cpuid1[2] & (1 << 27))) /* CPU has AVX and OS supports XSAVE/XRSTORE */
|
if (g_hasSSE2 && (cpuid1[2] & (1 << 28)) && (cpuid1[2] & (1 << 27)) && (cpuid1[2] & (1 << 26))) /* CPU has AVX and OS supports XSAVE/XRSTORE */
|
||||||
{
|
{
|
||||||
uint64 xcrFeatureMask = xgetbv();
|
uint64 xcrFeatureMask = xgetbv();
|
||||||
g_hasAVX = (xcrFeatureMask & 0x6) == 0x6;
|
g_hasAVX = (xcrFeatureMask & 0x6) == 0x6;
|
||||||
|
|||||||
Reference in New Issue
Block a user