Re: [PATCH] Cleanup: rationalize paravirt wrappers

From: Avi Kivity
Date: Thu Mar 22 2007 - 03:30:56 EST


Rusty Russell wrote:
+static inline unsigned long long native_read_msr(unsigned int msr, int *err)
+{
+ unsigned long long val;
+
+ asm volatile("2: rdmsr ; xorl %0,%0\n"
+ "1:\n\t"
+ ".section .fixup,\"ax\"\n\t"
+ "3: movl %3,%0 ; jmp 1b\n\t"
+ ".previous\n\t"
+ ".section __ex_table,\"a\"\n"
+ " .align 4\n\t"
+ " .long 2b,3b\n\t"
+ ".previous"
+ : "=r" (*err), "=A" (val)
+ : "c" (msr), "i" (-EFAULT));
+
+ return val;
+}


+#define rdmsr(msr,val1,val2) \
+ do { \
+ int __err; \
+ unsigned long long __val = native_read_msr(msr, &__err); \
+ val1 = __val; \
+ val2 = __val >> 32; \
+ } while(0)
+

You're silently changing the behavior (as well as the prototype) here, rdmsr() used to fail loudly, now it fails silently, with no way for the caller to check.


--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/