提交 1be3aa47 编写于 作者: L Laurent Vivier 提交者: Avi Kivity

KVM: emulate_instruction() calls now x86_decode_insn() and x86_emulate_insn()

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: NLaurent Vivier <Laurent.Vivier@bull.net>
Signed-off-by: NAvi Kivity <avi@qumranet.com>
上级 8b4caf66
...@@ -1287,7 +1287,10 @@ int emulate_instruction(struct kvm_vcpu *vcpu, ...@@ -1287,7 +1287,10 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
vcpu->mmio_is_write = 0; vcpu->mmio_is_write = 0;
vcpu->pio.string = 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) if (vcpu->pio.string)
return EMULATE_DO_MMIO; return EMULATE_DO_MMIO;
......
...@@ -908,18 +908,14 @@ x86_decode_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops) ...@@ -908,18 +908,14 @@ x86_decode_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
} }
int 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; unsigned long cr2 = ctxt->cr2;
int no_wb = 0; int no_wb = 0;
u64 msr_data; u64 msr_data;
unsigned long _eflags = ctxt->eflags; unsigned long _eflags = ctxt->eflags;
struct decode_cache *c = &ctxt->decode; struct decode_cache *c = &ctxt->decode;
int rc; int rc = 0;
rc = x86_decode_insn(ctxt, ops);
if (rc)
return rc;
if ((c->d & ModRM) && (c->modrm_mod != 3)) if ((c->d & ModRM) && (c->modrm_mod != 3))
cr2 = c->modrm_ea; cr2 = c->modrm_ea;
......
...@@ -178,12 +178,9 @@ struct x86_emulate_ctxt { ...@@ -178,12 +178,9 @@ struct x86_emulate_ctxt {
#define X86EMUL_MODE_HOST X86EMUL_MODE_PROT64 #define X86EMUL_MODE_HOST X86EMUL_MODE_PROT64
#endif #endif
/* int x86_decode_insn(struct x86_emulate_ctxt *ctxt,
* x86_emulate_memop: Emulate an instruction that faulted attempting to struct x86_emulate_ops *ops);
* read/write a 'special' memory area. int x86_emulate_insn(struct x86_emulate_ctxt *ctxt,
* Returns -1 on failure, 0 on success. struct x86_emulate_ops *ops);
*/
int x86_emulate_memop(struct x86_emulate_ctxt *ctxt,
struct x86_emulate_ops *ops);
#endif /* __X86_EMULATE_H__ */ #endif /* __X86_EMULATE_H__ */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册