summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/x86.c
diff options
context:
space:
mode:
authorAndre Przywara2010-12-21 11:12:07 +0100
committerAvi Kivity2011-01-12 10:31:07 +0100
commitdc25e89e07d5ef31c476117d2c76b34dbb22196c (patch)
tree9fef452c4bd0704b9d74512a9a58dc5d5b742d53 /arch/x86/kvm/x86.c
parentKVM: SVM: implement enhanced INVLPG intercept (diff)
downloadkernel-qcow2-linux-dc25e89e07d5ef31c476117d2c76b34dbb22196c.tar.gz
kernel-qcow2-linux-dc25e89e07d5ef31c476117d2c76b34dbb22196c.tar.xz
kernel-qcow2-linux-dc25e89e07d5ef31c476117d2c76b34dbb22196c.zip
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)
int x86_emulate_instruction(struct kvm_vcpu *vcpu,
unsigned long cr2,
- int emulation_type)
+ int emulation_type,
+ void *insn,
+ int insn_len)
{
int r;
struct decode_cache *c = &vcpu->arch.emulate_ctxt.decode;
@@ -4386,7 +4388,7 @@ int x86_emulate_instruction(struct kvm_vcpu *vcpu,
vcpu->arch.emulate_ctxt.have_exception = false;
vcpu->arch.emulate_ctxt.perm_ok = false;
- r = x86_decode_insn(&vcpu->arch.emulate_ctxt);
+ r = x86_decode_insn(&vcpu->arch.emulate_ctxt, insn, insn_len);
if (r == X86EMUL_PROPAGATE_FAULT)
goto done;