2 * mono-hwcap-s390x.c: S/390x 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
21 #include "mono/utils/mono-hwcap-s390x.h"
25 gboolean mono_hwcap_s390x_has_ld = FALSE;
28 catch_sigill (int sig_no, siginfo_t *info, gpointer act)
30 mono_hwcap_s390x_has_ld = FALSE;
34 mono_hwcap_arch_init (void)
36 mono_hwcap_s390x_has_ld = TRUE;
38 struct sigaction sa, *old_sa;
40 /* Determine if we have a long displacement facility
41 * by executing the STY instruction. If it fails, we
42 * catch the SIGILL and assume the answer is no.
44 sa.sa_sigaction = catch_sigill;
45 sigemptyset (&sa.sa_mask);
46 sa.sa_flags = SA_SIGINFO;
48 sigaction (SIGILL, &sa, old_sa);
50 __asm__ __volatile__ (
53 ".byte\t0xe3,0x00,0x10,0x00,0x00,0x50\n\t"
54 : "=m" (mono_hwcap_s390x_has_ld)
59 sigaction (SIGILL, old_sa, NULL);
63 mono_hwcap_print (FILE *f)
65 g_fprintf (f, "mono_hwcap_s390x_has_ld = %i\n", mono_hwcap_s390x_has_ld);