From nobody Tue Feb 10 18:54:37 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 1506424468789613.3066665812069; Tue, 26 Sep 2017 04:14:28 -0700 (PDT) Received: from localhost ([::1]:46739 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwnop-0003BW-TU for importer@patchew.org; Tue, 26 Sep 2017 07:14:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58966) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwnfd-0003Pr-4Z for qemu-devel@nongnu.org; Tue, 26 Sep 2017 07:05:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dwnfZ-0000Cm-O0 for qemu-devel@nongnu.org; Tue, 26 Sep 2017 07:04:57 -0400 Received: from mail.ispras.ru ([83.149.199.45]:51760) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwnfZ-0000CS-Ey for qemu-devel@nongnu.org; Tue, 26 Sep 2017 07:04:53 -0400 Received: from Misha-PC.lan02.inno (unknown [85.142.117.226]) by mail.ispras.ru (Postfix) with ESMTPSA id B534C540096; Tue, 26 Sep 2017 14:04:52 +0300 (MSK) From: Mihail Abakumov To: qemu-devel@nongnu.org Date: Tue, 26 Sep 2017 14:04:51 +0300 Message-ID: <150642389121.3900.12320775067244184010.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 08/43] windbg: hook to wrmsr operation 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 Inserted hook to wrmsr operation. Windows Kernel put address on KPCR struct= to fs/gs (x32/x64) register. Needs catch this moment and allow windbg serv= er handle packets. Signed-off-by: Mihail Abakumov Signed-off-by: Pavel Dovgalyuk Signed-off-by: Dmitriy Koltunov --- include/exec/windbgstub-utils.h | 3 +++ include/exec/windbgstub.h | 1 + target/i386/misc_helper.c | 3 +++ windbgstub-utils.c | 8 ++++++++ windbgstub.c | 8 ++++++++ 5 files changed, 23 insertions(+) diff --git a/include/exec/windbgstub-utils.h b/include/exec/windbgstub-util= s.h index 65f336e4bf..90fb766839 100755 --- a/include/exec/windbgstub-utils.h +++ b/include/exec/windbgstub-utils.h @@ -62,4 +62,7 @@ _t; \ }) =20 +bool windbg_on_load(void); +void windbg_on_exit(void); + #endif diff --git a/include/exec/windbgstub.h b/include/exec/windbgstub.h index 703fc26b8f..2dbf1b1f13 100755 --- a/include/exec/windbgstub.h +++ b/include/exec/windbgstub.h @@ -15,6 +15,7 @@ #define WINDBG "windbg" #define WINDBG_DEBUG_ON false =20 +void windbg_try_load(void); int windbg_server_start(const char *device); =20 #endif diff --git a/target/i386/misc_helper.c b/target/i386/misc_helper.c index 628f64aad5..ec1fcd2899 100644 --- a/target/i386/misc_helper.c +++ b/target/i386/misc_helper.c @@ -24,6 +24,7 @@ #include "exec/exec-all.h" #include "exec/cpu_ldst.h" #include "exec/address-spaces.h" +#include "exec/windbgstub.h" =20 void helper_outb(CPUX86State *env, uint32_t port, uint32_t data) { @@ -385,6 +386,8 @@ void helper_wrmsr(CPUX86State *env) /* XXX: exception? */ break; } + + windbg_try_load(); } =20 void helper_rdmsr(CPUX86State *env) diff --git a/windbgstub-utils.c b/windbgstub-utils.c index dc5e505c63..b5fb6db3f2 100755 --- a/windbgstub-utils.c +++ b/windbgstub-utils.c @@ -10,3 +10,11 @@ */ =20 #include "exec/windbgstub-utils.h" + +bool windbg_on_load(void) +{ + return false; +} + +void windbg_on_exit(void) +{} diff --git a/windbgstub.c b/windbgstub.c index 378d1b911f..99c3ef9b14 100755 --- a/windbgstub.c +++ b/windbgstub.c @@ -39,8 +39,16 @@ static void windbg_chr_receive(void *opaque, const uint8= _t *buf, int size) } } =20 +void windbg_try_load(void) +{ + if (windbg_state && !windbg_state->is_loaded) { + windbg_state->is_loaded =3D windbg_on_load(); + } +} + static void windbg_exit(void) { + windbg_on_exit(); g_free(windbg_state); } =20