]> nv-tegra.nvidia Code Review - linux-2.6.git/commitdiff
KVM: emulate_instruction() calls now x86_decode_insn() and x86_emulate_insn()
authorLaurent Vivier <Laurent.Vivier@bull.net>
Tue, 18 Sep 2007 09:27:27 +0000 (11:27 +0200)
committerAvi Kivity <avi@qumranet.com>
Wed, 30 Jan 2008 15:52:47 +0000 (17:52 +0200)
emulate_instruction() calls now x86_decode_insn() and x86_emulate_insn().
x86_emulate_insn() is x86_emulate_memop() without the decoding part.

Signed-off-by: Laurent Vivier <Laurent.Vivier@bull.net>
Signed-off-by: Avi Kivity <avi@qumranet.com>
drivers/kvm/kvm_main.c
drivers/kvm/x86_emulate.c
drivers/kvm/x86_emulate.h

index 1c662f63b7a9cf50f7a6a51e1929643c474bc3a4..800ab5028ed321455be54cc59a3d391d0cf4eba4 100644 (file)
@@ -1287,7 +1287,10 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
 
        vcpu->mmio_is_write = 0;
        vcpu->pio.string = 0;
-       r = x86_emulate_memop(&emulate_ctxt, &emulate_ops);
+       r = x86_decode_insn(&emulate_ctxt, &emulate_ops);
+       if (r == 0)
+               r = x86_emulate_insn(&emulate_ctxt, &emulate_ops);
+
        if (vcpu->pio.string)
                return EMULATE_DO_MMIO;
 
index 540589c5d427cf05ba2246472868f22fa09de2d2..c191093982d8345f1f727024e3c545ab7bcfba0b 100644 (file)
@@ -908,18 +908,14 @@ done:
 }
 
 int
-x86_emulate_memop(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
+x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
 {
        unsigned long cr2 = ctxt->cr2;
        int no_wb = 0;
        u64 msr_data;
        unsigned long _eflags = ctxt->eflags;
        struct decode_cache *c = &ctxt->decode;
-       int rc;
-
-       rc = x86_decode_insn(ctxt, ops);
-       if (rc)
-               return rc;
+       int rc = 0;
 
        if ((c->d & ModRM) && (c->modrm_mod != 3))
                cr2 = c->modrm_ea;
index c354200d5834c94ff6207ce63b2c14f3b7f7b656..28acad416bcad0b4cfbb001f67a444b959bcfa4f 100644 (file)
@@ -178,12 +178,9 @@ struct x86_emulate_ctxt {
 #define X86EMUL_MODE_HOST X86EMUL_MODE_PROT64
 #endif
 
-/*
- * x86_emulate_memop: Emulate an instruction that faulted attempting to
- *                    read/write a 'special' memory area.
- * Returns -1 on failure, 0 on success.
- */
-int x86_emulate_memop(struct x86_emulate_ctxt *ctxt,
-                     struct x86_emulate_ops *ops);
+int x86_decode_insn(struct x86_emulate_ctxt *ctxt,
+                   struct x86_emulate_ops *ops);
+int x86_emulate_insn(struct x86_emulate_ctxt *ctxt,
+                    struct x86_emulate_ops *ops);
 
 #endif                         /* __X86_EMULATE_H__ */