From patchwork Fri Dec 7 01:25:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liguang X-Patchwork-Id: 204369 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1BB922C00BA for ; Fri, 7 Dec 2012 12:28:33 +1100 (EST) Received: from localhost ([::1]:35796 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tgmjv-0005nJ-3y for incoming@patchwork.ozlabs.org; Thu, 06 Dec 2012 20:28:31 -0500 Received: from eggs.gnu.org ([208.118.235.92]:34431) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tgmja-0005eI-CS for qemu-devel@nongnu.org; Thu, 06 Dec 2012 20:28:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TgmjY-0001NQ-7t for qemu-devel@nongnu.org; Thu, 06 Dec 2012 20:28:10 -0500 Received: from [222.73.24.84] (port=46524 helo=song.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TgmjX-0001Mv-U7 for qemu-devel@nongnu.org; Thu, 06 Dec 2012 20:28:08 -0500 X-IronPort-AV: E=Sophos;i="4.84,234,1355068800"; d="scan'208";a="6349160" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 07 Dec 2012 09:26:17 +0800 Received: from fnstmail02.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id qB71SXOl017372; Fri, 7 Dec 2012 09:28:33 +0800 Received: from liguang.fnst.cn.fujitsu.com ([10.167.225.128]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2012120709272544-284892 ; Fri, 7 Dec 2012 09:27:25 +0800 From: liguang To: afaerber@suse.de, ehabkost@redhat.com, imammedo@redhat.com, blauwirbel@gmail.com, jan.kiszka@siemens.com, qemu-devel@nongnu.org Date: Fri, 7 Dec 2012 09:25:34 +0800 Message-Id: <1354843535-10912-2-git-send-email-lig.fnst@cn.fujitsu.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1354843535-10912-1-git-send-email-lig.fnst@cn.fujitsu.com> References: <1354843535-10912-1-git-send-email-lig.fnst@cn.fujitsu.com> X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2012/12/07 09:27:25, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2012/12/07 09:27:25, Serialize complete at 2012/12/07 09:27:25 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 222.73.24.84 Cc: liguang Subject: [Qemu-devel] [PATCH v3 2/3] target-i386:make hw_breakpoint_enabled return bool type 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 Signed-off-by: liguang --- target-i386/cpu.h | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/target-i386/cpu.h b/target-i386/cpu.h index 29245d1..3646128 100644 --- a/target-i386/cpu.h +++ b/target-i386/cpu.h @@ -996,9 +996,20 @@ int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr, #define cpu_handle_mmu_fault cpu_x86_handle_mmu_fault void cpu_x86_set_a20(CPUX86State *env, int a20_state); -static inline int hw_breakpoint_enabled(unsigned long dr7, int index) +static inline bool hw_local_breakpoint_enabled(unsigned long dr7, int index) { - return (dr7 >> (index * 2)) & 3; + return !(((dr7 >> (index * 2)) ^ 1) & 3); +} + +static inline bool hw_global_breakpoint_enabled(unsigned long dr7, int index) +{ + return !!((dr7 >> (index * 2)) & 2); +} + +static inline bool hw_breakpoint_enabled(unsigned long dr7, int index) +{ + return (hw_global_breakpoint_enabled(dr7, index) || + hw_local_breakpoint_enabled(dr7, index)); } static inline int hw_breakpoint_type(unsigned long dr7, int index)