]>
Commit | Line | Data |
---|---|---|
1 | #include "acconfig.h" | |
2 | #include "arch/probe.h" | |
3 | ||
4 | /* flags we export */ | |
5 | int ceph_arch_neon = 0; | |
6 | int ceph_arch_aarch64_crc32 = 0; | |
7 | int ceph_arch_aarch64_pmull = 0; | |
8 | ||
9 | #include <stdio.h> | |
10 | ||
11 | #if __linux__ | |
12 | ||
13 | #include <elf.h> | |
14 | #include <link.h> // ElfW macro | |
15 | #include <sys/auxv.h> | |
16 | ||
17 | #if __arm__ || __aarch64__ | |
18 | #include <asm/hwcap.h> | |
19 | #endif // __arm__ | |
20 | ||
21 | #endif // __linux__ | |
22 | ||
23 | int ceph_arch_arm_probe(void) | |
24 | { | |
25 | #if __linux__ | |
26 | unsigned long hwcap = getauxval(AT_HWCAP); | |
27 | #if __arm__ | |
28 | ceph_arch_neon = (hwcap & HWCAP_NEON) == HWCAP_NEON; | |
29 | #elif __aarch64__ | |
30 | ceph_arch_neon = (hwcap & HWCAP_ASIMD) == HWCAP_ASIMD; | |
31 | ceph_arch_aarch64_crc32 = (hwcap & HWCAP_CRC32) == HWCAP_CRC32; | |
32 | ceph_arch_aarch64_pmull = (hwcap & HWCAP_PMULL) == HWCAP_PMULL; | |
33 | #endif | |
34 | #endif // __linux__ | |
35 | return 0; | |
36 | } | |
37 |