Merge pull request #2979 from akoeplinger/tests-simplify
[mono.git] / mono / utils / mono-hwcap-ppc.c
index 08b32aef425c62c3e136e33081ee8054e7c04caf..174cc620a202c7af27d8012b11075f09d78d93ed 100644 (file)
  * Copyright 2006 Broadcom
  * Copyright 2007-2008 Andreas Faerber
  * Copyright 2011-2013 Xamarin Inc
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
  */
 
 #include "mono/utils/mono-hwcap-ppc.h"
 
-#if defined(__linux__)
+#if defined(__linux__) && defined(HAVE_SYS_AUXV_H)
 #include <string.h>
 #include <sys/auxv.h>
 #endif
@@ -34,7 +35,7 @@ gboolean mono_hwcap_ppc_has_multiple_ls_units = FALSE;
 void
 mono_hwcap_arch_init (void)
 {
-#if defined(__linux__)
+#if defined(__linux__) && defined(HAVE_SYS_AUXV_H)
        unsigned long hwcap;
        unsigned long platform;
 
@@ -60,8 +61,18 @@ mono_hwcap_arch_init (void)
        if ((platform = getauxval(AT_PLATFORM))) {
                const char *str = (const char *) platform;
 
-               if (!strcmp (str, "ppc970") || (!strncmp (str, "power", 5) && arch [5] >= '4' && arch [5] <= '7'))
+               if (!strcmp (str, "ppc970") || (!strncmp (str, "power", 5) && str [5] >= '4' && str [5] <= '7'))
                        mono_hwcap_ppc_has_multiple_ls_units = TRUE;
        }
 #endif
 }
+
+void
+mono_hwcap_print (FILE* f)
+{
+       g_fprintf (f, "mono_hwcap_ppc_has_icache_snoop = %i\n", mono_hwcap_ppc_has_icache_snoop);
+       g_fprintf (f, "mono_hwcap_ppc_is_isa_2x = %i\n", mono_hwcap_ppc_is_isa_2x);
+       g_fprintf (f, "mono_hwcap_ppc_is_isa_64 = %i\n", mono_hwcap_ppc_is_isa_64);
+       g_fprintf (f, "mono_hwcap_ppc_has_move_fpr_gpr = %i\n", mono_hwcap_ppc_has_move_fpr_gpr);
+       g_fprintf (f, "mono_hwcap_ppc_has_multiple_ls_units = %i\n", mono_hwcap_ppc_has_multiple_ls_units);
+}