From 5b3e986ff1f6fef7aa2c2551832703f6e8faf033 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Thu, 2 Apr 2020 18:35:18 -0700 Subject: [PATCH] Fix cache size detection using cpuid --- src/coreclr/src/vm/util.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coreclr/src/vm/util.cpp b/src/coreclr/src/vm/util.cpp index 3a05a9d3fa3af..cf01ddf2d6563 100644 --- a/src/coreclr/src/vm/util.cpp +++ b/src/coreclr/src/vm/util.cpp @@ -1604,7 +1604,7 @@ static size_t GetCacheSizeFromCpuId() DWORD maxCpuId = getcpuid(0, buffer); - if (memcmp(buffer + 4, "GenuineIntel", 12) == 0) + if (memcmp(buffer + 4, "Genu" "ntel" "ineI" /* intentionally swapped */, 12) == 0) { /* //The following lines are commented because the OS API on Windows 2003 SP1 is not returning the Cache Relation information on x86. @@ -1648,7 +1648,7 @@ static size_t GetCacheSizeFromCpuId() } } } - else if (memcmp(buffer + 4, "AuthenticAMD", 12) == 0) + else if (memcmp(buffer + 4, "Auth" "cAMD" "enti" /* intentionally swapped */, 12) == 0) { if (getcpuid(0x80000000, buffer) >= 0x80000006) {