From 68f2197cf5f81d5197999e5f3d2f980d8b04d4e2 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 29 Nov 2013 06:33:54 +0100 Subject: Use fastd will segfault in valgrind otherwise (O_o) --- src/cpuid.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/cpuid.h b/src/cpuid.h index eab9110..310f0c2 100644 --- a/src/cpuid.h +++ b/src/cpuid.h @@ -27,10 +27,7 @@ #ifndef _FASTD_CPUID_H_ #define _FASTD_CPUID_H_ -#if !(defined(__i386__) || defined(__x86_64__)) -#error Tried to include cpuid.h on a non-x86 system -#endif - +#include #include @@ -40,8 +37,11 @@ static inline uint64_t fastd_cpuid(void) { - uint32_t edx, ecx; - __asm__("cpuid" : "=d"(edx), "=c"(ecx) : "a"((uint32_t)1)); + unsigned eax, ebc, ecx, edx; + + if (!__get_cpuid(1, &eax, &ebc, &ecx, &edx)) + return 0; + return ((uint64_t)ecx) << 32 | edx; } -- cgit v1.2.3