summaryrefslogtreecommitdiff
path: root/cpu.cpp
diff options
context:
space:
mode:
authorweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2007-08-13 23:53:09 +0000
committerweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2007-08-13 23:53:09 +0000
commitebb56f57edd46175798c2a70b6dd88bd6ce7f877 (patch)
treef096ef9661b273e6059f26284dd133c439a528b4 /cpu.cpp
parent3d0cf61bb4132e0ade13f86a9af16b2702aab524 (diff)
downloadcryptopp-ebb56f57edd46175798c2a70b6dd88bd6ce7f877.tar.gz
fixed Whirlpool crash on Pentium 2 machines
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@385 57ff6487-cd31-0410-9ec3-f628ee90f5f0
Diffstat (limited to 'cpu.cpp')
-rwxr-xr-xcpu.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/cpu.cpp b/cpu.cpp
index 4d8577e..3e46804 100755
--- a/cpu.cpp
+++ b/cpu.cpp
@@ -145,7 +145,7 @@ static bool TrySSE2()
}
bool g_x86DetectionDone = false;
-bool g_hasSSE2 = false, g_hasSSSE3 = false, g_hasMMX = false, g_isP4 = false;
+bool g_hasISSE = false, g_hasSSE2 = false, g_hasSSSE3 = false, g_hasMMX = false, g_isP4 = false;
word32 g_cacheLineSize = CRYPTOPP_L1_CACHE_LINE_SIZE;
void DetectX86Features()
@@ -161,6 +161,19 @@ void DetectX86Features()
g_hasSSE2 = TrySSE2();
g_hasSSSE3 = g_hasSSE2 && (cpuid1[2] & (1<<9));
+ if ((cpuid1[3] & (1 << 25)) != 0)
+ g_hasISSE = true;
+ else
+ {
+ word32 cpuid2[4];
+ CpuId(0x080000000, cpuid2);
+ if (cpuid2[0] >= 0x080000001)
+ {
+ CpuId(0x080000001, cpuid2);
+ g_hasISSE = (cpuid2[3] & (1 << 22)) != 0;
+ }
+ }
+
std::swap(cpuid[2], cpuid[3]);
if (memcmp(cpuid+1, "GenuineIntel", 12) == 0)
{