summaryrefslogtreecommitdiffstats
path: root/src/cpuid.h
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2015-03-16 17:27:10 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2015-03-16 17:27:10 +0100
commitdb19fce8d61f7ccbb756fd1affeeb6923cf1fe69 (patch)
treecdcecfa23d35d7592edd99e79bda361c549ab734 /src/cpuid.h
parentbf811828eb0da362cbf3992a5228c5cafaf5ed8f (diff)
downloadfastd-db19fce8d61f7ccbb756fd1affeeb6923cf1fe69.tar
fastd-db19fce8d61f7ccbb756fd1affeeb6923cf1fe69.zip
fastd_cpuid: compile on GCC again
Diffstat (limited to 'src/cpuid.h')
-rw-r--r--src/cpuid.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/cpuid.h b/src/cpuid.h
index 78f87e5..bd165f2 100644
--- a/src/cpuid.h
+++ b/src/cpuid.h
@@ -48,7 +48,7 @@
/** Returns the ECX and EDX return values of CPUID function 1 as a single uint64 */
static inline uint64_t fastd_cpuid(void) {
- uint32_t ecx, edx;
+ unsigned long cx, dx;
#if defined (__i386__)
#define REG_PFX "e"
@@ -56,12 +56,13 @@ static inline uint64_t fastd_cpuid(void) {
#define REG_PFX "r"
#endif
- __asm__ __volatile__ ("mov %%"REG_PFX"bx, %%"REG_PFX"di \n\t"
+ __asm__ __volatile__ ("mov $1, %%eax \n\t"
+ "mov %%"REG_PFX"bx, %%"REG_PFX"di \n\t"
"cpuid \n\t"
"mov %%"REG_PFX"di, %%"REG_PFX"bx \n\t"
- : "=c" (ecx), "=d" (edx) : "a" (1) : REG_PFX"ax", REG_PFX"di");
+ : "=c" (cx), "=d" (dx) : : REG_PFX"ax", REG_PFX"di");
- return ((uint64_t)ecx) << 32 | edx;
+ return ((uint64_t)cx) << 32 | (uint32_t)dx;
}
#undef REG_PFX