3 * PowerPC hardware feature detection
6 * Alex Rønne Petersen (alexrp@xamarin.com)
7 * Elijah Taylor (elijahtaylor@google.com)
8 * Miguel de Icaza (miguel@xamarin.com)
9 * Neale Ferguson (Neale.Ferguson@SoftwareAG-usa.com)
10 * Paolo Molaro (lupus@xamarin.com)
11 * Rodrigo Kumpera (kumpera@gmail.com)
12 * Sebastien Pouliot (sebastien@xamarin.com)
13 * Zoltan Varga (vargaz@xamarin.com)
15 * Copyright 2003 Ximian, Inc.
16 * Copyright 2003-2011 Novell, Inc
17 * Copyright 2006 Broadcom
18 * Copyright 2007-2008 Andreas Faerber
19 * Copyright 2011-2013 Xamarin Inc
20 * Licensed under the MIT license. See LICENSE file in the project root for full license information.
23 #include "mono/utils/mono-hwcap.h"
25 #if defined(__linux__) && defined(HAVE_SYS_AUXV_H)
31 mono_hwcap_arch_init (void)
33 #if defined(__linux__) && defined(HAVE_SYS_AUXV_H)
35 unsigned long platform;
37 if ((hwcap = getauxval(AT_HWCAP))) {
38 /* PPC_FEATURE_ICACHE_SNOOP */
39 if (hwcap & 0x00002000)
40 mono_hwcap_ppc_has_icache_snoop = TRUE;
42 /* PPC_FEATURE_POWER4, PPC_FEATURE_POWER5, PPC_FEATURE_POWER5_PLUS,
43 PPC_FEATURE_CELL_BE, PPC_FEATURE_PA6T, PPC_FEATURE_ARCH_2_05 */
44 if (hwcap & (0x00080000 | 0x00040000 | 0x00020000 | 0x00010000 | 0x00000800 | 0x00001000))
45 mono_hwcap_ppc_is_isa_2x = TRUE;
48 if (hwcap & 0x40000000)
49 mono_hwcap_ppc_is_isa_64 = TRUE;
51 /* PPC_FEATURE_POWER6_EXT */
52 if (hwcap & 0x00000200)
53 mono_hwcap_ppc_has_move_fpr_gpr = TRUE;
56 if ((platform = getauxval(AT_PLATFORM))) {
57 const char *str = (const char *) platform;
59 if (!strcmp (str, "ppc970") || (!strncmp (str, "power", 5) && str [5] >= '4' && str [5] <= '7'))
60 mono_hwcap_ppc_has_multiple_ls_units = TRUE;