Skip to content

Commit

Permalink
x86: re-add rdmsrl_safe
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andi Kleen authored and Ingo Molnar committed Apr 17, 2008
1 parent f5c24a7 commit 1de87bd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions include/asm-x86/msr.h
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down
7 changes: 7 additions & 0 deletions include/asm-x86/paravirt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 1de87bd

Please sign in to comment.