From: Greg V Date: Sat, 14 Nov 2020 11:29:17 +0000 (+0300) Subject: Add AArch64 feature detection support for FreeBSD X-Git-Tag: v2.0.0-RC1~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ed88b15de28855f0506959b4ec0a38713844d756;p=thirdparty%2Fzlib-ng.git Add AArch64 feature detection support for FreeBSD --- diff --git a/arch/arm/armfeature.c b/arch/arm/armfeature.c index 27e06b8d5..f3764fd1d 100644 --- a/arch/arm/armfeature.c +++ b/arch/arm/armfeature.c @@ -3,6 +3,11 @@ #if defined(__linux__) # include # include +#elif defined(__FreeBSD__) && defined(__aarch64__) +# include +# ifndef ID_AA64ISAR0_CRC32_VAL +# define ID_AA64ISAR0_CRC32_VAL ID_AA64ISAR0_CRC32 +# endif #elif defined(_WIN32) # include #endif @@ -10,6 +15,9 @@ static int arm_has_crc32() { #if defined(__linux__) && defined(HWCAP2_CRC32) return (getauxval(AT_HWCAP2) & HWCAP2_CRC32) != 0 ? 1 : 0; +#elif defined(__FreeBSD__) && defined(__aarch64__) + return getenv("QEMU_EMULATING") == NULL + && ID_AA64ISAR0_CRC32_VAL(READ_SPECIALREG(id_aa64isar0_el1)) >= ID_AA64ISAR0_CRC32_BASE; #elif defined(ARM_NOCHECK_ACLE) return 1; #else