#749 Use HWCAP to detect AES feature on ARMv8, thanks @lhirlimann.

This commit is contained in:
XMRig 2019-02-04 03:03:10 +07:00
parent 7e4858db2a
commit ab60add9d5
2 changed files with 12 additions and 3 deletions

View file

@ -11,7 +11,7 @@ option(WITH_DEBUG_LOG "Enable debug log output" OFF)
option(WITH_TLS "Enable OpenSSL support" ON)
option(WITH_ASM "Enable ASM PoW implementations" ON)
option(BUILD_STATIC "Build static binary" OFF)
option(ARM_TARGET "Force use specific ARM target 8 or 7" 0)
option(ARM_TARGET "Force use specific ARM target 8 or 7" 0)
include (CheckIncludeFile)
include (cmake/cpu.cmake)

View file

@ -25,6 +25,11 @@
#include <string.h>
#include <thread>
#if __ARM_FEATURE_CRYPTO
# include <sys/auxv.h>
# include <asm/hwcap.h>
#endif
#include "common/cpu/BasicCpuInfo.h"
@ -35,10 +40,14 @@ xmrig::BasicCpuInfo::BasicCpuInfo() :
m_brand(),
m_threads(std::thread::hardware_concurrency())
{
memcpy(m_brand, "Unknown", 7);
# ifdef XMRIG_ARMv8
memcpy(m_brand, "ARMv8", 5);
# else
memcpy(m_brand, "ARMv7", 5);
# endif
# if __ARM_FEATURE_CRYPTO
m_aes = true;
m_aes = getauxval(AT_HWCAP) & HWCAP_AES;
# endif
}