diff options
Diffstat (limited to 'include/asm-i386')
-rw-r--r-- | include/asm-i386/msr.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/asm-i386/msr.h b/include/asm-i386/msr.h index c76fce8badbb..62b76cd96957 100644 --- a/include/asm-i386/msr.h +++ b/include/asm-i386/msr.h | |||
@@ -47,6 +47,21 @@ static inline void wrmsrl (unsigned long msr, unsigned long long val) | |||
47 | : "c" (msr), "0" (a), "d" (b), "i" (-EFAULT));\ | 47 | : "c" (msr), "0" (a), "d" (b), "i" (-EFAULT));\ |
48 | ret__; }) | 48 | ret__; }) |
49 | 49 | ||
50 | /* rdmsr with exception handling */ | ||
51 | #define rdmsr_safe(msr,a,b) ({ int ret__; \ | ||
52 | asm volatile("2: rdmsr ; xorl %0,%0\n" \ | ||
53 | "1:\n\t" \ | ||
54 | ".section .fixup,\"ax\"\n\t" \ | ||
55 | "3: movl %4,%0 ; jmp 1b\n\t" \ | ||
56 | ".previous\n\t" \ | ||
57 | ".section __ex_table,\"a\"\n" \ | ||
58 | " .align 4\n\t" \ | ||
59 | " .long 2b,3b\n\t" \ | ||
60 | ".previous" \ | ||
61 | : "=r" (ret__), "=a" (*(a)), "=d" (*(b)) \ | ||
62 | : "c" (msr), "i" (-EFAULT));\ | ||
63 | ret__; }) | ||
64 | |||
50 | #define rdtsc(low,high) \ | 65 | #define rdtsc(low,high) \ |
51 | __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high)) | 66 | __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high)) |
52 | 67 | ||