summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/vmx.c
diff options
context:
space:
mode:
authorNadav Amit2014-11-02 10:54:45 +0100
committerPaolo Bonzini2014-11-07 15:44:04 +0100
commit82b32774c2d00c0a12ab182c67e32e0b5e5e580a (patch)
tree4952f26cbee010060c1b447216cc60961b9edee5 /arch/x86/kvm/vmx.c
parentKVM: x86: Clear DR6[0:3] on #DB during handle_dr (diff)
downloadkernel-qcow2-linux-82b32774c2d00c0a12ab182c67e32e0b5e5e580a.tar.gz
kernel-qcow2-linux-82b32774c2d00c0a12ab182c67e32e0b5e5e580a.tar.xz
kernel-qcow2-linux-82b32774c2d00c0a12ab182c67e32e0b5e5e580a.zip
KVM: x86: Breakpoints do not consider CS.base
x86 debug registers hold a linear address. Therefore, breakpoints detection should consider CS.base, and check whether instruction linear address equals (CS.base + RIP). This patch introduces a function to evaluate RIP linear address and uses it for breakpoints detection. Signed-off-by: Nadav Amit <namit@cs.technion.ac.il> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r--arch/x86/kvm/vmx.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index ad5e0806e1e1..284f5c2fdf0b 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -5118,9 +5118,7 @@ static int handle_dr(struct kvm_vcpu *vcpu)
if (vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP) {
vcpu->run->debug.arch.dr6 = vcpu->arch.dr6;
vcpu->run->debug.arch.dr7 = dr7;
- vcpu->run->debug.arch.pc =
- vmcs_readl(GUEST_CS_BASE) +
- vmcs_readl(GUEST_RIP);
+ vcpu->run->debug.arch.pc = kvm_get_linear_rip(vcpu);
vcpu->run->debug.arch.exception = DB_VECTOR;
vcpu->run->exit_reason = KVM_EXIT_DEBUG;
return 0;