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
15 #include "internal/cryptlib.h"
17 extern unsigned long OPENSSL_s390xcap_P[];
19 static sigjmp_buf ill_jmp;
20 static void ill_handler(int sig)
22 siglongjmp(ill_jmp, sig);
25 unsigned long OPENSSL_s390x_facilities(void);
27 void OPENSSL_cpuid_setup(void)
30 struct sigaction ill_act, oact;
32 if (OPENSSL_s390xcap_P[0])
35 OPENSSL_s390xcap_P[0] = 1UL << (8 * sizeof(unsigned long) - 1);
37 memset(&ill_act, 0, sizeof(ill_act));
38 ill_act.sa_handler = ill_handler;
39 sigfillset(&ill_act.sa_mask);
40 sigdelset(&ill_act.sa_mask, SIGILL);
41 sigdelset(&ill_act.sa_mask, SIGTRAP);
42 sigprocmask(SIG_SETMASK, &ill_act.sa_mask, &oset);
43 sigaction(SIGILL, &ill_act, &oact);
45 /* protection against missing store-facility-list-extended */
46 if (sigsetjmp(ill_jmp, 1) == 0)
47 OPENSSL_s390x_facilities();
49 sigaction(SIGILL, &oact, NULL);
50 sigprocmask(SIG_SETMASK, &oset, NULL);