From ce79ae86090bdf7f0a54f98230fd477a8d7d8c04 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 18 Jan 2012 10:38:07 +0100 Subject: [PATCH 13/52] kvm: x86: Prevent sign extension of DR7 in guest debugging mode RH-Author: Markus Armbruster Message-id: <1326883126-22053-14-git-send-email-armbru@redhat.com> Patchwork-id: 36580 O-Subject: [RHEL-6.3 PATCH qemu-kvm 13/52] kvm: x86: Prevent sign extension of DR7 in guest debugging mode Bugzilla: 758194 RH-Acked-by: Miroslav Rezanina RH-Acked-by: Laszlo Ersek RH-Acked-by: Amit Shah From: Jan Kiszka This unbreaks guest debugging when the 4th hardware breakpoint used for guest debugging is a watchpoint of 4 or 8 byte lenght. The 31st bit of DR7 is set in that case and used to cause a sign extension to the high word which was breaking the guest state (vm entry failure). Signed-off-by: Jan Kiszka Signed-off-by: Avi Kivity (cherry picked from commit 95c077c91900c1420cd4f0be996ffeea6fb6cec8) Signed-off-by: Markus Armbruster --- target-i386/kvm.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) Signed-off-by: Michal Novotny --- target-i386/kvm.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/target-i386/kvm.c b/target-i386/kvm.c index ee14949..a4ef91f 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -1115,7 +1115,7 @@ void kvm_arch_update_guest_debug(CPUState *env, struct kvm_guest_debug *dbg) dbg->arch.debugreg[n] = hw_breakpoint[n].addr; dbg->arch.debugreg[7] |= (2 << (n * 2)) | (type_code[hw_breakpoint[n].type] << (16 + n*4)) | - (len_code[hw_breakpoint[n].len] << (18 + n*4)); + ((uint32_t)len_code[hw_breakpoint[n].len] << (18 + n*4)); } } } -- 1.7.7.5