summaryrefslogtreecommitdiffstats
path: root/src/cpuid.h
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-12-26 00:47:12 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-12-26 00:47:12 +0100
commit7755b22419438356dcf62b54d7cce539bb4c7ce7 (patch)
treedfae1b11e7e6bf28049852e15bcec44fddd432f6 /src/cpuid.h
parenta1733e23340d8a8017bee168459c95d1c20a39f8 (diff)
downloadfastd-7755b22419438356dcf62b54d7cce539bb4c7ce7.tar
fastd-7755b22419438356dcf62b54d7cce539bb4c7ce7.zip
Change fastd_cpuid back to use inline assembly to support non-Linux systems again
Diffstat (limited to 'src/cpuid.h')
-rw-r--r--src/cpuid.h7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/cpuid.h b/src/cpuid.h
index d909ad9..e4c6d95 100644
--- a/src/cpuid.h
+++ b/src/cpuid.h
@@ -27,10 +27,8 @@
#ifndef _FASTD_CPUID_H_
#define _FASTD_CPUID_H_
-#include <cpuid.h>
#include <stdint.h>
-
#define CPUID_FXSR ((uint64_t)1 << 24)
#define CPUID_SSE2 ((uint64_t)1 << 26)
#define CPUID_PCLMULQDQ ((uint64_t)1 << 33)
@@ -38,10 +36,9 @@
static inline uint64_t fastd_cpuid(void) {
- unsigned eax, ebc, ecx, edx;
+ unsigned eax, ebx, ecx, edx;
- if (!__get_cpuid(1, &eax, &ebc, &ecx, &edx))
- return 0;
+ __asm__("cpuid" : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) : "a" (1));
return ((uint64_t)ecx) << 32 | edx;
}