aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/include/asm/debugreg.h5
-rw-r--r--arch/x86/kvm/x86.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/arch/x86/include/asm/debugreg.h b/arch/x86/include/asm/debugreg.h
index f1b673f08239..0f6e92af4227 100644
--- a/arch/x86/include/asm/debugreg.h
+++ b/arch/x86/include/asm/debugreg.h
@@ -89,6 +89,11 @@ static inline void hw_breakpoint_disable(void)
89 set_debugreg(0UL, 3); 89 set_debugreg(0UL, 3);
90} 90}
91 91
92static inline int hw_breakpoint_active(void)
93{
94 return __get_cpu_var(dr7) & DR_GLOBAL_ENABLE_MASK;
95}
96
92extern void aout_dump_debugregs(struct user *dump); 97extern void aout_dump_debugregs(struct user *dump);
93 98
94#ifdef CONFIG_KVM 99#ifdef CONFIG_KVM
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 22dee7aa7813..3817220cc86b 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -3651,7 +3651,7 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
3651 * care about the messed up debug address registers. But if 3651 * care about the messed up debug address registers. But if
3652 * we have some of them active, restore the old state. 3652 * we have some of them active, restore the old state.
3653 */ 3653 */
3654 if (__get_cpu_var(dr7) & DR_GLOBAL_ENABLE_MASK) 3654 if (hw_breakpoint_active())
3655 hw_breakpoint_restore(); 3655 hw_breakpoint_restore();
3656 3656
3657 set_bit(KVM_REQ_KICK, &vcpu->requests); 3657 set_bit(KVM_REQ_KICK, &vcpu->requests);