From patchwork Thu Jan 6 17:56:17 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 77759 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 26468B7088 for ; Fri, 7 Jan 2011 05:16:02 +1100 (EST) Received: from localhost ([127.0.0.1]:39521 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PauNS-0002B8-Tw for incoming@patchwork.ozlabs.org; Thu, 06 Jan 2011 13:15:59 -0500 Received: from [140.186.70.92] (port=32802 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PauBD-0003td-CV for qemu-devel@nongnu.org; Thu, 06 Jan 2011 13:03:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PauBA-0006aV-Co for qemu-devel@nongnu.org; Thu, 06 Jan 2011 13:03:19 -0500 Received: from mx1.redhat.com ([209.132.183.28]:32142) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PauBA-0006a0-12 for qemu-devel@nongnu.org; Thu, 06 Jan 2011 13:03:16 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p06I3F9N024959 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 6 Jan 2011 13:03:15 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p06I3E18018007; Thu, 6 Jan 2011 13:03:14 -0500 Received: from amt.cnet (vpn1-4-164.ams2.redhat.com [10.36.4.164]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p06I3CRN019113; Thu, 6 Jan 2011 13:03:13 -0500 Received: from amt.cnet (localhost.localdomain [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 27DE568A22F; Thu, 6 Jan 2011 15:58:03 -0200 (BRST) Received: (from marcelo@localhost) by amt.cnet (8.14.4/8.14.4/Submit) id p06Hvxp9011358; Thu, 6 Jan 2011 15:57:59 -0200 From: Marcelo Tosatti To: Anthony Liguori Date: Thu, 6 Jan 2011 15:56:17 -0200 Message-Id: <8c5468319bca02b1c4ab1a65a1ac3f5e800413b5.1294336601.git.mtosatti@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Jan Kiszka , qemu-devel@nongnu.org, kvm@vger.kernel.org, Avi Kivity Subject: [Qemu-devel] [PATCH 11/35] kvm: x86: Prevent sign extension of DR7 in guest debugging mode X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- 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 7e5982b..85edacc 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -1686,7 +1686,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)); } } /* Legal xcr0 for loading */