[PATCH] x86: more asm cleanups

Some more assembler cleanups I noticed along the way.

Signed-off-by: Zachary Amsden <zach@vmware.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Zachary Amsden
2005-09-03 15:56:42 -07:00
committed by Linus Torvalds
parent 4f0cb8d978
commit f2ab446124
8 changed files with 35 additions and 50 deletions

View File

@@ -47,6 +47,21 @@ static inline void wrmsrl (unsigned long msr, unsigned long long val)
: "c" (msr), "0" (a), "d" (b), "i" (-EFAULT));\
ret__; })
/* rdmsr with exception handling */
#define rdmsr_safe(msr,a,b) ({ int ret__; \
asm volatile("2: rdmsr ; xorl %0,%0\n" \
"1:\n\t" \
".section .fixup,\"ax\"\n\t" \
"3: movl %4,%0 ; jmp 1b\n\t" \
".previous\n\t" \
".section __ex_table,\"a\"\n" \
" .align 4\n\t" \
" .long 2b,3b\n\t" \
".previous" \
: "=r" (ret__), "=a" (*(a)), "=d" (*(b)) \
: "c" (msr), "i" (-EFAULT));\
ret__; })
#define rdtsc(low,high) \
__asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high))