aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/x86.c
diff options
context:
space:
mode:
authorAndre Przywara <andre.przywara@amd.com>2010-12-21 05:12:07 -0500
committerAvi Kivity <avi@redhat.com>2011-01-12 04:31:07 -0500
commitdc25e89e07d5ef31c476117d2c76b34dbb22196c (patch)
tree9fef452c4bd0704b9d74512a9a58dc5d5b742d53 /arch/x86/kvm/x86.c
parentdf4f3108562dc6f6ae6648f2698df7f4c9acf52d (diff)
KVM: SVM: copy instruction bytes from VMCB
In case of a nested page fault or an intercepted #PF newer SVM implementations provide a copy of the faulting instruction bytes in the VMCB. Use these bytes to feed the instruction emulator and avoid the costly guest instruction fetch in this case. Signed-off-by: Andre Przywara <andre.przywara@amd.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r--arch/x86/kvm/x86.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index a6fcb76196b7..7ad9cda8ff36 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4365,7 +4365,9 @@ static bool reexecute_instruction(struct kvm_vcpu *vcpu, gva_t gva)
4365 4365
4366int x86_emulate_instruction(struct kvm_vcpu *vcpu, 4366int x86_emulate_instruction(struct kvm_vcpu *vcpu,
4367 unsigned long cr2, 4367 unsigned long cr2,
4368 int emulation_type) 4368 int emulation_type,
4369 void *insn,
4370 int insn_len)
4369{ 4371{
4370 int r; 4372 int r;
4371 struct decode_cache *c = &vcpu->arch.emulate_ctxt.decode; 4373 struct decode_cache *c = &vcpu->arch.emulate_ctxt.decode;
@@ -4386,7 +4388,7 @@ int x86_emulate_instruction(struct kvm_vcpu *vcpu,
4386 vcpu->arch.emulate_ctxt.have_exception = false; 4388 vcpu->arch.emulate_ctxt.have_exception = false;
4387 vcpu->arch.emulate_ctxt.perm_ok = false; 4389 vcpu->arch.emulate_ctxt.perm_ok = false;
4388 4390
4389 r = x86_decode_insn(&vcpu->arch.emulate_ctxt); 4391 r = x86_decode_insn(&vcpu->arch.emulate_ctxt, insn, insn_len);
4390 if (r == X86EMUL_PROPAGATE_FAULT) 4392 if (r == X86EMUL_PROPAGATE_FAULT)
4391 goto done; 4393 goto done;
4392 4394