]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
KVM: x86 emulator: Add new mode of instruction emulation: skip
authorGleb Natapov <gleb@redhat.com>
Sun, 12 Apr 2009 10:36:57 +0000 (13:36 +0300)
committerAvi Kivity <avi@redhat.com>
Wed, 10 Jun 2009 08:48:42 +0000 (11:48 +0300)
In the new mode instruction is decoded, but not executed. The EIP
is moved to point after the instruction.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/x86.c

index 0e3a7c6e522c2f633fa62e8a511c2d7f4e0a461d..cb306cff2b49a1d10dbb19e9998e2bc282fc2e5f 100644 (file)
@@ -562,6 +562,7 @@ enum emulation_result {
 
 #define EMULTYPE_NO_DECODE         (1 << 0)
 #define EMULTYPE_TRAP_UD           (1 << 1)
+#define EMULTYPE_SKIP              (1 << 2)
 int emulate_instruction(struct kvm_vcpu *vcpu, struct kvm_run *run,
                        unsigned long cr2, u16 error_code, int emulation_type);
 void kvm_report_emulation_failure(struct kvm_vcpu *cvpu, const char *context);
index b5ac1b72245469e45ce7b6ad37579fce25e2e9e3..8beccaa17690a185938be07c6c6e65c9acb186dc 100644 (file)
@@ -2413,6 +2413,11 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
                }
        }
 
+       if (emulation_type & EMULTYPE_SKIP) {
+               kvm_rip_write(vcpu, vcpu->arch.emulate_ctxt.decode.eip);
+               return EMULATE_DONE;
+       }
+
        r = x86_emulate_insn(&vcpu->arch.emulate_ctxt, &emulate_ops);
 
        if (vcpu->arch.pio.string)