From nobody Tue Feb 10 20:14:18 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1508247909652968.9334073657795; Tue, 17 Oct 2017 06:45:09 -0700 (PDT) Received: from localhost ([::1]:39481 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4SB0-0007QE-H3 for importer@patchew.org; Tue, 17 Oct 2017 09:44:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34701) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4RfD-0005DT-LE for qemu-devel@nongnu.org; Tue, 17 Oct 2017 09:12:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e4Rf7-0006pc-Tj for qemu-devel@nongnu.org; Tue, 17 Oct 2017 09:12:07 -0400 Received: from mail.ispras.ru ([83.149.199.45]:57242) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4Rf7-0006nz-Lp for qemu-devel@nongnu.org; Tue, 17 Oct 2017 09:12:01 -0400 Received: from Misha-PC.lan02.inno (unknown [85.142.117.226]) by mail.ispras.ru (Postfix) with ESMTPSA id 66D8754006B; Tue, 17 Oct 2017 16:12:00 +0300 (MSK) From: Mihail Abakumov To: qemu-devel@nongnu.org Date: Tue, 17 Oct 2017 16:11:57 +0300 Message-ID: <150824591748.6816.16828342704579456200.stgit@Misha-PC.lan02.inno> In-Reply-To: <150824572545.6816.5099701189660002212.stgit@Misha-PC.lan02.inno> References: <150824572545.6816.5099701189660002212.stgit@Misha-PC.lan02.inno> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 83.149.199.45 Subject: [Qemu-devel] [PATCH v2 33/43] windbg: implemented windbg_hw_breakpoint_insert and windbg_hw_breakpoint_remove X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sw@weilnetz.de, lprosek@redhat.com, dovgaluk@ispras.ru, rkagan@virtuozzo.com, pbonzini@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Signed-off-by: Mihail Abakumov Signed-off-by: Pavel Dovgalyuk Signed-off-by: Dmitriy Koltunov --- target/i386/windbgstub.c | 56 ++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 56 insertions(+) diff --git a/target/i386/windbgstub.c b/target/i386/windbgstub.c index 570e68a735..f9336b607f 100755 --- a/target/i386/windbgstub.c +++ b/target/i386/windbgstub.c @@ -288,11 +288,67 @@ typedef struct _CPU_KPROCESSOR_STATE { =20 static int windbg_hw_breakpoint_insert(CPUState *cpu, int index) { + CPUArchState *env =3D cpu->env_ptr; + + target_ulong addr =3D env->dr[index]; + int type =3D BP_TYPE(env->dr[7], index); + int len =3D BP_LEN(env->dr[7], index); + int err =3D 0; + + switch (type) { + case DR7_TYPE_DATA_WR: + err =3D cpu_watchpoint_insert(cpu, addr, len, BP_MEM_WRITE | BP_GD= B, + &env->cpu_watchpoint[index]); + break; + case DR7_TYPE_DATA_RW: + err =3D cpu_watchpoint_insert(cpu, addr, len, BP_MEM_ACCESS | BP_G= DB, + &env->cpu_watchpoint[index]); + break; + case DR7_TYPE_BP_INST: + err =3D cpu_breakpoint_insert(cpu, addr, BP_GDB, + &env->cpu_breakpoint[index]); + break; + case DR7_TYPE_IO_RW: + return HF_IOBPT_MASK; + default: + return 0; + } + + if (!err) { + WINDBG_DEBUG("hw_breakpoint_insert: index(%d), " FMT_ADDR, + index, addr); + } else { + env->cpu_breakpoint[index] =3D NULL; + WINDBG_ERROR("hw_breakpoint_insert: index(%d), " FMT_ADDR ", " FMT= _ERR, + index, addr, err); + } return 0; } =20 static int windbg_hw_breakpoint_remove(CPUState *cpu, int index) { + CPUArchState *env =3D cpu->env_ptr; + int type =3D BP_TYPE(env->dr[7], index); + + switch (type) { + case DR7_TYPE_BP_INST: + if (env->cpu_breakpoint[index]) { + cpu_breakpoint_remove_by_ref(cpu, env->cpu_breakpoint[index]); + } + break; + case DR7_TYPE_DATA_WR: + case DR7_TYPE_DATA_RW: + if (env->cpu_watchpoint[index]) { + cpu_watchpoint_remove_by_ref(cpu, env->cpu_watchpoint[index]); + } + break; + default: + return 0; + } + + env->cpu_breakpoint[index] =3D NULL; + WINDBG_DEBUG("hw_breakpoint_remove: index(%d), " FMT_ADDR, + index, env->dr[index]); return 0; } =20