|
|
|
|
|
|
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#include <signal.h> |
|
|
#include <signal.h> |
|
|
|
|
|
#include <setjmp.h> |
|
|
|
|
|
|
|
|
unsigned long cpu_config = 0; |
|
|
unsigned long cpu_config = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
static sig_atomic_t ok = 0; |
|
|
static sig_atomic_t ok = 0; |
|
|
|
|
|
static jmp_buf j; |
|
|
|
|
|
|
|
|
static void |
|
|
static void |
|
|
rspamd_cryptobox_ill_handler (int signo) |
|
|
rspamd_cryptobox_ill_handler (int signo) |
|
|
{ |
|
|
{ |
|
|
ok = 0; |
|
|
ok = 0; |
|
|
|
|
|
longjmp (j, -1); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
static gboolean |
|
|
static gboolean |
|
|
|
|
|
|
|
|
ok = 1; |
|
|
ok = 1; |
|
|
old_handler = signal (SIGILL, rspamd_cryptobox_ill_handler); |
|
|
old_handler = signal (SIGILL, rspamd_cryptobox_ill_handler); |
|
|
|
|
|
|
|
|
|
|
|
if (setjmp (j) != 0) { |
|
|
|
|
|
signal (SIGILL, old_handler); |
|
|
|
|
|
|
|
|
|
|
|
return FALSE; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
switch (instr) { |
|
|
switch (instr) { |
|
|
#ifdef HAVE_SSE2 |
|
|
#ifdef HAVE_SSE2 |
|
|
case CPUID_SSE2: |
|
|
case CPUID_SSE2: |
|
|
|
|
|
|
|
|
signal (SIGILL, old_handler); |
|
|
signal (SIGILL, old_handler); |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
/* We actually never return here if SIGILL has been caught */ |
|
|
return ok == 1; |
|
|
return ok == 1; |
|
|
} |
|
|
} |
|
|
|
|
|
|