Merge pull request #198 from tevador/pr-applem1

Apple silicon: force W^X, enable hardware AES
This commit is contained in:
tevador 2021-05-22 12:30:42 +02:00 committed by GitHub
commit 0db4c57823
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -62,9 +62,13 @@ namespace randomx {
cpuid(info, 0x00000007); cpuid(info, 0x00000007);
avx2_ = (info[1] & (1 << 5)) != 0; avx2_ = (info[1] & (1 << 5)) != 0;
} }
#elif defined(__aarch64__) && defined(HWCAP_AES) #elif defined(__aarch64__)
#if defined(HWCAP_AES)
long hwcaps = getauxval(AT_HWCAP); long hwcaps = getauxval(AT_HWCAP);
aes_ = (hwcaps & HWCAP_AES) != 0; aes_ = (hwcaps & HWCAP_AES) != 0;
#elif defined(__APPLE__)
aes_ = true;
#endif
#endif #endif
//TODO POWER8 AES //TODO POWER8 AES
} }

View File

@ -36,6 +36,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "jit_compiler_fallback.hpp" #include "jit_compiler_fallback.hpp"
#endif #endif
#if defined(__OpenBSD__) || defined(__NetBSD__) #if defined(__OpenBSD__) || defined(__NetBSD__) || (defined(__APPLE__) && defined(__aarch64__))
#define RANDOMX_FORCE_SECURE #define RANDOMX_FORCE_SECURE
#endif #endif