From patchwork Mon Oct 19 17:40:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 532479 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 1C0841401AF for ; Tue, 20 Oct 2015 04:43:38 +1100 (AEDT) Received: from localhost ([::1]:41280 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZoET9-0001im-GD for incoming@patchwork.ozlabs.org; Mon, 19 Oct 2015 13:43:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40654) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZoEQF-0004ya-TN for qemu-devel@nongnu.org; Mon, 19 Oct 2015 13:40:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZoEQE-00055x-OD for qemu-devel@nongnu.org; Mon, 19 Oct 2015 13:40:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42554) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZoEQE-00055r-JH for qemu-devel@nongnu.org; Mon, 19 Oct 2015 13:40:34 -0400 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 (Postfix) with ESMTPS id 2D23C32C436; Mon, 19 Oct 2015 17:40:34 +0000 (UTC) Received: from localhost (ovpn-113-177.phx2.redhat.com [10.3.113.177]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t9JHeWDp003379; Mon, 19 Oct 2015 13:40:33 -0400 From: Eduardo Habkost To: qemu-devel@nongnu.org, Paolo Bonzini , Richard Henderson Date: Mon, 19 Oct 2015 15:40:06 -0200 Message-Id: <1445276410-5031-6-git-send-email-ehabkost@redhat.com> In-Reply-To: <1445276410-5031-1-git-send-email-ehabkost@redhat.com> References: <1445276410-5031-1-git-send-email-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 5/9] target-i386: Optimize setting dr[0-3] X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Richard Henderson If the debug register is not enabled, we need do nothing besides update the register. Signed-off-by: Richard Henderson Signed-off-by: Eduardo Habkost --- target-i386/bpt_helper.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/target-i386/bpt_helper.c b/target-i386/bpt_helper.c index ca58ab7..7ff41a6 100644 --- a/target-i386/bpt_helper.c +++ b/target-i386/bpt_helper.c @@ -228,9 +228,14 @@ void helper_movl_drN_T0(CPUX86State *env, int reg, target_ulong t0) { #ifndef CONFIG_USER_ONLY if (reg < 4) { - hw_breakpoint_remove(env, reg); - env->dr[reg] = t0; - hw_breakpoint_insert(env, reg); + if (hw_breakpoint_enabled(env->dr[7], reg) + && hw_breakpoint_type(env->dr[7], reg) != DR7_TYPE_IO_RW) { + hw_breakpoint_remove(env, reg); + env->dr[reg] = t0; + hw_breakpoint_insert(env, reg); + } else { + env->dr[reg] = t0; + } } else if (reg == 7) { cpu_x86_update_dr7(env, t0); } else {