undo change in mini.c
[mono-project.git] / mono / utils / mono-hwcap-riscv.c
blobb2f5dbcfe40133385e01884c1802199151883ee2
1 /*
2 * Licensed to the .NET Foundation under one or more agreements.
3 * The .NET Foundation licenses this file to you under the MIT license.
4 * See the LICENSE file in the project root for more information.
5 */
7 #include <mono/utils/mono-hwcap.h>
9 #include <sys/auxv.h>
11 void
12 mono_hwcap_arch_init (void)
14 // See arch/riscv/include/uapi/asm/hwcap.h in the kernel source tree.
16 unsigned long hwcap;
18 if ((hwcap = getauxval (AT_HWCAP))) {
19 // COMPAT_HWCAP_ISA_A
20 if (hwcap & (1 << ('A' - 'A')))
21 mono_hwcap_riscv_has_stdext_a = TRUE;
23 // COMPAT_HWCAP_ISA_C
24 if (hwcap & (1 << ('C' - 'A')))
25 mono_hwcap_riscv_has_stdext_c = TRUE;
27 // COMPAT_HWCAP_ISA_D
28 if (hwcap & (1 << ('D' - 'A')))
29 mono_hwcap_riscv_has_stdext_d = TRUE;
31 // COMPAT_HWCAP_ISA_F
32 if (hwcap & (1 << ('F' - 'A')))
33 mono_hwcap_riscv_has_stdext_f = TRUE;
35 // Why does COMPAT_HWCAP_ISA_I even exist...?
37 // COMPAT_HWCAP_ISA_M
38 if (hwcap & (1 << ('M' - 'A')))
39 mono_hwcap_riscv_has_stdext_m = TRUE;