diff options
author | unknown <msvensson@pilot.blaudden> | 2007-04-11 22:07:24 +0200 |
---|---|---|
committer | unknown <msvensson@pilot.blaudden> | 2007-04-11 22:07:24 +0200 |
commit | c6b0cff186dc8a275da5775e0207edac5cb2b1f2 (patch) | |
tree | 2e88c03f9cf181eaa80fcf12dc661b74b8cc4a1b | |
parent | 561cd328a35edc7cdfd3253ba1ca0c7aa5a938d8 (diff) | |
download | mariadb-git-c6b0cff186dc8a275da5775e0207edac5cb2b1f2.tar.gz |
Bug#21765 Illegal Instruction crash on pre-pentium when using YASSL
- Import patch with different method of detecting if machine has
cpuid instruction
extra/yassl/taocrypt/src/misc.cpp:
Import patch yassl.diff
-rw-r--r-- | extra/yassl/taocrypt/src/misc.cpp | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/extra/yassl/taocrypt/src/misc.cpp b/extra/yassl/taocrypt/src/misc.cpp index 726d9e630e6..402645c93fd 100644 --- a/extra/yassl/taocrypt/src/misc.cpp +++ b/extra/yassl/taocrypt/src/misc.cpp @@ -192,27 +192,32 @@ bool HaveCpuId() } return true; #else - typedef void (*SigHandler)(int); - - SigHandler oldHandler = signal(SIGILL, SigIllHandler); - if (oldHandler == SIG_ERR) - return false; - - bool result = true; - if (setjmp(s_env)) - result = false; - else + word32 eax, ebx; __asm__ __volatile ( - // save ebx in case -fPIC is being used - "push %%ebx; mov $0, %%eax; cpuid; pop %%ebx" - : + /* Put EFLAGS in eax and ebx */ + "pushf;" + "pushf;" + "pop %0;" + "movl %0,%1;" + + /* Flip the cpuid bit and store back in EFLAGS */ + "xorl $0x200000,%0;" + "push %0;" + "popf;" + + /* Read EFLAGS again */ + "pushf;" + "pop %0;" + "popf" + : "=r" (eax), "=r" (ebx) : - : "%eax", "%ecx", "%edx" + : "cc" ); - signal(SIGILL, oldHandler); - return result; + if (eax == ebx) + return false; + return true; #endif } |