diff --git a/include/asm-i386/cpufeature.h b/include/asm-i386/cpufeature.h index 3f92b94..a9f1f01 100644 --- a/include/asm-i386/cpufeature.h +++ b/include/asm-i386/cpufeature.h @@ -49,6 +49,7 @@ #define X86_FEATURE_MP (1*32+19) /* MP Capable. */ #define X86_FEATURE_NX (1*32+20) /* Execute Disable */ #define X86_FEATURE_MMXEXT (1*32+22) /* AMD MMX extensions */ +#define X86_FEATURE_RDTSCP (1*32+27) /* RDTSCP */ #define X86_FEATURE_LM (1*32+29) /* Long Mode (x86-64) */ #define X86_FEATURE_3DNOWEXT (1*32+30) /* AMD 3DNow! extensions */ #define X86_FEATURE_3DNOW (1*32+31) /* 3DNow! */ diff --git a/include/asm-i386/tsc.h b/include/asm-i386/tsc.h index 84016ff..0b769ad 100644 --- a/include/asm-i386/tsc.h +++ b/include/asm-i386/tsc.h @@ -7,6 +7,7 @@ #define _ASM_i386_TSC_H #include +#include /* * Standard way to access the cycle counter. @@ -34,22 +35,16 @@ static inline cycles_t get_cycles(void) /* Like get_cycles, but make sure the CPU is synchronized. */ static __always_inline cycles_t get_cycles_sync(void) { - unsigned long long ret; -#ifdef X86_FEATURE_SYNC_RDTSC - unsigned eax; + unsigned int a, d; - /* - * Don't do an additional sync on CPUs where we know - * RDTSC is already synchronous: - */ - alternative_io("cpuid", ASM_NOP2, X86_FEATURE_SYNC_RDTSC, - "=a" (eax), "0" (1) : "ebx","ecx","edx","memory"); -#else - sync_core(); -#endif - rdtscll(ret); +#define RDTSCP ".byte 0x0f, 0x01, 0xf9" + alternative_io_two("cpuid\nrdtsc", + "rdtsc", X86_FEATURE_SYNC_RDTSC, + ".byte 0x0f, 0x01, 0xf9", X86_FEATURE_RDTSCP, + ASM_OUTPUT2("=a" (a), "=d" (d)), + "0" (1) : "ecx", "memory"); - return ret; + return ((unsigned long long)a) | (((unsigned long long)d)<<32); } extern void tsc_init(void);