aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm
diff options
context:
space:
mode:
authorLaurent Vivier <Laurent.Vivier@bull.net>2007-09-18 05:27:27 -0400
committerAvi Kivity <avi@qumranet.com>2008-01-30 10:52:47 -0500
commit1be3aa47182e94944e57b176a5c4ee4e74f1ce33 (patch)
tree413c3e2c81aabd8fdcbfb21b994e600575a6949b /drivers/kvm
parent8b4caf6650808024c37ec4b29cf81b308af998b1 (diff)
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: Laurent Vivier <Laurent.Vivier@bull.net> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm')
-rw-r--r--drivers/kvm/kvm_main.c5
-rw-r--r--drivers/kvm/x86_emulate.c8
-rw-r--r--drivers/kvm/x86_emulate.h11
3 files changed, 10 insertions, 14 deletions
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index 1c662f63b7a9..800ab5028ed3 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -1287,7 +1287,10 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
1287 1287
1288 vcpu->mmio_is_write = 0; 1288 vcpu->mmio_is_write = 0;
1289 vcpu->pio.string = 0; 1289 vcpu->pio.string = 0;
1290 r = x86_emulate_memop(&emulate_ctxt, &emulate_ops); 1290 r = x86_decode_insn(&emulate_ctxt, &emulate_ops);
1291 if (r == 0)
1292 r = x86_emulate_insn(&emulate_ctxt, &emulate_ops);
1293
1291 if (vcpu->pio.string) 1294 if (vcpu->pio.string)
1292 return EMULATE_DO_MMIO; 1295 return EMULATE_DO_MMIO;
1293 1296
diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c
index 540589c5d427..c191093982d8 100644
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -908,18 +908,14 @@ done:
908} 908}
909 909
910int 910int
911x86_emulate_memop(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops) 911x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
912{ 912{
913 unsigned long cr2 = ctxt->cr2; 913 unsigned long cr2 = ctxt->cr2;
914 int no_wb = 0; 914 int no_wb = 0;
915 u64 msr_data; 915 u64 msr_data;
916 unsigned long _eflags = ctxt->eflags; 916 unsigned long _eflags = ctxt->eflags;
917 struct decode_cache *c = &ctxt->decode; 917 struct decode_cache *c = &ctxt->decode;
918 int rc; 918 int rc = 0;
919
920 rc = x86_decode_insn(ctxt, ops);
921 if (rc)
922 return rc;
923 919
924 if ((c->d & ModRM) && (c->modrm_mod != 3)) 920 if ((c->d & ModRM) && (c->modrm_mod != 3))
925 cr2 = c->modrm_ea; 921 cr2 = c->modrm_ea;
diff --git a/drivers/kvm/x86_emulate.h b/drivers/kvm/x86_emulate.h
index c354200d5834..28acad416bca 100644
--- a/drivers/kvm/x86_emulate.h
+++ b/drivers/kvm/x86_emulate.h
@@ -178,12 +178,9 @@ struct x86_emulate_ctxt {
178#define X86EMUL_MODE_HOST X86EMUL_MODE_PROT64 178#define X86EMUL_MODE_HOST X86EMUL_MODE_PROT64
179#endif 179#endif
180 180
181/* 181int x86_decode_insn(struct x86_emulate_ctxt *ctxt,
182 * x86_emulate_memop: Emulate an instruction that faulted attempting to 182 struct x86_emulate_ops *ops);
183 * read/write a 'special' memory area. 183int x86_emulate_insn(struct x86_emulate_ctxt *ctxt,
184 * Returns -1 on failure, 0 on success. 184 struct x86_emulate_ops *ops);
185 */
186int x86_emulate_memop(struct x86_emulate_ctxt *ctxt,
187 struct x86_emulate_ops *ops);
188 185
189#endif /* __X86_EMULATE_H__ */ 186#endif /* __X86_EMULATE_H__ */