[PATCH 2/2 V3] KVM: x86: Emulator should set DR6 upon GD like real CPU
Tim Gardner
tim.gardner at canonical.com
Tue Feb 14 13:50:50 UTC 2017
From: Nadav Amit <namit at cs.technion.ac.il>
BugLink: http://bugs.launchpad.net/bugs/1660519
It should clear B0-B3 and set BD.
Signed-off-by: Nadav Amit <namit at cs.technion.ac.il>
Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
(back ported from commit 6d2a0526b09e551d0f395cfb63e7cb965db825af)
Signed-off-by: Tim Gardner <tim.gardner at canonical.com>
---
v2 - fixed commit log to indicate clean cherry-pick
v3 - dropped the use of DR6_RTM which had only one
use and no definition.
arch/x86/kvm/emulate.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index f8eea19..23717df 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -3533,8 +3533,15 @@ static int check_dr_read(struct x86_emulate_ctxt *ctxt)
if ((cr4 & X86_CR4_DE) && (dr == 4 || dr == 5))
return emulate_ud(ctxt);
- if (check_dr7_gd(ctxt))
+ if (check_dr7_gd(ctxt)) {
+ ulong dr6;
+
+ ctxt->ops->get_dr(ctxt, 6, &dr6);
+ dr6 &= ~15;
+ dr6 |= DR6_BD;
+ ctxt->ops->set_dr(ctxt, 6, dr6);
return emulate_db(ctxt);
+ }
return X86EMUL_CONTINUE;
}
--
2.7.4
More information about the kernel-team
mailing list