From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:50438) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TgAlG-00006u-Tk for qemu-devel@nongnu.org; Wed, 05 Dec 2012 03:55:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TgAlF-0006ML-Ry for qemu-devel@nongnu.org; Wed, 05 Dec 2012 03:55:22 -0500 Received: from david.siemens.de ([192.35.17.14]:16738) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TgAlF-0006MD-Il for qemu-devel@nongnu.org; Wed, 05 Dec 2012 03:55:21 -0500 Message-ID: <50BF0BF1.3020208@siemens.com> Date: Wed, 05 Dec 2012 09:55:13 +0100 From: Jan Kiszka MIME-Version: 1.0 References: <1354608695-3232-1-git-send-email-lig.fnst@cn.fujitsu.com> <1354608695-3232-3-git-send-email-lig.fnst@cn.fujitsu.com> <1354668990.4342.10.camel@liguang.fnst.cn.fujitsu.com> In-Reply-To: <1354668990.4342.10.camel@liguang.fnst.cn.fujitsu.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 3/3] target-i386:slightly refactor dr7 related function List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: li guang Cc: Blue Swirl , "imammedo@redhat.com" , "qemu-devel@nongnu.org" , "ehabkost@redhat.com" , "afaerber@suse.de" On 2012-12-05 01:56, li guang wrote: >>> @@ -1014,22 +1016,40 @@ void hw_breakpoint_remove(CPUX86State *env, int index) >>> int check_hw_breakpoints(CPUX86State *env, int force_dr6_update) >>> { >>> target_ulong dr6; >>> - int reg, type; >>> + int index; >>> int hit_enabled = 0; >>> + bool bp_match = false; >>> + bool wp_match = false; >>> >>> dr6 = env->dr[6] & ~0xf; >>> - for (reg = 0; reg < 4; reg++) { >>> - type = hw_breakpoint_type(env->dr[7], reg); >>> - if ((type == 0 && env->dr[reg] == env->eip) || >>> - ((type & 1) && env->cpu_watchpoint[reg] && >>> - (env->cpu_watchpoint[reg]->flags & BP_WATCHPOINT_HIT))) { >>> - dr6 |= 1 << reg; >>> - if (hw_breakpoint_enabled(env->dr[7], reg)) >>> + for (index = 0; index < DR7_MAX_BP; index++) { >>> + switch (hw_breakpoint_type(env->dr[7], index)) { >>> + case DR7_BP_INST: >>> + if (env->dr[index] == env->eip) { >>> + bp_match = true; >>> + } >>> + break; >>> + case DR7_DATA_WR: >>> + case DR7_DATA_RW: >>> + if (env->cpu_watchpoint[index] && >>> + env->cpu_watchpoint[index]->flags & BP_WATCHPOINT_HIT) { >>> + wp_match = true; >>> + } >> >> Also here. >> > > No, just fall through. I told you how to clearly mark such cases. Jan -- Siemens AG, Corporate Technology, CT RTC ITP SDP-DE Corporate Competence Center Embedded Linux