From f5e6136830b4c1e02327d1767030181364651e40 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Sat, 1 Jul 2017 00:58:55 +0200 Subject: For code logic clarity, add check for xgetbv support in CPU before using it. --- src/Crypto/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Crypto') diff --git a/src/Crypto/cpu.c b/src/Crypto/cpu.c index a9c6e926..7ec5b988 100644 --- a/src/Crypto/cpu.c +++ b/src/Crypto/cpu.c @@ -305,7 +305,7 @@ void DetectX86Features() g_hasMMX = (cpuid1[3] & (1 << 23)) != 0; if ((cpuid1[3] & (1 << 26)) != 0) 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(); g_hasAVX = (xcrFeatureMask & 0x6) == 0x6; -- cgit v1.2.3