From nobody Tue Feb 10 20:14:34 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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1511275023630737.7078321805315; Tue, 21 Nov 2017 06:37:03 -0800 (PST) Received: from localhost ([::1]:34786 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eH9fM-0008F3-To for importer@patchew.org; Tue, 21 Nov 2017 09:36:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40247) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eH9Fv-0002N4-F8 for qemu-devel@nongnu.org; Tue, 21 Nov 2017 09:10:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eH9Fp-0003Dz-1W for qemu-devel@nongnu.org; Tue, 21 Nov 2017 09:10:30 -0500 Received: from mail.ispras.ru ([83.149.199.45]:38478) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eH9Fo-0003Ds-PO for qemu-devel@nongnu.org; Tue, 21 Nov 2017 09:10:24 -0500 Received: from Misha-PC.lan02.inno (unknown [85.142.117.226]) by mail.ispras.ru (Postfix) with ESMTPSA id 183BB54006E; Tue, 21 Nov 2017 17:10:24 +0300 (MSK) From: Mihail Abakumov To: qemu-devel@nongnu.org Date: Tue, 21 Nov 2017 17:10:22 +0300 Message-ID: <151127342187.6888.10071306547141532589.stgit@Misha-PC.lan02.inno> In-Reply-To: <151127322955.6888.16198535123422076171.stgit@Misha-PC.lan02.inno> References: <151127322955.6888.16198535123422076171.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 v3 33/45] 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 deb0e728e0..43e6d45df9 100755 --- a/target/i386/windbgstub.c +++ b/target/i386/windbgstub.c @@ -290,11 +290,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