]>
git.ipfire.org Git - thirdparty/openssl.git/blob - crypto/armcap.c
10 unsigned int OPENSSL_armcap_P
;
12 static sigset_t all_masked
;
14 static sigjmp_buf ill_jmp
;
15 static void ill_handler(int sig
)
17 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);
25 unsigned int _armv7_tick(void);
27 unsigned int OPENSSL_rdtsc(void)
29 if (OPENSSL_armcap_P
& ARMV7_TICK
)
35 #if defined(__GNUC__) && __GNUC__>=2
36 void OPENSSL_cpuid_setup(void) __attribute__ ((constructor
));
38 void OPENSSL_cpuid_setup(void)
41 struct sigaction ill_oact
, ill_act
;
43 static int trigger
= 0;
49 if ((e
= getenv("OPENSSL_armcap"))) {
50 OPENSSL_armcap_P
= strtoul(e
, NULL
, 0);
54 sigfillset(&all_masked
);
55 sigdelset(&all_masked
, SIGILL
);
56 sigdelset(&all_masked
, SIGTRAP
);
57 sigdelset(&all_masked
, SIGFPE
);
58 sigdelset(&all_masked
, SIGBUS
);
59 sigdelset(&all_masked
, SIGSEGV
);
63 memset(&ill_act
, 0, sizeof(ill_act
));
64 ill_act
.sa_handler
= ill_handler
;
65 ill_act
.sa_mask
= all_masked
;
67 sigprocmask(SIG_SETMASK
, &ill_act
.sa_mask
, &oset
);
68 sigaction(SIGILL
, &ill_act
, &ill_oact
);
70 if (sigsetjmp(ill_jmp
, 1) == 0) {
72 OPENSSL_armcap_P
|= ARMV7_NEON
;
74 if (sigsetjmp(ill_jmp
, 1) == 0) {
76 OPENSSL_armcap_P
|= ARMV7_TICK
;
79 sigaction(SIGILL
, &ill_oact
, NULL
);
80 sigprocmask(SIG_SETMASK
, &oset
, NULL
);