summaryrefslogtreecommitdiff
path: root/extra/yassl
diff options
context:
space:
mode:
authorunknown <msvensson@pilot.blaudden>2007-04-11 22:12:32 +0200
committerunknown <msvensson@pilot.blaudden>2007-04-11 22:12:32 +0200
commit1772776e272e67dbdfd1da7fbad211202638b58e (patch)
treee5fb5e7ac0beadc29d1ecb84d30a23ad75d8dd42 /extra/yassl
parent48098cddb121136b456c3392bdb8f470559942ac (diff)
parent15050080f13d67a1e35fd92dbd3a05de27f0ee50 (diff)
downloadmariadb-git-1772776e272e67dbdfd1da7fbad211202638b58e.tar.gz
Merge pilot.blaudden:/home/msvensson/mysql/mysql-5.0-maint
into pilot.blaudden:/home/msvensson/mysql/mysql-5.1-maint
Diffstat (limited to 'extra/yassl')
-rw-r--r--extra/yassl/taocrypt/src/misc.cpp37
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
}