From 27ced139a619dcbc6a81de897b1045a3852cbee9 Mon Sep 17 00:00:00 2001 From: SChernykh Date: Mon, 3 May 2021 09:57:43 +0200 Subject: [PATCH] Fix AES detection on FreeBSD on ARM --- src/backend/cpu/platform/BasicCpuInfo_arm.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/backend/cpu/platform/BasicCpuInfo_arm.cpp b/src/backend/cpu/platform/BasicCpuInfo_arm.cpp index 318928cd..ad24e10b 100644 --- a/src/backend/cpu/platform/BasicCpuInfo_arm.cpp +++ b/src/backend/cpu/platform/BasicCpuInfo_arm.cpp @@ -28,7 +28,15 @@ #if __ARM_FEATURE_CRYPTO && !defined(__APPLE__) # include -# include +# ifndef __FreeBSD__ +# include +# else +# include +# include +# ifndef ID_AA64ISAR0_AES_VAL +# define ID_AA64ISAR0_AES_VAL ID_AA64ISAR0_AES +# endif +# endif #endif @@ -62,10 +70,13 @@ xmrig::BasicCpuInfo::BasicCpuInfo() : # endif # if __ARM_FEATURE_CRYPTO -# if !defined(__APPLE__) - m_flags.set(FLAG_AES, getauxval(AT_HWCAP) & HWCAP_AES); -# else +# if defined(__APPLE__) m_flags.set(FLAG_AES, true); +# elif defined(__FreeBSD__) + uint64_t isar0 = READ_SPECIALREG(id_aa64isar0_el1); + m_flags.set(FLAG_AES, ID_AA64ISAR0_AES_VAL(isar0) >= ID_AA64ISAR0_AES_BASE); +# else + m_flags.set(FLAG_AES, getauxval(AT_HWCAP) & HWCAP_AES); # endif # endif