summaryrefslogtreecommitdiffstats
path: root/src/arch/arm.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
commite6918187568dbd01842d8d1d2c808ce16a894239 (patch)
tree64f88b554b444a49f656b6c656111a145cbbaa28 /src/arch/arm.c
parentInitial commit. (diff)
downloadceph-e6918187568dbd01842d8d1d2c808ce16a894239.tar.xz
ceph-e6918187568dbd01842d8d1d2c808ce16a894239.zip
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/arch/arm.c')
-rw-r--r--src/arch/arm.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/arch/arm.c b/src/arch/arm.c
new file mode 100644
index 000000000..02f0107b7
--- /dev/null
+++ b/src/arch/arm.c
@@ -0,0 +1,37 @@
+#include "acconfig.h"
+#include "arch/probe.h"
+
+/* flags we export */
+int ceph_arch_neon = 0;
+int ceph_arch_aarch64_crc32 = 0;
+int ceph_arch_aarch64_pmull = 0;
+
+#include <stdio.h>
+
+#if __linux__
+
+#include <elf.h>
+#include <link.h> // ElfW macro
+#include <sys/auxv.h>
+
+#if __arm__ || __aarch64__
+#include <asm/hwcap.h>
+#endif // __arm__
+
+#endif // __linux__
+
+int ceph_arch_arm_probe(void)
+{
+#if __linux__
+ unsigned long hwcap = getauxval(AT_HWCAP);
+#if __arm__
+ ceph_arch_neon = (hwcap & HWCAP_NEON) == HWCAP_NEON;
+#elif __aarch64__
+ ceph_arch_neon = (hwcap & HWCAP_ASIMD) == HWCAP_ASIMD;
+ ceph_arch_aarch64_crc32 = (hwcap & HWCAP_CRC32) == HWCAP_CRC32;
+ ceph_arch_aarch64_pmull = (hwcap & HWCAP_PMULL) == HWCAP_PMULL;
+#endif
+#endif // __linux__
+ return 0;
+}
+