]> Pileus Git - ~andy/linux/commitdiff
x86: change rdpmc interface
authorGlauber de Oliveira Costa <gcosta@redhat.com>
Wed, 30 Jan 2008 12:31:07 +0000 (13:31 +0100)
committerIngo Molnar <mingo@elte.hu>
Wed, 30 Jan 2008 12:31:07 +0000 (13:31 +0100)
the rdpmc instruction gets a counter argument in rcx. However,
the i386 version was ignoring it. To make both x86_64 and i386 versions
the same, as well as to comply with the instruction semantics, this
parameter is added in the i386 version

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
include/asm-x86/msr.h
include/asm-x86/paravirt.h

index b6262e99fc8e9b91267859568f21ec85915f13d5..effb7319c0a5c055d5285b7d83ab3ecd794bc610 100644 (file)
@@ -94,10 +94,10 @@ static inline unsigned long long native_read_tsc(void)
        return val;
 }
 
-static inline unsigned long long native_read_pmc(void)
+static inline unsigned long long native_read_pmc(int counter)
 {
        unsigned long long val;
-       asm volatile("rdpmc" : "=A" (val));
+       asm volatile("rdpmc" : "=A" (val) : "c" (counter));
        return val;
 }
 
@@ -154,7 +154,7 @@ static inline int wrmsr_safe(u32 __msr, u32 __low, u32 __high)
 
 #define rdpmc(counter,low,high)                                        \
        do {                                                    \
-               u64 _l = native_read_pmc();                     \
+               u64 _l = native_read_pmc(counter);              \
                (low)  = (u32)_l;                               \
                (high) = (u32)(_l >> 32);                       \
        } while(0)
index d1780e32722e4035032cf56b181dfb6407c067ff..4782be68d0fac3b890ff1067d3f3c78e8c446915 100644 (file)
@@ -118,7 +118,7 @@ struct pv_cpu_ops {
        int (*write_msr)(unsigned int msr, u64 val);
 
        u64 (*read_tsc)(void);
-       u64 (*read_pmc)(void);
+       u64 (*read_pmc)(int counter);
 
        /* These two are jmp to, not actually called. */
        void (*irq_enable_syscall_ret)(void);