From patchwork Wed Apr 24 23:31:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791592 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1106586wrq; Wed, 24 Apr 2024 16:33:47 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXkpFF6O/B+7j7N0ybTo6EPPPqAjPnb10CKVP4hRflWZBaZsYYiKQALT78O41RTKPTli6tfcN7E0ak/k7H4cei4 X-Google-Smtp-Source: AGHT+IGaEevsaExo38SCS2QgTcjLxWpIywPGB0s+KKLIXQt8oC7SC7sH33wGI2PIlWVKRbZ5wcCL X-Received: by 2002:a05:622a:19a3:b0:439:fd29:3e9 with SMTP id u35-20020a05622a19a300b00439fd2903e9mr4413564qtc.27.1714001626990; Wed, 24 Apr 2024 16:33:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714001626; cv=none; d=google.com; s=arc-20160816; b=UGwqUnlcgcYkfAJ9fF502VWkZbjfvkXunNrnz5NtZNYTx2x29HVmXJhjs+DtQ9/nM7 d0ba2UIuo37ogtVyLa0c9YWIBZ5zijt6qxsNTjI+3RxifnNhmmfIiROYZhHZ5rXDI/hJ AM7AD6+S2xkvJ+yeXs0qD6QSz49Znl7TMyAOuF+ydvk0NbJ6DftDzk92OlOBLyGS65Zr 2jX+pD0YGwToy/jj5UmobEPPp3GMitsOMMawejwqLMDP8VpZReWftyIhZ5COw1AYJdbP JUx9AdDWO5Znmc2ZgpGRsoWxR14i0F9Wnht2vHZDSvy7KnMPfX0Ut98mvYHDesfOi5KC 0Nww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KENF3qoIai8EKBqtt1xiPdTvHherBETdFHxGPatGjNo=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=SHgO0VD+YK3HDplHRqfrN+AZ5QNqO9hhgVuwGysdjy6Pmg9/Hm/a0ef/apJk5CHGLg NTuyU08iB9+rS4dCQ/aCrM49nDdjmSxgPmEFzKVmCHa80Gr+2uTK0iZRcXWTKIE2ius6 RtbfsxiKVhzVEtYVk2DxDkIgqRhC3t+bvEIwj9VK25JByQfXLd+td8FM9ofmQgrCm8Bs x1H7oqhrBZhUX8m4t9Roh7kDZEomaMOfVv2vVfvG9aaVIUiwOc1tl5guJ4d5MizcXeQQ sR1mXhV/I19Rvm0pkKFUKD6SlQidiZiedmKn3RgLk5jx/3iTnVydMPIuzvINc6x1UB1m NjiA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ay3UI16V; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ca9-20020a05622a1f0900b0043988fe77f0si11149448qtb.164.2024.04.24.16.33.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:33:46 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ay3UI16V; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzm5i-0005vI-HU; Wed, 24 Apr 2024 19:31:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rzm5d-0005qV-Et for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:49 -0400 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzm5b-0003TG-FA for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:48 -0400 Received: by mail-pj1-x102f.google.com with SMTP id 98e67ed59e1d1-2a78c2e253aso362284a91.3 for ; Wed, 24 Apr 2024 16:31:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714001505; x=1714606305; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KENF3qoIai8EKBqtt1xiPdTvHherBETdFHxGPatGjNo=; b=ay3UI16VzwPNIR9/lwrs7GlF7Ug8G0PovI0WsPM9Pt1ads0+DM6/qO8oS8J/SysXjX k1d9UhSdpUst50BCjJ5FfNPpH6SStn3FHkgjp4HjmGutWEUdaLNnm1sGSmt9NeHGGA2/ +GvFiBO7/L+yccob6tL92zpLQJqcMlgZ3VyHF5kjpwSVfPUVsDWCBssskwd1mQbBGBLA bxWCEzGTNTGpj45W/7E1L8HNJLczXJLYY7lfur+q8vkji5JByhBDfeQmE6IoEsd2/jWp GQyqe924WSSwEHbNWuJpt6N8aDKqis+epHrw6XbW34GnHThcKUZO1W7WGQnlA3yEIUEb RLQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714001505; x=1714606305; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KENF3qoIai8EKBqtt1xiPdTvHherBETdFHxGPatGjNo=; b=mVzWtNykNKifOYrcvKSsiykvpTBx3eIdRRnnORJ/gtsTfCy//1dFJMAKmHUvJuxr94 yx23R9c2w5FDAhC+n9T002WOYp0cKzR/Op27DLeAP+kD6OrddV1CSsruS1VKLjlrdIIh Fu7rTxafZuAKMEdM5Un1I71lf/pAfNtsiEbMQZ4Tm59EZv+6MXgHnJ1/EosVgzRXy/tu CBVN1T3dc3lFxz5NSgmaHr0V14iTTZSdDSDz2xXhkpDFeVuIuOgp6pmw90jZT1ukli+k I3QYouPwfo2nxelqX4/3yy3ERcnRyVllcyageNPQYulgJQMx9Q8wzsTF/YmtQyS6bche jQ6w== X-Gm-Message-State: AOJu0YwX2SGKGaYvBRwvayIv0x5OnlXIXb+FIXjeBrpFX7G7BSkbTJm5 J7V+s8ZMonlxK+wCoT1ou7tWzWaywIy5nxwZCj12JdaUNyI0oESXxw24detYhOslqrHOVXNnG/T W X-Received: by 2002:a17:90a:fd07:b0:2a2:5e8c:3a47 with SMTP id cv7-20020a17090afd0700b002a25e8c3a47mr3694685pjb.48.1714001505432; Wed, 24 Apr 2024 16:31:45 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id z24-20020a17090abd9800b002a56b3931dfsm11737859pjr.49.2024.04.24.16.31.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:31:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 14/33] plugins: Use DisasContextBase for qemu_plugin_tb_vaddr Date: Wed, 24 Apr 2024 16:31:12 -0700 Message-Id: <20240424233131.988727-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240424233131.988727-1-richard.henderson@linaro.org> References: <20240424233131.988727-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102f; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org We do not need to separately record the start of the TB. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- include/qemu/plugin.h | 1 - accel/tcg/plugin-gen.c | 3 +-- plugins/api.c | 3 ++- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/include/qemu/plugin.h b/include/qemu/plugin.h index 3db0e75d16..340e10ef12 100644 --- a/include/qemu/plugin.h +++ b/include/qemu/plugin.h @@ -117,7 +117,6 @@ struct qemu_plugin_scoreboard { struct qemu_plugin_tb { GPtrArray *insns; size_t n; - uint64_t vaddr; /* if set, the TB calls helpers that might access guest memory */ bool mem_helper; diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index b036773d3c..2c52306f80 100644 --- a/accel/tcg/plugin-gen.c +++ b/accel/tcg/plugin-gen.c @@ -188,7 +188,7 @@ static void plugin_gen_inject(struct qemu_plugin_tb *plugin_tb) int insn_idx = -1; if (unlikely(qemu_loglevel_mask(LOG_TB_OP_PLUGIN) - && qemu_log_in_addr_range(plugin_tb->vaddr))) { + && qemu_log_in_addr_range(tcg_ctx->plugin_db->pc_first))) { FILE *logfile = qemu_log_trylock(); if (logfile) { fprintf(logfile, "OP before plugin injection:\n"); @@ -318,7 +318,6 @@ bool plugin_gen_tb_start(CPUState *cpu, const DisasContextBase *db) ret = true; - ptb->vaddr = db->pc_first; ptb->mem_helper = false; tcg_gen_plugin_cb(PLUGIN_GEN_FROM_TB); diff --git a/plugins/api.c b/plugins/api.c index 4b6690c7d6..36ab47cdae 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -200,7 +200,8 @@ size_t qemu_plugin_tb_n_insns(const struct qemu_plugin_tb *tb) uint64_t qemu_plugin_tb_vaddr(const struct qemu_plugin_tb *tb) { - return tb->vaddr; + const DisasContextBase *db = tcg_ctx->plugin_db; + return db->pc_first; } struct qemu_plugin_insn *