From c91813c0b4b65e977c8d57e99252d11a839324f5 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Wed, 8 May 2019 19:46:23 -0400 Subject: [PATCH] Use fallback in detecting VIA cach line size --- cpu.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cpu.cpp b/cpu.cpp index a843d2d8..ae6c9455 100644 --- a/cpu.cpp +++ b/cpu.cpp @@ -458,6 +458,14 @@ void DetectX86Features() CpuId(0xC0000005, 0, cpuid2); g_cacheLineSize = GETBYTE(cpuid2[2] /*ECX*/, 0); } +#if defined(_SC_LEVEL1_DCACHE_LINESIZE) + else + { + int cacheLineSize = sysconf(_SC_LEVEL1_DCACHE_LINESIZE); + if (cacheLineSize > 0) + g_cacheLineSize = cacheLineSize; + } +#endif } if (g_cacheLineSize == 0)