From nobody Tue Feb 10 20:31:09 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 150642557103694.93666659322014; Tue, 26 Sep 2017 04:32:51 -0700 (PDT) Received: from localhost ([::1]:46828 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwo6Z-0002l4-F3 for importer@patchew.org; Tue, 26 Sep 2017 07:32:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59940) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwnhf-0005MK-No for qemu-devel@nongnu.org; Tue, 26 Sep 2017 07:07:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dwnhe-0001TS-Ot for qemu-devel@nongnu.org; Tue, 26 Sep 2017 07:07:03 -0400 Received: from mail.ispras.ru ([83.149.199.45]:52252) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwnhe-0001TA-H2 for qemu-devel@nongnu.org; Tue, 26 Sep 2017 07:07:02 -0400 Received: from Misha-PC.lan02.inno (unknown [85.142.117.226]) by mail.ispras.ru (Postfix) with ESMTPSA id C73BB5400EB; Tue, 26 Sep 2017 14:07:01 +0300 (MSK) From: Mihail Abakumov To: qemu-devel@nongnu.org Date: Tue, 26 Sep 2017 14:07:00 +0300 Message-ID: <150642402028.3900.4958813484847164692.stgit@Misha-PC.lan02.inno> In-Reply-To: <150642384156.3900.3326424823772221077.stgit@Misha-PC.lan02.inno> References: <150642384156.3900.3326424823772221077.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 31/43] windbg: implemented windbg_set_dr 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 Defined useful macroses for breakpoints. Signed-off-by: Mihail Abakumov Signed-off-by: Pavel Dovgalyuk Signed-off-by: Dmitriy Koltunov --- windbgstub-utils.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++= +- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/windbgstub-utils.c b/windbgstub-utils.c index 238db03714..58c4c98f04 100755 --- a/windbgstub-utils.c +++ b/windbgstub-utils.c @@ -11,6 +11,21 @@ =20 #include "exec/windbgstub-utils.h" =20 +#define IS_LOCAL_BP_ENABLED(dr7, index) (((dr7) >> ((index) * 2)) & 1) + +#define IS_GLOBAL_BP_ENABLED(dr7, index) (((dr7) >> ((index) * 2)) & 2) + +#define IS_BP_ENABLED(dr7, index) \ + (IS_LOCAL_BP_ENABLED(dr7, index) | IS_GLOBAL_BP_ENABLED(dr7, index)) + +#define BP_TYPE(dr7, index) \ + ((int) ((dr7) >> (DR7_TYPE_SHIFT + ((index) * 4))) & 3) + +#define BP_LEN(dr7, index) ({ \ + int _len =3D (((dr7) >> (DR7_LEN_SHIFT + ((index) * 4))) & 3); \ + (_len =3D=3D 2) ? 8 : _len + 1; \ +}) + #ifdef TARGET_X86_64 # define OFFSET_SELF_PCR 0x18 # define OFFSET_VERS 0x108 @@ -277,9 +292,42 @@ typedef struct KDData { =20 static KDData *kd; =20 -static void windbg_set_dr(CPUState *cpu, int index, target_ulong value) +static int windbg_hw_breakpoint_insert(CPUState *cpu, int index) +{ + return 0; +} + +static int windbg_hw_breakpoint_remove(CPUState *cpu, int index) +{ + return 0; +} + +static void windbg_set_dr7(CPUState *cpu, target_ulong new_dr7) {} =20 +static void windbg_set_dr(CPUState *cpu, int index, target_ulong value) +{ + CPUArchState *env =3D cpu->env_ptr; + + switch (index) { + case 0 ... 3: + if (IS_BP_ENABLED(env->dr[7], index) && env->dr[index] !=3D value)= { + windbg_hw_breakpoint_remove(cpu, index); + env->dr[index] =3D value; + windbg_hw_breakpoint_insert(cpu, index); + } else { + env->dr[index] =3D value; + } + return; + case 6: + env->dr[6] =3D value | DR6_FIXED_1; + return; + case 7: + windbg_set_dr7(cpu, value); + return; + } +} + static void windbg_set_sr(CPUState *cpu, int sr, uint16_t selector) { CPUArchState *env =3D cpu->env_ptr;