From 1cce778585d6aed9b272ae975a45196279648e24 Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Mon, 4 Oct 2021 16:46:41 +0200 Subject: [PATCH] Fix detection of Apple M1 "Vortex" --- cpuid_arm64.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/cpuid_arm64.c b/cpuid_arm64.c index 2a9399f..430429c 100644 --- a/cpuid_arm64.c +++ b/cpuid_arm64.c @@ -26,7 +26,7 @@ *****************************************************************************/ #include -#ifdef OS_DARWIN +#ifdef __APPLE__ #include int32_t value; size_t length=sizeof(value); @@ -212,9 +212,9 @@ int detect(void) } #else -#ifdef DARWIN +#ifdef __APPLE__ sysctlbyname("hw.cpufamily",&value,&length,NULL,0); - if (value ==131287967) return CPU_VORTEX; + if (value ==131287967|| value == 458787763 ) return CPU_VORTEX; #endif return CPU_ARMV8; #endif @@ -265,7 +265,7 @@ int n=0; printf("#define NUM_CORES %d\n",n); #endif -#ifdef DARWIN +#ifdef __APPLE__ sysctlbyname("hw.physicalcpu_max",&value,&length,NULL,0); printf("#define NUM_CORES %d\n",value); #endif @@ -420,7 +420,7 @@ void get_cpuconfig(void) printf("#define DTB_DEFAULT_ENTRIES 64 \n"); printf("#define DTB_SIZE 4096 \n"); break; -#ifdef DARWIN +#ifdef __APPLE__ case CPU_VORTEX: printf("#define VORTEX \n"); sysctlbyname("hw.l1icachesize",&value,&length,NULL,0); @@ -431,6 +431,8 @@ void get_cpuconfig(void) printf("#define L1_DATA_SIZE %d \n",value); sysctlbyname("hw.l2dcachesize",&value,&length,NULL,0); printf("#define L2_SIZE %d \n",value); + printf("#define DTB_DEFAULT_ENTRIES 64 \n"); + printf("#define DTB_SIZE 4096 \n"); break; #endif } -- 2.7.4