x86: re-add rdmsrl_safe
authorAndi Kleen <andi@firstfloor.org>
Sat, 22 Mar 2008 09:59:28 +0000 (10:59 +0100)
committerIngo Molnar <mingo@elte.hu>
Thu, 17 Apr 2008 15:41:30 +0000 (17:41 +0200)
RDMSR for 64bit values with exception handling.

Makes it easier to deal with 64bit valued MSRs. The old 64bit code
base had that too as checking_rdmsrl(), but it got dropped somehow.

Signed-off-by: Andi Kleen <andi@firstfloor.org>
Cc: andreas.herrmann3@amd.com
Cc: mingo@elte.hu
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
include/asm-x86/msr.h
include/asm-x86/paravirt.h

index 2c698a2e81f9716e3c43ae3f70da1950d6ff1ce9..3707650a169b5704a6ffedce7ce3226effc8a7f8 100644 (file)
@@ -150,6 +150,14 @@ static inline int wrmsr_safe(unsigned msr, unsigned low, unsigned high)
        __err;                                                  \
 })
 
+static inline int rdmsrl_safe(unsigned msr, unsigned long long *p)
+{
+       int err;
+
+       *p = native_read_msr_safe(msr, &err);
+       return err;
+}
+
 #define rdtscl(low)                                            \
        ((low) = (u32)native_read_tsc())
 
index 0c23f7940bc400d3306683faa19a9b8237ee90a2..3d419398499b4a6fe14de3eec92761f2e80ba19a 100644 (file)
@@ -693,6 +693,13 @@ do {                                               \
        _err;                                   \
 })
 
+static inline int rdmsrl_safe(unsigned msr, unsigned long long *p)
+{
+       int err;
+
+       *p = paravirt_read_msr(msr, &err);
+       return err;
+}
 
 static inline u64 paravirt_read_tsc(void)
 {