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