From nobody Tue Feb 10 20:14:19 2026 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) 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=temperror (zoho.com: Error in retrieving data from DNS) 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 1508246897874351.7091866012562; Tue, 17 Oct 2017 06:28:17 -0700 (PDT) Received: from localhost ([::1]:39254 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4RuX-0001Rj-4B for importer@patchew.org; Tue, 17 Oct 2017 09:27:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33534) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4Rdf-0003oT-U7 for qemu-devel@nongnu.org; Tue, 17 Oct 2017 09:10:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e4RdZ-0005SA-3Q for qemu-devel@nongnu.org; Tue, 17 Oct 2017 09:10:31 -0400 Received: from mail.ispras.ru ([83.149.199.45]:56790) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4RdY-0005R9-0y for qemu-devel@nongnu.org; Tue, 17 Oct 2017 09:10:24 -0400 Received: from Misha-PC.lan02.inno (unknown [85.142.117.226]) by mail.ispras.ru (Postfix) with ESMTPSA id 4B8B954006B; Tue, 17 Oct 2017 16:10:23 +0300 (MSK) From: Mihail Abakumov To: qemu-devel@nongnu.org Date: Tue, 17 Oct 2017 16:10:20 +0300 Message-ID: <150824582072.6816.7754220722530913728.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 16/43] windbg: generate ExceptionStateChange 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_6 Z_629925259 SPT_0 Added function for generate ExceptionStateChange packet. Signed-off-by: Mihail Abakumov Signed-off-by: Pavel Dovgalyuk Signed-off-by: Dmitriy Koltunov --- include/exec/windbgstub-utils.h | 2 ++ target/i386/windbgstub.c | 20 +++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/include/exec/windbgstub-utils.h b/include/exec/windbgstub-util= s.h index f0da3cbd86..fea04cbc89 100755 --- a/include/exec/windbgstub-utils.h +++ b/include/exec/windbgstub-utils.h @@ -93,6 +93,8 @@ typedef struct SizedBuf { InitedAddr *windbg_get_KPCR(void); InitedAddr *windbg_get_version(void); =20 +SizedBuf kd_gen_exception_sc(CPUState *cpu); + bool windbg_on_load(void); =20 #endif diff --git a/target/i386/windbgstub.c b/target/i386/windbgstub.c index da0aeb4f1b..334642b677 100755 --- a/target/i386/windbgstub.c +++ b/target/i386/windbgstub.c @@ -68,7 +68,6 @@ bool windbg_on_load(void) return true; } =20 -__attribute__ ((unused)) /* unused yet */ static void kd_init_state_change(CPUState *cpu, DBGKD_ANY_WAIT_STATE_CHANGE *sc) { @@ -112,3 +111,22 @@ static void kd_init_state_change(CPUState *cpu, stw_p(&cr->InstructionCount, DBGKD_MAXSTREAM); } } + +SizedBuf kd_gen_exception_sc(CPUState *cpu) +{ + CPUArchState *env =3D cpu->env_ptr; + DBGKD_ANY_WAIT_STATE_CHANGE *sc; + DBGKM_EXCEPTION_RECORD64 *exc; + SizedBuf buf; + + SBUF_MALLOC(buf, sizeof(DBGKD_ANY_WAIT_STATE_CHANGE) + sizeof(int)); + sc =3D (DBGKD_ANY_WAIT_STATE_CHANGE *) buf.data; + exc =3D &sc->u.Exception.ExceptionRecord; + kd_init_state_change(cpu, sc); + + stl_p(&sc->NewState, DbgKdExceptionStateChange); + stl_p(&exc->ExceptionCode, 0x80000003); + sttul_p(&exc->ExceptionAddress, env->eip); + + return buf; +}