aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/hvm/emulate.c
diff options
context:
space:
mode:
authorKeir Fraser <keir@xen.org>2011-04-18 13:36:10 +0100
committerKeir Fraser <keir@xen.org>2011-04-18 13:36:10 +0100
commitdeb245252e80db10906d42dd831d1927ded9c294 (patch)
treecbd4612bb15275b855f367222aad04519c9a2faa /xen/arch/x86/hvm/emulate.c
parent88f1c41bd86e47a2b18e5cfda4df305287ae30e9 (diff)
downloadxen-deb245252e80db10906d42dd831d1927ded9c294.tar.gz
xen-deb245252e80db10906d42dd831d1927ded9c294.tar.bz2
xen-deb245252e80db10906d42dd831d1927ded9c294.zip
svm: implement instruction fetch part of DecodeAssist (on #PF/#NPF)
Newer SVM implementations (Bulldozer) copy up to 15 bytes from the instruction stream into the VMCB when a #PF or #NPF exception is intercepted. This patch makes use of this information if available. This saves us from a) traversing the guest's page tables, b) mapping the guest's memory and c) copy the instructions from there into the hypervisor's address space. This speeds up #NPF intercepts quite a lot and avoids cache and TLB trashing. Signed-off-by: Andre Przywara <andre.przywara@amd.com> Signed-off-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/arch/x86/hvm/emulate.c')
-rw-r--r--xen/arch/x86/hvm/emulate.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index af903c9b72..1230de6031 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -996,6 +996,8 @@ int hvm_emulate_one(
hvmemul_ctxt->insn_buf_eip = regs->eip;
hvmemul_ctxt->insn_buf_bytes =
+ hvm_get_insn_bytes(curr, hvmemul_ctxt->insn_buf)
+ ? :
(hvm_virtual_to_linear_addr(
x86_seg_cs, &hvmemul_ctxt->seg_reg[x86_seg_cs],
regs->eip, sizeof(hvmemul_ctxt->insn_buf),