Commit 81af4449 authored by Vojtech Pavlik's avatar Vojtech Pavlik Committed by Andi Kleen

[PATCH] Add macros for rdtscp

This patch adds macros for reading tsc via the RDTSCP instruction, as well
as writing the auxilliary MSR read by RDTSCP to msr.h

[AK: changed rdtscp definition for old binutils]
Signed-off-by: default avatarVojtech Pavlik <vojtech@suse.cz>
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
parent 248dcb2f
...@@ -66,14 +66,25 @@ ...@@ -66,14 +66,25 @@
#define rdtscl(low) \ #define rdtscl(low) \
__asm__ __volatile__ ("rdtsc" : "=a" (low) : : "edx") __asm__ __volatile__ ("rdtsc" : "=a" (low) : : "edx")
#define rdtscp(low,high,aux) \
asm volatile (".byte 0x0f,0x01,0xf9" : "=a" (low), "=d" (high), "=c" (aux))
#define rdtscll(val) do { \ #define rdtscll(val) do { \
unsigned int __a,__d; \ unsigned int __a,__d; \
asm volatile("rdtsc" : "=a" (__a), "=d" (__d)); \ asm volatile("rdtsc" : "=a" (__a), "=d" (__d)); \
(val) = ((unsigned long)__a) | (((unsigned long)__d)<<32); \ (val) = ((unsigned long)__a) | (((unsigned long)__d)<<32); \
} while(0) } while(0)
#define rdtscpll(val, aux) do { \
unsigned long __a, __d; \
asm volatile (".byte 0x0f,0x01,0xf9" : "=a" (__a), "=d" (__d), "=c" (aux)); \
(val) = (__d << 32) | __a; \
} while (0)
#define write_tsc(val1,val2) wrmsr(0x10, val1, val2) #define write_tsc(val1,val2) wrmsr(0x10, val1, val2)
#define write_rdtscp_aux(val) wrmsr(0xc0000103, val, 0)
#define rdpmc(counter,low,high) \ #define rdpmc(counter,low,high) \
__asm__ __volatile__("rdpmc" \ __asm__ __volatile__("rdpmc" \
: "=a" (low), "=d" (high) \ : "=a" (low), "=d" (high) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment