mirror of https://github.com/openbsd/ports.git
unbreak on arm64 by implementing missing cpu feature functionality
This commit is contained in:
parent
b8adbb7159
commit
3d2207162e
|
@ -0,0 +1,41 @@
|
|||
Index: lzma/C/CpuArch.c
|
||||
--- lzma/C/CpuArch.c.orig
|
||||
+++ lzma/C/CpuArch.c
|
||||
@@ -757,8 +757,36 @@ BoolInt CPU_IsSupported_SHA1(void) { return APPLE_CRYP
|
||||
BoolInt CPU_IsSupported_SHA2(void) { return APPLE_CRYPTO_SUPPORT_VAL; }
|
||||
BoolInt CPU_IsSupported_AES (void) { return APPLE_CRYPTO_SUPPORT_VAL; }
|
||||
|
||||
+#elif defined(__OpenBSD__) // __APPLE__
|
||||
|
||||
-#else // __APPLE__
|
||||
+#include <sys/param.h>
|
||||
+#include <sys/sysctl.h>
|
||||
+#include <machine/cpu.h>
|
||||
+#include <machine/armreg.h>
|
||||
+
|
||||
+BoolInt CPU_IsSupported_NEON() { return 1; }
|
||||
+
|
||||
+#define MY_HWCAP_CHECK_FUNC_2(name1, name2) \
|
||||
+ BoolInt CPU_IsSupported_ ## name1() { \
|
||||
+ int isar0_mib[] = { CTL_MACHDEP, CPU_ID_AA64ISAR0 }; \
|
||||
+ size_t len = sizeof(uint64_t); \
|
||||
+ uint64_t cpu_id = 0; \
|
||||
+ if (sysctl(isar0_mib, 2, &cpu_id, &len, NULL, 0) < 0) \
|
||||
+ return 0; \
|
||||
+ if (ID_AA64ISAR0_ ## name2(cpu_id) >= ID_AA64ISAR0_## name2 ##_BASE) \
|
||||
+ return 1; \
|
||||
+ return 0; \
|
||||
+ }
|
||||
+
|
||||
+#define MY_HWCAP_CHECK_FUNC(name) \
|
||||
+ MY_HWCAP_CHECK_FUNC_2(name, name)
|
||||
+
|
||||
+MY_HWCAP_CHECK_FUNC (CRC32)
|
||||
+MY_HWCAP_CHECK_FUNC (SHA1)
|
||||
+MY_HWCAP_CHECK_FUNC (SHA2)
|
||||
+MY_HWCAP_CHECK_FUNC (AES)
|
||||
+
|
||||
+#else // __OpenBSD__
|
||||
|
||||
#include <sys/auxv.h>
|
||||
|
Loading…
Reference in New Issue