]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/asm-i386/msr.h
[NET]: Make /proc/net per network namespace
[linux-2.6-omap-h63xx.git] / include / asm-i386 / msr.h
index 9559894c765882975450972db6ae54078a847b18..df21ea0493694a43db95b28f760263d6595f222d 100644 (file)
@@ -77,7 +77,7 @@ static inline unsigned long long native_read_pmc(void)
 #ifdef CONFIG_PARAVIRT
 #include <asm/paravirt.h>
 #else
-
+#include <linux/errno.h>
 /*
  * Access to machine-specific registers (available on 586 and better only)
  * Note: the rd* operations modify the parameters directly (without using
@@ -86,68 +86,58 @@ static inline unsigned long long native_read_pmc(void)
 
 #define rdmsr(msr,val1,val2)                                           \
        do {                                                            \
-               unsigned long long __val = native_read_msr(msr);        \
-               val1 = __val;                                           \
-               val2 = __val >> 32;                                     \
+               u64 __val = native_read_msr(msr);                       \
+               (val1) = (u32)__val;                                    \
+               (val2) = (u32)(__val >> 32);                            \
        } while(0)
 
-#define wrmsr(msr,val1,val2)                                           \
-       native_write_msr(msr, ((unsigned long long)val2 << 32) | val1)
-
-#define rdmsrl(msr,val)                                        \
-       do {                                            \
-               (val) = native_read_msr(msr);           \
-       } while(0)
-
-static inline void wrmsrl (unsigned long msr, unsigned long long val)
+static inline void wrmsr(u32 __msr, u32 __low, u32 __high)
 {
-       unsigned long lo, hi;
-       lo = (unsigned long) val;
-       hi = val >> 32;
-       wrmsr (msr, lo, hi);
+       native_write_msr(__msr, ((u64)__high << 32) | __low);
 }
 
+#define rdmsrl(msr,val)                                                        \
+       ((val) = native_read_msr(msr))
+
+#define wrmsrl(msr,val)        native_write_msr(msr, val)
+
 /* wrmsr with exception handling */
-#define wrmsr_safe(msr,val1,val2)                                              \
-       (native_write_msr_safe(msr, ((unsigned long long)val2 << 32) | val1))
+static inline int wrmsr_safe(u32 __msr, u32 __low, u32 __high)
+{
+       return native_write_msr_safe(__msr, ((u64)__high << 32) | __low);
+}
 
 /* rdmsr with exception handling */
 #define rdmsr_safe(msr,p1,p2)                                          \
        ({                                                              \
                int __err;                                              \
-               unsigned long long __val = native_read_msr_safe(msr, &__err);\
-               (*p1) = __val;                                          \
-               (*p2) = __val >> 32;                                    \
+               u64 __val = native_read_msr_safe(msr, &__err);          \
+               (*p1) = (u32)__val;                                     \
+               (*p2) = (u32)(__val >> 32);                             \
                __err;                                                  \
        })
 
-#define rdtsc(low,high)                                                \
-       do {                                                    \
-               u64 _l = native_read_tsc();                     \
-               (low) = (u32)_l;                                \
-               (high) = _l >> 32;                              \
-       } while(0)
-
 #define rdtscl(low)                                            \
-       do {                                                    \
-               (low) = native_read_tsc();                      \
-       } while(0)
+       ((low) = (u32)native_read_tsc())
 
-#define rdtscll(val) ((val) = native_read_tsc())
+#define rdtscll(val)                                           \
+       ((val) = native_read_tsc())
 
 #define write_tsc(val1,val2) wrmsr(0x10, val1, val2)
 
 #define rdpmc(counter,low,high)                                        \
        do {                                                    \
                u64 _l = native_read_pmc();                     \
-               low = (u32)_l;                                  \
-               high = _l >> 32;                                \
+               (low)  = (u32)_l;                               \
+               (high) = (u32)(_l >> 32);                       \
        } while(0)
 #endif /* !CONFIG_PARAVIRT */
 
 #ifdef CONFIG_SMP
 void rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h);
 void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h);
+int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h);
+int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h);
 #else  /*  CONFIG_SMP  */
 static inline void rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h)
 {
@@ -157,6 +147,14 @@ static inline void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
 {
        wrmsr(msr_no, l, h);
 }
+static inline int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h)
+{
+       return rdmsr_safe(msr_no, l, h);
+}
+static inline int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
+{
+       return wrmsr_safe(msr_no, l, h);
+}
 #endif  /*  CONFIG_SMP  */
 #endif
 #endif