2 * Copyright 2010-2016 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the OpenSSL license (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
16 extern unsigned long OPENSSL_s390xcap_P[];
18 static sigjmp_buf ill_jmp;
19 static void ill_handler(int sig)
21 siglongjmp(ill_jmp, sig);
24 unsigned long OPENSSL_s390x_facilities(void);
26 void OPENSSL_cpuid_setup(void)
29 struct sigaction ill_act, oact;
31 if (OPENSSL_s390xcap_P[0])
34 OPENSSL_s390xcap_P[0] = 1UL << (8 * sizeof(unsigned long) - 1);
36 memset(&ill_act, 0, sizeof(ill_act));
37 ill_act.sa_handler = ill_handler;
38 sigfillset(&ill_act.sa_mask);
39 sigdelset(&ill_act.sa_mask, SIGILL);
40 sigdelset(&ill_act.sa_mask, SIGTRAP);
41 sigprocmask(SIG_SETMASK, &ill_act.sa_mask, &oset);
42 sigaction(SIGILL, &ill_act, &oact);
44 /* protection against missing store-facility-list-extended */
45 if (sigsetjmp(ill_jmp, 1) == 0)
46 OPENSSL_s390x_facilities();
48 sigaction(SIGILL, &oact, NULL);
49 sigprocmask(SIG_SETMASK, &oset, NULL);