]> git.karo-electronics.de Git - linux-beck.git/commitdiff
KVM: x86 emulator: correctly mask pmc index bits in RDPMC instruction emulation
authorGleb Natapov <gleb@redhat.com>
Thu, 16 Feb 2012 12:44:11 +0000 (14:44 +0200)
committerAvi Kivity <avi@redhat.com>
Thu, 8 Mar 2012 12:10:24 +0000 (14:10 +0200)
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/pmu.c

index 7aad5446f393def644e685c76dbfcd72e6b2711c..3e48c1d3edcdebea6578de7f90df8a60fd6fc5e5 100644 (file)
@@ -413,7 +413,7 @@ int kvm_pmu_read_pmc(struct kvm_vcpu *vcpu, unsigned pmc, u64 *data)
        struct kvm_pmc *counters;
        u64 ctr;
 
-       pmc &= (3u << 30) - 1;
+       pmc &= ~(3u << 30);
        if (!fixed && pmc >= pmu->nr_arch_gp_counters)
                return 1;
        if (fixed && pmc >= pmu->nr_arch_fixed_counters)