1 /* $OpenBSD: armcap.c,v 1.6 2014/06/20 21:00:46 deraadt Exp $ */
11 unsigned int OPENSSL_armcap_P
;
14 static sigset_t all_masked
;
16 static sigjmp_buf ill_jmp
;
17 static void ill_handler (int sig
) { siglongjmp(ill_jmp
, sig
);
21 * Following subroutines could have been inlined, but it's not all
22 * ARM compilers support inline assembler...
24 void _armv7_neon_probe(void);
27 #if defined(__GNUC__) && __GNUC__>=2
28 void OPENSSL_cpuid_setup(void) __attribute__((constructor
));
32 OPENSSL_cpuid_setup(void)
38 struct sigaction ill_oact
, ill_act
;
41 static int trigger
= 0;
50 sigfillset(&all_masked
);
51 sigdelset(&all_masked
, SIGILL
);
52 sigdelset(&all_masked
, SIGTRAP
);
53 sigdelset(&all_masked
, SIGFPE
);
54 sigdelset(&all_masked
, SIGBUS
);
55 sigdelset(&all_masked
, SIGSEGV
);
57 memset(&ill_act
, 0, sizeof(ill_act
));
58 ill_act
.sa_handler
= ill_handler
;
59 ill_act
.sa_mask
= all_masked
;
61 sigprocmask(SIG_SETMASK
, &ill_act
.sa_mask
, &oset
);
62 sigaction(SIGILL
, &ill_act
, &ill_oact
);
64 if (sigsetjmp(ill_jmp
, 1) == 0) {
66 OPENSSL_armcap_P
|= ARMV7_NEON
;
69 sigaction (SIGILL
, &ill_oact
, NULL
);
70 sigprocmask(SIG_SETMASK
, &oset
, NULL
);