]> err.no Git - linux-2.6/blobdiff - arch/x86/kvm/x86.c
KVM: x86 emulator: simplify rip relative decoding
[linux-2.6] / arch / x86 / kvm / x86.c
index d731d4fff1ae0f19f2ef59f86ceb7b6b45a78002..d1db5aa5c7f42dfd38d4426ee36c7a92c946fdc1 100644 (file)
@@ -2076,21 +2076,19 @@ int emulator_set_dr(struct x86_emulate_ctxt *ctxt, int dr, unsigned long value)
 
 void kvm_report_emulation_failure(struct kvm_vcpu *vcpu, const char *context)
 {
-       static int reported;
        u8 opcodes[4];
        unsigned long rip = vcpu->arch.rip;
        unsigned long rip_linear;
 
-       rip_linear = rip + get_segment_base(vcpu, VCPU_SREG_CS);
-
-       if (reported)
+       if (!printk_ratelimit())
                return;
 
+       rip_linear = rip + get_segment_base(vcpu, VCPU_SREG_CS);
+
        emulator_read_std(rip_linear, (void *)opcodes, 4, vcpu);
 
        printk(KERN_ERR "emulation failed (%s) rip %lx %02x %02x %02x %02x\n",
               context, rip, opcodes[0], opcodes[1], opcodes[2], opcodes[3]);
-       reported = 1;
 }
 EXPORT_SYMBOL_GPL(kvm_report_emulation_failure);