From patchwork Wed Apr 24 23:30:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791596 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1106781wrq; Wed, 24 Apr 2024 16:34:21 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXLvPo25EGF8/UHoXMoiVrhRGG99aJqDmetpfg87Tb3QrbtUD8kPxFW9dtBJWfhnpPhlUrenvj3t8ZG10c0/sDk X-Google-Smtp-Source: AGHT+IGYyxk1I7yV9ptzqULqomROHH1BGvM6XfmUHN5z7WiIM1wF1r70x4cae1eV5ERslwgu1svm X-Received: by 2002:a05:6902:1b08:b0:de5:568a:9a9 with SMTP id eh8-20020a0569021b0800b00de5568a09a9mr4844053ybb.38.1714001661527; Wed, 24 Apr 2024 16:34:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714001661; cv=none; d=google.com; s=arc-20160816; b=ajhaWz7pjoyr/d2r4RCaGy4+hyJUyonpmz/7YKzmf5464QB4h56kRWaD6wLpytbhhn /xIhe4wDZu1NnAK97iLleUFbQTOu7VQilELrOEEtHTAHQBvmN3CqfBf9dCubFjAaqn9t +YmCK626zcQTBAAF23GcwU8l6ZS7AeDEcjPe8Dy/k/JlylWNojv/aJsIyXpfxwB891WI q3A8kth5t18g95iZ1+PkmvlituGY7+6pj7PZu5yPYVrvtM87bpX3pbiVmrHkjkDJahkd bJLzrvPuUxkYkhPR//vgN7zhH35l59EbVTSBrA74ePuvtPYbt/j0J0CK2B0U3xu15QVY OGTQ== 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=hBxX6V9wjd/+Q59RJb43vuZBy1cLIl1w0CB7kBrEvAE=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=g1DPXl1+Fg+a0+9ZtPDMeld1cT4Tx1BOIOVgrAmhc/7ug837XZB+5QcxRp8MvTKjuc PIEthLCzL7gnSLusIYQXbs6SkRbaLgFFeoMocwLhn5Sp8Y4UOm0u5M3HGgPjxvQsnzLI gObKyzlBqd4qBpl1EvlOj/BCtbuQH2gyjCIBzdU/yJuEvuwXWcfyVGN5uemoRNWCJsab Xe79prYZ7RyGJUFN8MQDDVfGvSmR86o1K2PHx+u/NGsBd2+GxyqVsUobWMxDvlMhMznw ZlFewEALgE7l0MnnI9Ovv2OoKerYCG0vNeuS0Tr0SfD7FZnIokucH0OgaglFWlySMcyA 0eAg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CEY7WIz6; 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 r15-20020ad4576f000000b0069b6d0c7631si16675117qvx.554.2024.04.24.16.34.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:34:21 -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=CEY7WIz6; 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 1rzm5X-0005mO-BY; Wed, 24 Apr 2024 19:31:43 -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 1rzm5S-0005kV-FX for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:39 -0400 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzm5Q-0003N2-9x for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:38 -0400 Received: by mail-pg1-x52e.google.com with SMTP id 41be03b00d2f7-5ff57410ebbso328630a12.1 for ; Wed, 24 Apr 2024 16:31:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714001494; x=1714606294; 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=hBxX6V9wjd/+Q59RJb43vuZBy1cLIl1w0CB7kBrEvAE=; b=CEY7WIz6oDg6BocTADMk3dKHGjN28eT8W1bzXZAgJpxZ5cLXagcxn8tAmXr5CzJMTp it3MRRsPvnm5RUKV4PZSVVvPDYsXzhkrQiSGfS9jLmWwyc1ynTAUH+mm3G39m5Hm724f 7JrC7R6IgkQjw8/FnevUS4uMOIVZnu26lEg5Lw9BHFkg67kMr6oLHpzRhk9eKo3UX98Q d0OZfsfB1XoHmB+rb9DopjoV8qraQHm6ku7OSvx6DpY8RI8mkxm0MafgGwVhyOgLnte6 PHDAoAoKav7bo2hQwlmZlWnmh+PeW/npHT0wHGAj0u4ztL5IT006FHCneChiofBb+cpJ M+mA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714001494; x=1714606294; 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=hBxX6V9wjd/+Q59RJb43vuZBy1cLIl1w0CB7kBrEvAE=; b=A/Uj9p2kSWK5pW3ggSnqCzlevQkPBCYXzWIjQiDg9MnGe3NzuXFqlrb6d9Yl65az5L HW8diU5FFnLEHMCp11WlJ9pGe7x/wgApNE7njhs7NHbPJpkf6aabIQWNAR0P2J8Bn42F z3KUJtFU1ZCqkbeR+MVC+Hx5HnNFT8rfPO/KSyNF+AEVv2yzq2pxXZ5micWNVJX0j9jf o/MyNyQjZ54Wooitu0/fmo8txFMl9lTysJmWuCTOLLPyaaMudywA+6srC5AEm4izQ3HX tXZzvKZgk+0AHrokckAXvOeyc724jzEojvepMV3G4YqVodAWmCCV/9hC5NeWOMXvyBrn Jtjg== X-Gm-Message-State: AOJu0Yy/o9igjYwqfTEpgZkbxAj/0zE4wyKg+4VisfBk6bO2sEBmAfE2 vH9SAXrp2r4uACPqb1pIapZfQrrYXQWcrVBiPRQCerNclqrAKot4p3wEDIDSsRiF7AxjC5X/OuV n X-Received: by 2002:a17:90b:120e:b0:2a4:b831:5017 with SMTP id gl14-20020a17090b120e00b002a4b8315017mr2144910pjb.48.1714001494233; Wed, 24 Apr 2024 16:31:34 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id z24-20020a17090abd9800b002a56b3931dfsm11737859pjr.49.2024.04.24.16.31.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:31:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 01/33] accel/tcg: Use vaddr in translator_ld* Date: Wed, 24 Apr 2024 16:30:59 -0700 Message-Id: <20240424233131.988727-2-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::52e; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52e.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 Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- include/exec/translator.h | 18 +++++++++--------- accel/tcg/translator.c | 15 ++++++++------- target/hexagon/translate.c | 1 + target/microblaze/translate.c | 1 + 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/include/exec/translator.h b/include/exec/translator.h index 2c4fb818e7..51489c181c 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -19,7 +19,7 @@ */ #include "qemu/bswap.h" -#include "exec/cpu_ldst.h" /* for abi_ptr */ +#include "exec/vaddr.h" /** * gen_intermediate_code @@ -182,14 +182,14 @@ bool translator_io_start(DisasContextBase *db); * the relevant information at translation time. */ -uint8_t translator_ldub(CPUArchState *env, DisasContextBase *db, abi_ptr pc); -uint16_t translator_lduw(CPUArchState *env, DisasContextBase *db, abi_ptr pc); -uint32_t translator_ldl(CPUArchState *env, DisasContextBase *db, abi_ptr pc); -uint64_t translator_ldq(CPUArchState *env, DisasContextBase *db, abi_ptr pc); +uint8_t translator_ldub(CPUArchState *env, DisasContextBase *db, vaddr pc); +uint16_t translator_lduw(CPUArchState *env, DisasContextBase *db, vaddr pc); +uint32_t translator_ldl(CPUArchState *env, DisasContextBase *db, vaddr pc); +uint64_t translator_ldq(CPUArchState *env, DisasContextBase *db, vaddr pc); static inline uint16_t translator_lduw_swap(CPUArchState *env, DisasContextBase *db, - abi_ptr pc, bool do_swap) + vaddr pc, bool do_swap) { uint16_t ret = translator_lduw(env, db, pc); if (do_swap) { @@ -200,7 +200,7 @@ translator_lduw_swap(CPUArchState *env, DisasContextBase *db, static inline uint32_t translator_ldl_swap(CPUArchState *env, DisasContextBase *db, - abi_ptr pc, bool do_swap) + vaddr pc, bool do_swap) { uint32_t ret = translator_ldl(env, db, pc); if (do_swap) { @@ -211,7 +211,7 @@ translator_ldl_swap(CPUArchState *env, DisasContextBase *db, static inline uint64_t translator_ldq_swap(CPUArchState *env, DisasContextBase *db, - abi_ptr pc, bool do_swap) + vaddr pc, bool do_swap) { uint64_t ret = translator_ldq(env, db, pc); if (do_swap) { @@ -230,7 +230,7 @@ translator_ldq_swap(CPUArchState *env, DisasContextBase *db, * re-synthesised for s390x "ex"). It ensures we update other areas of * the translator with details of the executed instruction. */ -void translator_fake_ldb(uint8_t insn8, abi_ptr pc); +void translator_fake_ldb(uint8_t insn8, vaddr pc); /* * Return whether addr is on the same page as where disassembly started. diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 9de0bc34c8..42fa977e45 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -13,6 +13,7 @@ #include "exec/exec-all.h" #include "exec/translator.h" #include "exec/plugin-gen.h" +#include "exec/cpu_ldst.h" #include "tcg/tcg-op-common.h" #include "internal-target.h" @@ -293,11 +294,11 @@ static void *translator_access(CPUArchState *env, DisasContextBase *db, return host + (pc - base); } -static void plugin_insn_append(abi_ptr pc, const void *from, size_t size) +static void plugin_insn_append(vaddr pc, const void *from, size_t size) { #ifdef CONFIG_PLUGIN struct qemu_plugin_insn *insn = tcg_ctx->plugin_insn; - abi_ptr off; + size_t off; if (insn == NULL) { return; @@ -314,7 +315,7 @@ static void plugin_insn_append(abi_ptr pc, const void *from, size_t size) #endif } -uint8_t translator_ldub(CPUArchState *env, DisasContextBase *db, abi_ptr pc) +uint8_t translator_ldub(CPUArchState *env, DisasContextBase *db, vaddr pc) { uint8_t ret; void *p = translator_access(env, db, pc, sizeof(ret)); @@ -328,7 +329,7 @@ uint8_t translator_ldub(CPUArchState *env, DisasContextBase *db, abi_ptr pc) return ret; } -uint16_t translator_lduw(CPUArchState *env, DisasContextBase *db, abi_ptr pc) +uint16_t translator_lduw(CPUArchState *env, DisasContextBase *db, vaddr pc) { uint16_t ret, plug; void *p = translator_access(env, db, pc, sizeof(ret)); @@ -343,7 +344,7 @@ uint16_t translator_lduw(CPUArchState *env, DisasContextBase *db, abi_ptr pc) return ret; } -uint32_t translator_ldl(CPUArchState *env, DisasContextBase *db, abi_ptr pc) +uint32_t translator_ldl(CPUArchState *env, DisasContextBase *db, vaddr pc) { uint32_t ret, plug; void *p = translator_access(env, db, pc, sizeof(ret)); @@ -358,7 +359,7 @@ uint32_t translator_ldl(CPUArchState *env, DisasContextBase *db, abi_ptr pc) return ret; } -uint64_t translator_ldq(CPUArchState *env, DisasContextBase *db, abi_ptr pc) +uint64_t translator_ldq(CPUArchState *env, DisasContextBase *db, vaddr pc) { uint64_t ret, plug; void *p = translator_access(env, db, pc, sizeof(ret)); @@ -373,7 +374,7 @@ uint64_t translator_ldq(CPUArchState *env, DisasContextBase *db, abi_ptr pc) return ret; } -void translator_fake_ldb(uint8_t insn8, abi_ptr pc) +void translator_fake_ldb(uint8_t insn8, vaddr pc) { plugin_insn_append(pc, &insn8, sizeof(insn8)); } diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c index f163eefe97..c9bf0e7508 100644 --- a/target/hexagon/translate.c +++ b/target/hexagon/translate.c @@ -24,6 +24,7 @@ #include "exec/helper-proto.h" #include "exec/translation-block.h" #include "exec/log.h" +#include "exec/cpu_ldst.h" #include "internal.h" #include "attribs.h" #include "insn.h" diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index fc451befae..0941aa67c0 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -25,6 +25,7 @@ #include "tcg/tcg-op.h" #include "exec/helper-proto.h" #include "exec/helper-gen.h" +#include "exec/cpu_ldst.h" #include "exec/translator.h" #include "qemu/qemu-print.h" From patchwork Wed Apr 24 23:31:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791579 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1106013wrq; Wed, 24 Apr 2024 16:32:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX2AH1aCAhMdF5DLArzPRVLYc6XktXSpqKLp2+ZgSXoZhejqGiptUYfDGv31ZAtFd2IXF4Ot4TtDmsuXYgC6w25 X-Google-Smtp-Source: AGHT+IGuvPAgz18AvVxjHCnhMLTUt39D0nHj5LvEXv/YE9BPDDQAEgxhMYqNjzMKH6ZqnRTyHBvn X-Received: by 2002:a05:620a:2a0b:b0:790:96d4:7bba with SMTP id o11-20020a05620a2a0b00b0079096d47bbamr1554045qkp.14.1714001536421; Wed, 24 Apr 2024 16:32:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714001536; cv=none; d=google.com; s=arc-20160816; b=c03Qc/XPhO/bgzPsN72TVEeNDueghY+Le8OjH1OrVPfYcZ33Un31PfGFTbNnLpgTnW yozwiXmTxlDf2jLOXjprKobxnCJHoDWA0O4uHgiAWgRXf9h4j2ZPw5fxnhBuKZIB5rJE YxW69kOErjitvgn7HgyuSvhnbIDrWHIOeAaiIbpIBV+g2DX/QGEkam1zGnIUiU5OhbI7 4x6nQQTDvrPhFdx8j+tWME0opXslmr/AVjMVfjkD2CbQzqVVAyUK0ad662H9cxV4gLUc Rk3rtnCQHZzmhCrDe/twLGPRzIy0jEukxtRR+GwH1NaWS2Lq5q/EAMvBWJGzgkInmnMK 7NLw== 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=72opLZMRAnTWHZuSokDnzsmDpQQDFnMJLSYqW0AMFXA=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=eRx6VkajevAOAGnp6AQ74k6a6Xh7rjyCl3yJ3nu9R4twL3JOIv2gWx2/+NM0p1BUAW tOBKQuwzeqvCPSEN9pGMIiaDuoqtRhADrzZj964u5kp2oz6Ad6FT58nIQs+TXh8Lbx6e h3HxBYvO3jC9vUgIK/tM00lHOBhQDOVc7M3xEO/bItNGYmVHLMuhrywhR2UGniqOHf0A JD7JeJj9cnIH1H1pr0T9WOYNYLurwvxPB0wHi4TgN1ECAB4Tt2MkjNeWNj4l95aAZufQ CbQYwsW8zIuyx1mPsENqOeQxTfqCHoPkmHsPJ8Dg9qxVjQWZpaqhlHsnojOWKyCJsyGw omyg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wa5bX4kO; 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 v27-20020a05620a0a9b00b0078f1a57ac07si13551857qkg.207.2024.04.24.16.32.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:32:16 -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=wa5bX4kO; 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 1rzm5V-0005lR-Rt; Wed, 24 Apr 2024 19:31:41 -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 1rzm5S-0005k3-6r for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:39 -0400 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzm5Q-0003Q6-GD for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:37 -0400 Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-5f80aa2d4a3so374485a12.0 for ; Wed, 24 Apr 2024 16:31:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714001495; x=1714606295; 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=72opLZMRAnTWHZuSokDnzsmDpQQDFnMJLSYqW0AMFXA=; b=wa5bX4kOl33pknmSF+8zBEZW2xIxIYq8j++dQfI/D8IhtJuCk9Lh50Y5553HeA230I X/SG0GlVzi3G84PsFX/ZD5iW7I2q4Fv720zow8XN/gxHWUY95QVezWVyXrHVLVGIH62W a4POuJDxDsJLVau8kS6mR9iU+C1UuzIETDO2RnygaWKZWFU48sHJgVJQL6tWEEhIWoAq sF6RkNegf75Me/UdXNRmiTGJNFBkbTEXlizNjiOjj2O1aWs+6ffPa8L9+CmDe57Rl2Ip jfAqXH90BaUxzW1/AY/Rdr678GLX9YP+AqHz9mJLPPTw5QABWUu2juriTV1/6sxPNM7G dVeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714001495; x=1714606295; 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=72opLZMRAnTWHZuSokDnzsmDpQQDFnMJLSYqW0AMFXA=; b=RfRI2vDuOcgJdhScVl7rsb8NJfBiqo/53f5ji1biU/xXXAGhiLC/ezYcroY2PSfaQM C866Jnk8yA8Cb2558jXtxa89o2+XjluOxKZBgEvdDLPp6cmi9pgg9Y4HTpd0vsccPsEL PbsM7sprnpygykwDTxqpUD79bRg6DbBxw/S/Kx3foGSIDPmvHB4iwM3ubzNzMtYxL9Eo 0/7Wxch0MH3V41J/KsZ6NObY55xZl7x687uC1mEwhN54Fps22DALcvVocwXvcQVbWmin cUA9tbwgKGVl8ojpvVn0aoegz7g7Ni+sv7cVeV1vkNkT4wqHKQ/Dkt3PIFx8RyYdNkwl rNig== X-Gm-Message-State: AOJu0YwcgLdaGAX5eyi8ZFCtuf4ong+BbP8yPsdKAB7AHX9Svrkyry7D 6dLp0OICt4Ry04J27nN7mX/B6lHVV76X/lfo2ykhxknHpPyJoxS/66RCf4dFgyyoUUqteMrPoTJ 2 X-Received: by 2002:a05:6a20:d80f:b0:1ad:7e4a:d681 with SMTP id iv15-20020a056a20d80f00b001ad7e4ad681mr4715309pzb.25.1714001495117; Wed, 24 Apr 2024 16:31:35 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id z24-20020a17090abd9800b002a56b3931dfsm11737859pjr.49.2024.04.24.16.31.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:31:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 02/33] accel/tcg: Hide in_same_page outside of a target-specific context Date: Wed, 24 Apr 2024 16:31:00 -0700 Message-Id: <20240424233131.988727-3-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::532; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x532.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 While there are other methods that could be used to replace TARGET_PAGE_MASK, the function is not really required outside the context of target-specific translation. This makes the header usable by target independent code. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- include/exec/translator.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/exec/translator.h b/include/exec/translator.h index 51489c181c..c6a9e4b69a 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -232,6 +232,7 @@ translator_ldq_swap(CPUArchState *env, DisasContextBase *db, */ void translator_fake_ldb(uint8_t insn8, vaddr pc); +#ifdef NEED_CPU_H /* * Return whether addr is on the same page as where disassembly started. * Translators can use this to enforce the rule that only single-insn @@ -241,5 +242,6 @@ static inline bool is_same_page(const DisasContextBase *db, vaddr addr) { return ((addr ^ db->pc_first) & TARGET_PAGE_MASK) == 0; } +#endif #endif /* EXEC__TRANSLATOR_H */ From patchwork Wed Apr 24 23:31:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791600 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1106879wrq; Wed, 24 Apr 2024 16:34:42 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWULMzRNPXajc9iahIJevdp91rbRdszKd40OQ1EpM6EuBI/UM0PEXfZreWPZdkJWan6J2l/IlYR+PZTnHFdnRF8 X-Google-Smtp-Source: AGHT+IHv5q1yg544xNH0Wc9HInRPAaThBj5QAkFHQB3Pgcz6U4/oPCh6U0/ERsWgtuGNLXo0/X40 X-Received: by 2002:a05:6358:9291:b0:183:7d27:c07b with SMTP id m17-20020a056358929100b001837d27c07bmr3595273rwa.32.1714001681779; Wed, 24 Apr 2024 16:34:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714001681; cv=none; d=google.com; s=arc-20160816; b=jAAT9iIakXgrloqeHYoj3l8BZ4ynJHhdH2iR75IxP9CEPKEpJBCaAPPGyiAm4d1RhH GyZEazJK9633nLL7Kne1bNHF5vp3MDgQMpfAN8gzi23yAVrKm29C0MJ4NT8HK6a6SE6s ITKVF0d3HvofmpCt/Z3EnFJOnF9D5bhDvdKpoyFkHbHqdENOu31PXG6zK+bGK2SSzZjr 3QmJaeFDuEERXbSiaJ9TaSq6oemeigKZQZolEBgWUhZJFX7rt0pK40Z8buGi+a8SJ1V0 rIZBoeHC64tqmRw+4fq6Q4qIBP7lI8xRGQFidq9+bY6eVnx8Eht+pQFScPTCvcJGbafk 6XIw== 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=KRmmyNWVRI8wLkGl56IuznCDWl3kVq+6+02gTlw1Wzo=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=UEg7XW3n+HmDHkrsuY+9WxJTer1zdJUEz2XMxwe7mtKEXhEdKdHb9jYKVurC22EBMg 5XJTzVtCQGepEOdSeBmBIvaHWH/YlhJnnKfn8aaiKrEZZ+RPPvUdViLiYUW4vFeIw3LT wc6XsLIVpKr1bY5nVUoE3/8Fk5yBY5RV1t9T7C3pJoqippl+zr2X1wgpeHVxYYa8Xkmc UBs9Amf+sIl7J4iZ93F+Ev0wyf20GG4tuuTNqJrs0gJbOqMV4iW3id+2kWySV5wSvzjL YoBqPhv8hR0Wk7XdCTuv1KZ9i8eLOiS2jzFhYTqIrCKw3lGv5ggdCktf7pH1RWhfXMbh lvdg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tJQfICG8; 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 eh27-20020a05622a579b00b0043687278051si15106190qtb.583.2024.04.24.16.34.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:34:41 -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=tJQfICG8; 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 1rzm5Y-0005oa-Pn; Wed, 24 Apr 2024 19:31:44 -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 1rzm5U-0005lQ-6T for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:41 -0400 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzm5R-0003QB-Kh for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:39 -0400 Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-5e152c757a5so277183a12.2 for ; Wed, 24 Apr 2024 16:31:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714001496; x=1714606296; 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=KRmmyNWVRI8wLkGl56IuznCDWl3kVq+6+02gTlw1Wzo=; b=tJQfICG8G6HdUVHbOmhaEalCDVsl0KEbvbkGJKnRn1cPfg6NGm6nCFIu/393XUZ/0X erMcHS3v9iZf0V9+wN4zFD0jPiYCsA2EvSDkf19PYYZhp9lIAz6I47Mh7MNEwVQb9tak CD+bjLuRYp5GWdJpGPaRo0yrJ/u24X5X/Jlj+kPxVhiG30VYWYjlkpnBAxJx5oaLVgBd fDOvBuZRHAaoRkoYZZJv4F+YLq6HoP9bwvYP6IZrAIS8SeVg7Ozs5Hwbc717ecZE60Oc gZfJXicGHnkcS9nN8eUbUkNSWQZ6ryqimFfAS8Vze2isanqHYhL7XZilA4g33wkdPLbN S4Rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714001496; x=1714606296; 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=KRmmyNWVRI8wLkGl56IuznCDWl3kVq+6+02gTlw1Wzo=; b=ViLp+9QR1Ll4CR+TLb+5ADRVTEWq008NH76yjyaOZS9jklPz6XBar2z9XsRq4ZKLjo ovbNe3JPk4aRFwacQik5prkYfSl6X9EpPNrFW65zlc3uKZBe/HKxP+1pFGLEE3ZMjGTs yNZPSlbmy+rZjIBYrl7aD2EyLPsT6VaP5ak9P0pbWwAux+1T2ZMf6xbx60r9zk9ZufYA w7zB78TDggAXUlnz1GO3noJFTfgqBVEF8wdsjxp8aYdutj5MgjpdQeFaRLvqo7ZHBnC/ LkSji4vjcPS2fdAXHgGWJSKyklpmDXaAvXfpAlGyaKZrJbT8ENNgtiVo33RlYKPQuV/+ x/sg== X-Gm-Message-State: AOJu0YysAH7fOF5TykT3pjBWFC8xdRL2xe8QovzBW2kAgUyqbz2uF1C/ GU9DqYjU0CcZ7R3vZfmP0HthTIhmOL2JpWVsWSgIvHL3pN7TYx/SM3b6AjU7K8qdYOPXPeu46k/ O X-Received: by 2002:a17:90a:a391:b0:2ac:f010:b1c0 with SMTP id x17-20020a17090aa39100b002acf010b1c0mr3610554pjp.22.1714001495935; Wed, 24 Apr 2024 16:31:35 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id z24-20020a17090abd9800b002a56b3931dfsm11737859pjr.49.2024.04.24.16.31.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:31:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 03/33] accel/tcg: Pass DisasContextBase to translator_fake_ldb Date: Wed, 24 Apr 2024 16:31:01 -0700 Message-Id: <20240424233131.988727-4-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::52d; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52d.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 Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- include/exec/translator.h | 5 +++-- accel/tcg/translator.c | 2 +- target/s390x/tcg/translate.c | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/exec/translator.h b/include/exec/translator.h index c6a9e4b69a..83fe66cba0 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -222,15 +222,16 @@ translator_ldq_swap(CPUArchState *env, DisasContextBase *db, /** * translator_fake_ldb - fake instruction load - * @insn8: byte of instruction + * @db: Disassembly context * @pc: program counter of instruction + * @insn8: byte of instruction * * This is a special case helper used where the instruction we are * about to translate comes from somewhere else (e.g. being * re-synthesised for s390x "ex"). It ensures we update other areas of * the translator with details of the executed instruction. */ -void translator_fake_ldb(uint8_t insn8, vaddr pc); +void translator_fake_ldb(DisasContextBase *db, vaddr pc, uint8_t insn8); #ifdef NEED_CPU_H /* diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 42fa977e45..92eb77c3a0 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -374,7 +374,7 @@ uint64_t translator_ldq(CPUArchState *env, DisasContextBase *db, vaddr pc) return ret; } -void translator_fake_ldb(uint8_t insn8, vaddr pc) +void translator_fake_ldb(DisasContextBase *db, vaddr pc, uint8_t insn8) { plugin_insn_append(pc, &insn8, sizeof(insn8)); } diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index 90a74ee795..6d7f6e7064 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -6203,7 +6203,7 @@ static const DisasInsn *extract_insn(CPUS390XState *env, DisasContext *s) /* Register insn bytes with translator so plugins work. */ for (int i = 0; i < ilen; i++) { uint8_t byte = extract64(insn, 56 - (i * 8), 8); - translator_fake_ldb(byte, pc + i); + translator_fake_ldb(&s->base, pc + i, byte); } op = insn >> 56; } else { From patchwork Wed Apr 24 23:31:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791610 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1107577wrq; Wed, 24 Apr 2024 16:36:41 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXRn1t4s/kmMpzDok+5vd9kNogO31p2YEi14NYxDF9ZzrbnWPpc3yTyRth6GjS4PCy3hCFlpTG6+50JM6R5zkrq X-Google-Smtp-Source: AGHT+IFAhj0i+9kXdk+mzxfIPaYWlGc8DGu9HL3WaOrWibr7DBo60RXctYqZMddAjZMsDwlBF/ch X-Received: by 2002:a25:b05:0:b0:dda:c10b:1c6d with SMTP id 5-20020a250b05000000b00ddac10b1c6dmr3925483ybl.51.1714001801476; Wed, 24 Apr 2024 16:36:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714001801; cv=none; d=google.com; s=arc-20160816; b=zZdjU/49r38bff73ZqYLy84YlwsERuJUwpKELtrWx201GRxPlgHY2BBexzNpgsmH1a jItolw+9m/v27Y4Pslj21eQEXp/q0LnPFHOOQmNQ+BIZyF/HstW5EKlExCwy12K94FDd NmSsxtt0QjV6bYWFUOfl87CUno4xkilsQHa4NSmPd99z2l0rIr5yEACGIh+wCMUKFy64 2pp9ZxeFr/eMGxkWbBlmr5UuyZbKrLtnRj5dw9Fg/J2Hos+0T9rbaukMiRaEgpkSk8sg UMjtFPtIk9GGWcT+IsJLFUIC3fbTDGEt3ZHAQ3+kBkEnyrVMMUk8NAsDFhJnrd/pjg1H tfVA== 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:to:from :dkim-signature; bh=Zi6Hpm0Fqh5LXd8IFQ8rccUkOSCRSCULZssenmqa9PA=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=ptOFyGGvozQAKtHh0WsC4ERTQPPPM0Wggu/wf/zET9FDQf7+/pm9BrtFBvwi5Ghy+J 9frIKAHxl8zt9keZs1Yrjnz+oIc0QUJgsDXn8j5U7t0f2GY6/5kgVR0wY6pt2o2GaraV E2pLECbAtYxMcVD/MWDK403oIbgzqF42k5w9KIlwWa+/zalGfO54EGpdRl8fVmHziEXS lpcvREy+WPZEjYVcBeQtOUEyWyu5mUBErZ7DvubOJO/TDjESv97wkPn4MXL/nMByg1hX Cf935agN9FCA5jc3v7Z6WB39S5ge96PLNe6uiw/azS7dAPJ/Rg//jRw1D5Q7FdJnhdRd JbVQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WvzFw31Q; 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 8-20020a0562140d6800b006a0824a6602si7719592qvs.401.2024.04.24.16.36.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:36:41 -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=WvzFw31Q; 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 1rzm5d-0005qS-D5; Wed, 24 Apr 2024 19:31:49 -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 1rzm5W-0005m1-3U for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:42 -0400 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzm5S-0003Qy-8K for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:41 -0400 Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-53fa455cd94so317031a12.2 for ; Wed, 24 Apr 2024 16:31:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714001497; x=1714606297; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Zi6Hpm0Fqh5LXd8IFQ8rccUkOSCRSCULZssenmqa9PA=; b=WvzFw31QxE6cnWxz9gn7tGk8PR+M3zytGH9BtkZa3YiUk3poesq3ZTR8PsQ6GhjdOK CUxHh0y6AIq9HvJhfBxQaV5IWBB7nHFzkiAFV89LXqmD3DuBGLTC7PI7bErH/lm192dJ BhtYkRAlIJD2dWEMH9tTppDc2ZgaEKhR9hfXXDiYLOdj53D5wgSaYg+mPnXJzT1rNWUY +foXLS6gmzCRRuIuJS2e2ZEkii+kLjORgc6+elOqujJVx1p1HRb69TjtRy6eGyi03LtO 5/FW+4Jm6isrr2TKeI7+ldpKkjjsfgewy2zOk1hTYZD+vUZXEYwM60Yrwh5K1EmQB2f7 sYQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714001497; x=1714606297; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Zi6Hpm0Fqh5LXd8IFQ8rccUkOSCRSCULZssenmqa9PA=; b=hxr3gix0pkMxQ9+/5dEQXO/SZAfPNuGerfImR7oLEMnuVrUWMrEkyAS2mP2vKR5bk/ ox//Mgs0/GYO8Xn7+otePqwC1F0HAPDxu6oofyYNUBrOmjrC3bDuSsZNKmhOdnVoC1Sl 1yOB/txl3uxKNxWZD1icfSQoMylbYKGKz5b5tSFKBO5RIk9bkn+qqf8mA2N1HrbawQw3 UjYogNNi90KVDgdEeKEWsGM9xUyWofnPg/hx6C9gsViMimaZte8btAaYYykcsGomLOq/ UWAVUOGsfk81sHSf1ldhLgt1vok3EjdbzdFK3VrrXr/TMuN5nS8sW5AP6zakT822EFbD ruIA== X-Gm-Message-State: AOJu0YzvX60Kkj0R0ODXOF1kpW4628sxILGmrV4iCDxr0Joz90UF1v4P YqkOOAXlaLf7xBnRG0V9LVKDeTLC9pPLBc5lUf40eSipWQY6qP826SBTPvtDpS/4QD6mZR78vzj 8 X-Received: by 2002:a17:90a:1f46:b0:2a4:6a31:600c with SMTP id y6-20020a17090a1f4600b002a46a31600cmr3626461pjy.14.1714001496675; Wed, 24 Apr 2024 16:31:36 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id z24-20020a17090abd9800b002a56b3931dfsm11737859pjr.49.2024.04.24.16.31.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:31:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 04/33] accel/tcg: Reorg translator_ld* Date: Wed, 24 Apr 2024 16:31:02 -0700 Message-Id: <20240424233131.988727-5-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::535; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x535.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 Reorg translator_access into translator_ld, with a more memcpy-ish interface. If both pages are in ram, do not go through the caller's slow path. Assert that the access is within the two pages that we are prepared to protect, per TranslationBlock. Allow access prior to pc_first, so long as it is within the first page. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- accel/tcg/translator.c | 189 ++++++++++++++++++++++------------------- 1 file changed, 101 insertions(+), 88 deletions(-) diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 92eb77c3a0..dbd54e25a2 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -229,69 +229,88 @@ void translator_loop(CPUState *cpu, TranslationBlock *tb, int *max_insns, } } -static void *translator_access(CPUArchState *env, DisasContextBase *db, - vaddr pc, size_t len) +static bool translator_ld(CPUArchState *env, DisasContextBase *db, + void *dest, vaddr pc, size_t len) { + TranslationBlock *tb = db->tb; + vaddr last = pc + len - 1; void *host; - vaddr base, end; - TranslationBlock *tb; - - tb = db->tb; + vaddr base; /* Use slow path if first page is MMIO. */ if (unlikely(tb_page_addr0(tb) == -1)) { - return NULL; + return false; } - end = pc + len - 1; - if (likely(is_same_page(db, end))) { - host = db->host_addr[0]; - base = db->pc_first; - } else { + host = db->host_addr[0]; + base = db->pc_first; + + if (likely(((base ^ last) & TARGET_PAGE_MASK) == 0)) { + /* Entire read is from the first page. */ + memcpy(dest, host + (pc - base), len); + return true; + } + + if (unlikely(((base ^ pc) & TARGET_PAGE_MASK) == 0)) { + /* Read begins on the first page and extends to the second. */ + size_t len0 = -(pc | TARGET_PAGE_MASK); + memcpy(dest, host + (pc - base), len0); + pc += len0; + dest += len0; + len -= len0; + } + + /* + * The read must conclude on the second page and not extend to a third. + * + * TODO: We could allow the two pages to be virtually discontiguous, + * since we already allow the two pages to be physically discontiguous. + * The only reasonable use case would be executing an insn at the end + * of the address space wrapping around to the beginning. For that, + * we would need to know the current width of the address space. + * In the meantime, assert. + */ + base = (base & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE; + assert(((base ^ pc) & TARGET_PAGE_MASK) == 0); + assert(((base ^ last) & TARGET_PAGE_MASK) == 0); + host = db->host_addr[1]; + + if (host == NULL) { + tb_page_addr_t page0, old_page1, new_page1; + + new_page1 = get_page_addr_code_hostp(env, base, &db->host_addr[1]); + + /* + * If the second page is MMIO, treat as if the first page + * was MMIO as well, so that we do not cache the TB. + */ + if (unlikely(new_page1 == -1)) { + tb_unlock_pages(tb); + tb_set_page_addr0(tb, -1); + return false; + } + + /* + * If this is not the first time around, and page1 matches, + * then we already have the page locked. Alternately, we're + * not doing anything to prevent the PTE from changing, so + * we might wind up with a different page, requiring us to + * re-do the locking. + */ + old_page1 = tb_page_addr1(tb); + if (likely(new_page1 != old_page1)) { + page0 = tb_page_addr0(tb); + if (unlikely(old_page1 != -1)) { + tb_unlock_page1(page0, old_page1); + } + tb_set_page_addr1(tb, new_page1); + tb_lock_page1(page0, new_page1); + } host = db->host_addr[1]; - base = TARGET_PAGE_ALIGN(db->pc_first); - if (host == NULL) { - tb_page_addr_t page0, old_page1, new_page1; - - new_page1 = get_page_addr_code_hostp(env, base, &db->host_addr[1]); - - /* - * If the second page is MMIO, treat as if the first page - * was MMIO as well, so that we do not cache the TB. - */ - if (unlikely(new_page1 == -1)) { - tb_unlock_pages(tb); - tb_set_page_addr0(tb, -1); - return NULL; - } - - /* - * If this is not the first time around, and page1 matches, - * then we already have the page locked. Alternately, we're - * not doing anything to prevent the PTE from changing, so - * we might wind up with a different page, requiring us to - * re-do the locking. - */ - old_page1 = tb_page_addr1(tb); - if (likely(new_page1 != old_page1)) { - page0 = tb_page_addr0(tb); - if (unlikely(old_page1 != -1)) { - tb_unlock_page1(page0, old_page1); - } - tb_set_page_addr1(tb, new_page1); - tb_lock_page1(page0, new_page1); - } - host = db->host_addr[1]; - } - - /* Use slow path when crossing pages. */ - if (is_same_page(db, pc)) { - return NULL; - } } - tcg_debug_assert(pc >= base); - return host + (pc - base); + memcpy(dest, host + (pc - base), len); + return true; } static void plugin_insn_append(vaddr pc, const void *from, size_t size) @@ -317,61 +336,55 @@ static void plugin_insn_append(vaddr pc, const void *from, size_t size) uint8_t translator_ldub(CPUArchState *env, DisasContextBase *db, vaddr pc) { - uint8_t ret; - void *p = translator_access(env, db, pc, sizeof(ret)); + uint8_t raw; - if (p) { - plugin_insn_append(pc, p, sizeof(ret)); - return ldub_p(p); + if (!translator_ld(env, db, &raw, pc, sizeof(raw))) { + raw = cpu_ldub_code(env, pc); } - ret = cpu_ldub_code(env, pc); - plugin_insn_append(pc, &ret, sizeof(ret)); - return ret; + plugin_insn_append(pc, &raw, sizeof(raw)); + return raw; } uint16_t translator_lduw(CPUArchState *env, DisasContextBase *db, vaddr pc) { - uint16_t ret, plug; - void *p = translator_access(env, db, pc, sizeof(ret)); + uint16_t raw, tgt; - if (p) { - plugin_insn_append(pc, p, sizeof(ret)); - return lduw_p(p); + if (translator_ld(env, db, &raw, pc, sizeof(raw))) { + tgt = tswap16(raw); + } else { + tgt = cpu_lduw_code(env, pc); + raw = tswap16(tgt); } - ret = cpu_lduw_code(env, pc); - plug = tswap16(ret); - plugin_insn_append(pc, &plug, sizeof(ret)); - return ret; + plugin_insn_append(pc, &raw, sizeof(raw)); + return tgt; } uint32_t translator_ldl(CPUArchState *env, DisasContextBase *db, vaddr pc) { - uint32_t ret, plug; - void *p = translator_access(env, db, pc, sizeof(ret)); + uint32_t raw, tgt; - if (p) { - plugin_insn_append(pc, p, sizeof(ret)); - return ldl_p(p); + if (translator_ld(env, db, &raw, pc, sizeof(raw))) { + tgt = tswap32(raw); + } else { + tgt = cpu_ldl_code(env, pc); + raw = tswap32(tgt); } - ret = cpu_ldl_code(env, pc); - plug = tswap32(ret); - plugin_insn_append(pc, &plug, sizeof(ret)); - return ret; + plugin_insn_append(pc, &raw, sizeof(raw)); + return tgt; } uint64_t translator_ldq(CPUArchState *env, DisasContextBase *db, vaddr pc) { - uint64_t ret, plug; - void *p = translator_access(env, db, pc, sizeof(ret)); + uint64_t raw, tgt; - if (p) { - plugin_insn_append(pc, p, sizeof(ret)); - return ldq_p(p); + if (translator_ld(env, db, &raw, pc, sizeof(raw))) { + tgt = tswap64(raw); + } else { + tgt = cpu_ldl_code(env, pc); + raw = tswap64(tgt); } - ret = cpu_ldq_code(env, pc); - plug = tswap64(ret); - plugin_insn_append(pc, &plug, sizeof(ret)); - return ret; + plugin_insn_append(pc, &raw, sizeof(raw)); + return tgt; } void translator_fake_ldb(DisasContextBase *db, vaddr pc, uint8_t insn8) From patchwork Wed Apr 24 23:31:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791601 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1106894wrq; Wed, 24 Apr 2024 16:34:45 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXL9Ky9wtvVOhw0Pk450u48mYb6u8K69coVvkYf9ymYeXVYv8YHvexAAFfJl2MxZqGSCmwKiSeOKcYdOojZBvIm X-Google-Smtp-Source: AGHT+IHSuWwL3ppI78Wvj09PbpYVVVqDxg5fwFCrdJ3XrcWqnYcv6cjHcm5VbNrvpMcLe0MWrMJV X-Received: by 2002:a05:620a:1a23:b0:790:97a3:fc3c with SMTP id bk35-20020a05620a1a2300b0079097a3fc3cmr1434775qkb.3.1714001685620; Wed, 24 Apr 2024 16:34:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714001685; cv=none; d=google.com; s=arc-20160816; b=MkwCvBsdMPYDRjuDB8sNyglBHBSBwGqpzYX+P/bkzjNWdnGeN05zIGY8RBsgKPmHGW fWphcRizNY9l/WFlLjQqjiCPJgQnoo78q5+U7nnBVv6tkP/qJDechU+aXKcfyyu+QGft YSMwoXhT0tvqEB1i1bp7qCprYv0Woj1tvIhVeq/j4bqs98NvlKBTUvo326/SVnUMnWGj 1LbDx4WzzP/s66OMUydEX0AA3g9UL8PvWxTTqFWlBb1UZk69OK1kzuWE/Gv7dtFPDNet 0YYS2zuWiEqqaHs8OSGvaWnc5CbzR5wOOG7XBGOxEpegjbwcsCUhKO4ynOvkpkYbbhMA h0wQ== 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=0iznKbTX8oBcbpJPieQQMWlAI4HDAUpQMvJb/sM2VnA=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=I+4GCZ8jwQ4r9u7+ZCtRqMjqhrzjH/R341xcRC1JRpOqJIpnn3HJn9qxnDlNHBCxXB KkGfch6yD6/sY7FaXFFHJmaXqKwm587Hk6EctSTL890Qs4qANXe4wkxN3EPdV5YKaNnL 8lC3uGSDc3sl7+rRIehnxI4HSHzWd+EgiG7ruJl3HH3VTCJ4hAKv6RuCn0fMOG2y8bhV 5xwt1cpTB4fznNDIv7yON3urIyeQVE70aA5PacbeKUwiSndGPNYRf0F5+5b6FK2+KOzc BBY5NNsZVofuGLrG1Md4FKp5s2mdEHK6/h9EFeU9CluDDQ3+13NmCLZihg6cWjZuO+fU qAGw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="oHeRMg/2"; 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 h16-20020a37de10000000b0078f0eb3b04csi15177794qkj.713.2024.04.24.16.34.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:34:45 -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="oHeRMg/2"; 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 1rzm5d-0005qZ-Hk; Wed, 24 Apr 2024 19:31:49 -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 1rzm5V-0005m0-WF for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:42 -0400 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzm5T-0003R5-Uz for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:41 -0400 Received: by mail-pj1-x1031.google.com with SMTP id 98e67ed59e1d1-2ad8fb779d2so400936a91.0 for ; Wed, 24 Apr 2024 16:31:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714001497; x=1714606297; 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=0iznKbTX8oBcbpJPieQQMWlAI4HDAUpQMvJb/sM2VnA=; b=oHeRMg/2+/cO2VyzeYyA/D0BWR3Pcj7Ks/aQSA4VTYFAZrikXn0VBX9vIqLK3dvUrw Ibm25juYs3PAgzj8rCfCnF29UhYo1u0Co3mzb/Z42LfnvaIUxx/SduaPZVjxVDGr5NNs X9M0s+ytzse01W2v3NPhtWIgeq34WPruzpBJfZ59lJE/lnaWYMqsE9HQHS1jshyJK0yR pIvmg5x4ZtB7ocAugrKqheR1lWs2AeCjNqNTMCa7zdynDVCx4uT3cO8EvJFPdJsPmBRJ v1wzbyNj9RJG6+MtlhqmdEdqrZrtHBQFNgv1reGzq9ujF1bb1trrYeFdP4qSuRjE3+Vj jwfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714001497; x=1714606297; 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=0iznKbTX8oBcbpJPieQQMWlAI4HDAUpQMvJb/sM2VnA=; b=i75OTOAdkDKQ2Vq8o/oAtZAZCpmUtFLaunqYNWKa3XySsN/FjWKx3Ms2EIPk3Ndx2b 7RAQqboBVXZC+SyA2ol8hoNusqW6XMmcUV/5CjLY2Rqz1WmoIuR11US1+4507gVs4hQS 7WvKwadDbHFiWGs2N1/DPncZoecL5hKcX695BQnLTiIDQARb76GLzNTxsXexRYTbHMlT f/2gpGGoZh/13KXTbyqV7JVtmWZ53EYEn9v6jnCxN9GBIgbg3ODQQoHeRkdSVQNP5aPx odnr5ZJtNb0r7reXmjMb30x2zCQFK9pytHu+jHBjHXCAlVIBlxj86kaJBv3HAmOCN2cy brpA== X-Gm-Message-State: AOJu0YyrgErurnF2I3I4BSL6CQ5v482DAvBhu7AEkkmgrYYg++CRrPOl +Utcfm1mEEGrTHbikq06uFJArp9SGa3TLvBsLxmM1YM0OIt8bGY79jVtXzuwlSTwCL1a6avHMKR Y X-Received: by 2002:a17:90b:1d0e:b0:2a2:f284:5196 with SMTP id on14-20020a17090b1d0e00b002a2f2845196mr3902965pjb.45.1714001497549; Wed, 24 Apr 2024 16:31:37 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id z24-20020a17090abd9800b002a56b3931dfsm11737859pjr.49.2024.04.24.16.31.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:31:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 05/33] accel/tcg: Cap the translation block when we encounter mmio Date: Wed, 24 Apr 2024 16:31:03 -0700 Message-Id: <20240424233131.988727-6-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::1031; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1031.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 Do not allow translation to proceed beyond one insn with mmio, as we will not be caching the TranslationBlock. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- accel/tcg/translator.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index dbd54e25a2..c3f4d0e252 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -239,6 +239,8 @@ static bool translator_ld(CPUArchState *env, DisasContextBase *db, /* Use slow path if first page is MMIO. */ if (unlikely(tb_page_addr0(tb) == -1)) { + /* We capped translation with first page MMIO in tb_gen_code. */ + tcg_debug_assert(db->max_insns == 1); return false; } @@ -287,6 +289,8 @@ static bool translator_ld(CPUArchState *env, DisasContextBase *db, if (unlikely(new_page1 == -1)) { tb_unlock_pages(tb); tb_set_page_addr0(tb, -1); + /* Require that this be the final insn. */ + db->max_insns = db->num_insns; return false; } From patchwork Wed Apr 24 23:31:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791583 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1106198wrq; Wed, 24 Apr 2024 16:32:46 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU/NhziRC4/Jq/UxldCxM+6vLTX9veww1QltMyyjiFURgy+kC8yOoS16hQ+qSJ9ZYZcgIRys0vOF+7LqsFYxYmM X-Google-Smtp-Source: AGHT+IHAtMfJ2Nb3zLsvqKEyxQu+MXbvtfCbvgUl2ZLI/shLpOTjvawMDbC4XHzqMnt0oEU9+u4/ X-Received: by 2002:a05:6902:110e:b0:dc6:c2b2:c039 with SMTP id o14-20020a056902110e00b00dc6c2b2c039mr5347277ybu.41.1714001565922; Wed, 24 Apr 2024 16:32:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714001565; cv=none; d=google.com; s=arc-20160816; b=C2vI8d7Zk1EO9nUwMR6dHlRoQ306QEfARP3xZIZ+hCL1uajeP/vuErV29SUWEQ16fa ECsPa14ZrjLglBgdd5Ru7VXzur3uAaSo85LH5x67/Ke+rvXAlslTPEirXHOgsMzhmn/K ieXyUSyBbKLuxjo3q6Mjj/2wT/0Bdn+65RRBrEII9zzb38TSu/HZrS8pTcocpaSvOwRE 6lXdVamhIuaYZCAxZiu0ujCCVmJH1vWVO+66NsKX51JrB55oDXYebvGBj+FomaccRlZM SCGZCr+Sa3FNfH+GkZTka+GwxABMC29ZReLsOtfQYjf+niLUfYofDYEHkIrk+rFgDv/F hu1Q== 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:to:from :dkim-signature; bh=0Qhc53DOAmZcesPvgUyNzStW9YhjXBj6yX17MzJRrao=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=mJ3ChCPobV4XHTKo65runV0NZF2cCz5VSDdcjWBLer/I69D4Rxo2eMzbJFkauDlUrQ OdyKqz/LfBClfR4BKN470UN4u1g5j4oCPp6JU3TcPrEyW5+xXq5qStu3RZUVTqKbZKXP G2QBqsUTaBXobTw+0E5adyyx/77rtOvhkJ9yt1R9r43laqGJ+G64ty6/7/urlyBgr8F1 Rqby4CvTnhIEW0D0fgJqZYxaoYrKPUWgdUAKrx6u7IynaOOot+Zg+GdUjOEPCHsHRh35 tgdZmKYlpLdPRV+IgTbgByNEhy7kzaae8iFT7UJkTVCZ5lQCFNDeIpfzss0br1yUTJqz WjpA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HQ0lj69S; 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 jl15-20020ad45e8f000000b0069616bb77f9si16021044qvb.612.2024.04.24.16.32.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:32:45 -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=HQ0lj69S; 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 1rzm5f-0005rW-QZ; Wed, 24 Apr 2024 19:31:51 -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 1rzm5a-0005ou-17 for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:47 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzm5T-0003RS-VL for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:45 -0400 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-6ed2dc03df6so437651b3a.1 for ; Wed, 24 Apr 2024 16:31:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714001498; x=1714606298; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=0Qhc53DOAmZcesPvgUyNzStW9YhjXBj6yX17MzJRrao=; b=HQ0lj69SqTN34oJfWoBEKqP4hmKNnLdFWZwTdmIK8eQms2WnYY85AlOsiNA0BAxlxM uemtkI1Pz4kdaVekKasmaWPQLxnz3nCOB0gbNfcjdgr+slm2ROsAXNJTrNFPL2YuPO9x QK6kisLtxEKT9M11GYoI1Ot4QToDPjh2RWTf/QROhDrGdIfkkJKabebEw3dZRDLsEiTI PEC8wpquFG/LVV8vnyFfQEsPoKKzUIbSfVDHavjn7U/ROoTFYKhHejoeoP3ropFrJEZv Ea4hlYXFntHFaCMSUF+JmOZ0RQF/jwfYQQMaQ3HcccIf19FlVbxpYqVACO9c3F2o/1gF fUNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714001498; x=1714606298; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0Qhc53DOAmZcesPvgUyNzStW9YhjXBj6yX17MzJRrao=; b=YltXnWlD6hJcqrTOacCFfxKc3T7XakTMdF5RzRkzJYJsljKvEM7VS51H9drGCMVJJg VfAlp5pnPcWh0UprSX+KhObJ32/bRz3CT4rBtXtRsP3KsMWQ+79zfJzFNE6F6yFlLqYm 7GHxStOJpvDlhucWOgfABIT8zL2iO16GI90brwZ2r5pJQfh/eZppf/olkhu/jVuzm74U LgVxL1ZaiygNOqL2/9L3t8l+qedQGGanZ+ROf3chPBQ7zSRhg9w87lJXfS+k9PuRAonP COzW012lTp+VVnONVk/7coJrTO1xnGFp4ewXK/qpShPy32TCTtuKuP/CzO7laYHFjEIh 6YDw== X-Gm-Message-State: AOJu0YykekYT+UMS0tLgVA0iR60j0siVnO183A/ues7AaDHpti+KU7dV IpBhfSBkxayGwob3THo/Z8rYgfAi76G0ddE1sMvr25FPo4XHvteD5naB5VKlV4GuTABz9D/k0gk L X-Received: by 2002:a05:6a21:6d9c:b0:1a7:3d2a:7383 with SMTP id wl28-20020a056a216d9c00b001a73d2a7383mr5641781pzb.18.1714001498387; Wed, 24 Apr 2024 16:31:38 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id z24-20020a17090abd9800b002a56b3931dfsm11737859pjr.49.2024.04.24.16.31.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:31:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 06/33] accel/tcg: Record mmio bytes during translation Date: Wed, 24 Apr 2024 16:31:04 -0700 Message-Id: <20240424233131.988727-7-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::435; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x435.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 This will be able to replace plugin_insn_append, and will be usable for disassembly. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- include/exec/translator.h | 12 ++++++++++++ accel/tcg/translator.c | 41 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/include/exec/translator.h b/include/exec/translator.h index 83fe66cba0..974cc4f9c4 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -90,6 +90,18 @@ typedef struct DisasContextBase { bool plugin_enabled; struct TCGOp *insn_start; void *host_addr[2]; + + /* + * Record insn data that we cannot read directly from host memory. + * There are only two reasons we cannot use host memory: + * (1) We are executing from I/O, + * (2) We are executing a synthetic instruction (s390x EX). + * In both cases we need record exactly one instruction, + * and thus the maximum amount of data we record is limited. + */ + int record_start; + int record_len; + uint8_t record[32]; } DisasContextBase; /** diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index c3f4d0e252..a3c246ea37 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -131,6 +131,8 @@ void translator_loop(CPUState *cpu, TranslationBlock *tb, int *max_insns, db->insn_start = NULL; db->host_addr[0] = host_pc; db->host_addr[1] = NULL; + db->record_start = 0; + db->record_len = 0; ops->init_disas_context(db, cpu); tcg_debug_assert(db->is_jmp == DISAS_NEXT); /* no early exit */ @@ -317,6 +319,39 @@ static bool translator_ld(CPUArchState *env, DisasContextBase *db, return true; } +static void record_save(DisasContextBase *db, vaddr pc, + const void *from, int size) +{ + int offset; + + /* Do not record probes before the start of TB. */ + if (pc < db->pc_first) { + return; + } + + /* + * In translator_access, we verified that pc is within 2 pages + * of pc_first, thus this will never overflow. + */ + offset = pc - db->pc_first; + + /* + * Either the first or second page may be I/O. If it is the second, + * then the first byte we need to record will be at a non-zero offset. + * In either case, we should not need to record but a single insn. + */ + if (db->record_len == 0) { + db->record_start = offset; + db->record_len = size; + } else { + assert(offset == db->record_start + db->record_len); + assert(db->record_len + size <= sizeof(db->record)); + db->record_len += size; + } + + memcpy(db->record + (offset - db->record_start), from, size); +} + static void plugin_insn_append(vaddr pc, const void *from, size_t size) { #ifdef CONFIG_PLUGIN @@ -344,6 +379,7 @@ uint8_t translator_ldub(CPUArchState *env, DisasContextBase *db, vaddr pc) if (!translator_ld(env, db, &raw, pc, sizeof(raw))) { raw = cpu_ldub_code(env, pc); + record_save(db, pc, &raw, sizeof(raw)); } plugin_insn_append(pc, &raw, sizeof(raw)); return raw; @@ -358,6 +394,7 @@ uint16_t translator_lduw(CPUArchState *env, DisasContextBase *db, vaddr pc) } else { tgt = cpu_lduw_code(env, pc); raw = tswap16(tgt); + record_save(db, pc, &raw, sizeof(raw)); } plugin_insn_append(pc, &raw, sizeof(raw)); return tgt; @@ -372,6 +409,7 @@ uint32_t translator_ldl(CPUArchState *env, DisasContextBase *db, vaddr pc) } else { tgt = cpu_ldl_code(env, pc); raw = tswap32(tgt); + record_save(db, pc, &raw, sizeof(raw)); } plugin_insn_append(pc, &raw, sizeof(raw)); return tgt; @@ -386,6 +424,7 @@ uint64_t translator_ldq(CPUArchState *env, DisasContextBase *db, vaddr pc) } else { tgt = cpu_ldl_code(env, pc); raw = tswap64(tgt); + record_save(db, pc, &raw, sizeof(raw)); } plugin_insn_append(pc, &raw, sizeof(raw)); return tgt; @@ -393,5 +432,7 @@ uint64_t translator_ldq(CPUArchState *env, DisasContextBase *db, vaddr pc) void translator_fake_ldb(DisasContextBase *db, vaddr pc, uint8_t insn8) { + assert(pc >= db->pc_first); + record_save(db, pc, &insn8, sizeof(insn8)); plugin_insn_append(pc, &insn8, sizeof(insn8)); } From patchwork Wed Apr 24 23:31:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791599 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1106827wrq; Wed, 24 Apr 2024 16:34:33 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWgXvA56qKbuVXl0Y9d7WJLCkpCROh5gDckF0kqpACrKat9aIfC1uEhCmoP7MxaGjZYl6kA3+qZt2rGp183WbyB X-Google-Smtp-Source: AGHT+IEpS/XaSXgmjoLLnxLtT9zuGKUuiSwOdBUNVgqCw58CEalOZpCGcYFeGb/v1+WrX6nrpRfL X-Received: by 2002:a05:6358:51d0:b0:18d:8c13:b83d with SMTP id 16-20020a05635851d000b0018d8c13b83dmr3368985rwl.0.1714001672863; Wed, 24 Apr 2024 16:34:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714001672; cv=none; d=google.com; s=arc-20160816; b=VtD2w/v/eYNvt9iZbhgJ7URBLR4Wv7UY97Ol2E7uYkK06y8zGOYg2ZgDe+YTO4uEDs 4YkCp9C7IcAlpAlxyFtFyQuCSoYujavtK4YVkWJ+f1ttZh4evOWNKSYuh+7oM9Q1dD4H 5dHjNSRT1iR72DtPbJag7uwsZj6NbgPshPZr9PGVcElSIbsuLWmSI33WFaEMm4RlnkrO JrQ6IT8F/qQjdrGTqmyDPedUK8mSYAE1hk3JQIRFb+SuBSP0j8jJRiNvVEQX3lG3D4ID 2Ahs5Kjq+vhrpF6VLgZSZXP4h3afk2KyobsRx8Y52vn19Q6rf1QIUQ+jbREhvT8y6m8m BCSA== 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:to:from :dkim-signature; bh=crVkl8Xc7vAuPRoqIm/BozgxHh6tNXHL1BuEpfh12ro=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=dogdNDwS7iMjxTkN7hZu7ewNldiuNQTH3SPrwNA/JvjjBVkr6JeJ/sdMYvbouWW72c 9PZl51rN+XgXzNris90BvszeSxa/oDxrM2W/2yv8J/82AfP1ZZbfLBcR0KyxpCnO09X0 Q7DZeq1zYT62iWSi2ZIfr6Me4Vbb7R2lT2tV3XXFNdPMDZjf5JSalGjasj6cRpfd3Co8 dZ5QqwIa9D8BhSCKg6yhMBmfcv/s7l4oK9/N9fPiZ2ZRNDfQg8pa//lgnTB1XLAcy36e ZhOQNNR+vTkZzT5S2yzTHxPSRvW5nTChJHeWRUks8ceVc/EP0zhhMj8Yp7/7Zx38DNUD sUiA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IVTKfYAb; 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 bb29-20020a05622a1b1d00b0043a1426c305si3140347qtb.51.2024.04.24.16.34.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:34:32 -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=IVTKfYAb; 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 1rzm5c-0005os-1W; Wed, 24 Apr 2024 19:31:48 -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 1rzm5X-0005mz-SO for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:43 -0400 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzm5V-0003Rd-NT for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:43 -0400 Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-5d4d15ec7c5so331924a12.1 for ; Wed, 24 Apr 2024 16:31:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714001499; x=1714606299; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=crVkl8Xc7vAuPRoqIm/BozgxHh6tNXHL1BuEpfh12ro=; b=IVTKfYAbajVatPQ60R8narnh5Rqyq+55ZW1pFf3B+cwRIjDa8/NV4HvFwZl9wvymfv GLVuFKYbjeLxoLrT2sgdSYHoXZFeB1uJL3aKc28hjETTyejRd6PfhF58lwohkybNcZpq hlzHu/tRbusG5eCQ9/1Smmt8X3DzvjYZ1HF45d/BdqQ1T2taw1uL+Hf8+JROLPcmAbZu P7egqP9fnHX15XD9hsaB16fAvisfpR3cWZGPuvIWurCNmjh8SVEK1kA/q50XQnMJsMV6 WamScSfuwrt1x/Gwp1VR1m8OqyqYAI12+wj6WubNOU5e+9nRhrNX2o0t3X5pLdfP7jjC Aivw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714001499; x=1714606299; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=crVkl8Xc7vAuPRoqIm/BozgxHh6tNXHL1BuEpfh12ro=; b=ry8U/Yh6+V5rcVuwsZIQvVIbp+OypWzUNroeLih0cZ//B5FCyjJmJc7GWK60dyvUqw HXUqkWxH5vLTVQSJkO2FETue6FvBOvvZtUIOSc+2PccjAZP1sODSi5csyLQZl31NVU+F wB5FYy63QWZiXr3mTr0noSaEijSGvCETSJAw2tnIVCIlob2RlNunl/qGUD48TNGZnVQb W+X2LBPA+JQbTl6Y1qshVIEjKOSx6xeDOJmKraZLBqM1PRScD+hyOAJZ+kuMST/ERNBT PdworTkmnqLPU8NoTyAEZ8+jVpQ0Qf8Oy4UL+d+U9Ej9kkX/I0fPZy2Z0pdpTJZCGpGg vR4Q== X-Gm-Message-State: AOJu0YxuC6j/VkydVrPwCeN+GMKdx3yM29A8NaYro9b/hAp6Ke1NFyFk i4anOXOiPk36UolDkxpKnjAT4VPlLr54lsIferSWTsWbnz0S3lqTe3lnAu0QIzQuQSdp8nQ3FMJ E X-Received: by 2002:a17:90a:4d83:b0:2ab:e09e:fdf6 with SMTP id m3-20020a17090a4d8300b002abe09efdf6mr4112705pjh.47.1714001499204; Wed, 24 Apr 2024 16:31:39 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id z24-20020a17090abd9800b002a56b3931dfsm11737859pjr.49.2024.04.24.16.31.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:31:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 07/33] accel/tcg: Record when translator_fake_ldb is used Date: Wed, 24 Apr 2024 16:31:05 -0700 Message-Id: <20240424233131.988727-8-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::535; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x535.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 Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- include/exec/translator.h | 3 ++- accel/tcg/translator.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/exec/translator.h b/include/exec/translator.h index 974cc4f9c4..e92dfba035 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -72,8 +72,8 @@ typedef enum DisasJumpType { * @num_insns: Number of translated instructions (including current). * @max_insns: Maximum number of instructions to be translated in this TB. * @singlestep_enabled: "Hardware" single stepping enabled. - * @saved_can_do_io: Known value of cpu->neg.can_do_io, or -1 for unknown. * @plugin_enabled: TCG plugin enabled in this TB. + * @fake_insn: True if translator_fake_ldb used. * @insn_start: The last op emitted by the insn_start hook, * which is expected to be INDEX_op_insn_start. * @@ -88,6 +88,7 @@ typedef struct DisasContextBase { int max_insns; bool singlestep_enabled; bool plugin_enabled; + bool fake_insn; struct TCGOp *insn_start; void *host_addr[2]; diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index a3c246ea37..6863455ed9 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -129,6 +129,7 @@ void translator_loop(CPUState *cpu, TranslationBlock *tb, int *max_insns, db->max_insns = *max_insns; db->singlestep_enabled = cflags & CF_SINGLE_STEP; db->insn_start = NULL; + db->fake_insn = false; db->host_addr[0] = host_pc; db->host_addr[1] = NULL; db->record_start = 0; @@ -433,6 +434,7 @@ uint64_t translator_ldq(CPUArchState *env, DisasContextBase *db, vaddr pc) void translator_fake_ldb(DisasContextBase *db, vaddr pc, uint8_t insn8) { assert(pc >= db->pc_first); + db->fake_insn = true; record_save(db, pc, &insn8, sizeof(insn8)); plugin_insn_append(pc, &insn8, sizeof(insn8)); } From patchwork Wed Apr 24 23:31:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791594 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1106718wrq; Wed, 24 Apr 2024 16:34:10 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWUdol9HgD7sTAiKAP5S5ffT4YNTD8Zt959iuI7sOQQ9aKVpjHcq12Un8o0E4HBhuMKDPXo/IZ7v6SDRyDo/89m X-Google-Smtp-Source: AGHT+IFGI06yxo8rEz+5PChpSpw0HosGvsQpRGAHws0zkaRu79WqP7/g3VyW9+wsayMEAshPSFNf X-Received: by 2002:a05:6358:3419:b0:18d:8fd9:295e with SMTP id h25-20020a056358341900b0018d8fd9295emr3875355rwd.5.1714001650187; Wed, 24 Apr 2024 16:34:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714001650; cv=none; d=google.com; s=arc-20160816; b=RwF8zfLkKT4zMA8O/7BG1sziS3Q7yNGB5Kzio/s6vS8GdHv9rlcVOBKsbh1NsoxJv0 iOuxWor6bOil13ZDiF5dRWQVyMb/BjYwBp0/0Ok8ZkyBqMKjsPgpWBJmfxKRocY9cHd2 RZXkiRFNNhIwtfPrJ56zabg0AE0puyCkYiYUP50H/dCBcDwrgflFuK5/9C9QvX6R9Wgl Gyq/+CrhPiJRe++kpMSbAEoa7m91u4UiHBlH6qd7tmuN1PVNRAL7+mSEuCiHWlLX/pzo JfB/17WuhDQMw0p+RDqaG/qYu642+3b6sjFUjMIEMFpcJAfzvfQs+k1vi6heGe8Wteex EOdA== 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:to:from :dkim-signature; bh=anHznBY/Cz4MfTk0yCQsZvoF8eFCJyevU6fe4oFhrBI=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=K5nffyD2MIQsddlhUtniFDWsLurIp4Jyo2h1q3KLiBnWUo6AZRTmkpAAQjIxnU9pDK qEDY4iwoLq+SCDDmpAPW6YSdHtbvh7AdLBhext7r5bcC06FLt91pU7VG4a1DIJFm5yb0 dXBtH5YwJLtXkkeKx63jGweZMoE3pt/10ZnAfm9zoTYkfUoFnMoSdhVBxA5NZplJF8p7 lz7e8UIeQSrMKMJs4awet8WGPLLi+RRbc06RDaPY3KV0OkXezp409721+td0lfDAXo+N tKW+wGvPk7j7tosjK3hRGqgyh5LxpfxkAMn1pXkkLzTx+hGhaYNBWXZ7NfwdCkEEk6j+ I9gQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GramDGr7; 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 d15-20020ac85d8f000000b004399a0d5844si9319473qtx.444.2024.04.24.16.34.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:34:10 -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=GramDGr7; 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 1rzm5e-0005qr-6p; Wed, 24 Apr 2024 19:31:50 -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 1rzm5Z-0005oc-18 for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:45 -0400 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzm5W-0003Rt-Ur for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:44 -0400 Received: by mail-pg1-x533.google.com with SMTP id 41be03b00d2f7-60275a82611so328313a12.1 for ; Wed, 24 Apr 2024 16:31:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714001500; x=1714606300; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=anHznBY/Cz4MfTk0yCQsZvoF8eFCJyevU6fe4oFhrBI=; b=GramDGr7IoCp6j4ysld0JeI0MR8LABxyBDhYVc7wN/tmo6RBFTw+gNIqoCNzFS/43H i1QoWrpv6u7w6AC94J+g8MFZVAH9H1HFZqPk5MZd5fBPZV+Kb6QVb2/ZTMAfsj8H8sa4 JQDO0AFriswPfrJXSBhlpoWFUuH988Q9da8A45WLv9phIqXrl2hvb3N3zQlcMqvUBRIT iEAAQ2JRKTMy+f06wECG8u7kVPhn70IZ9mHMbKJW6kP+MiuVwRRPbZzFYP4tJFZSwANQ KnpExNr19Bbe2E2Mh6DNkry5+9+d2LZsqKgHWJzT9FrdArqSEsxxfulYsJUr1QHMg29F Th/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714001500; x=1714606300; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=anHznBY/Cz4MfTk0yCQsZvoF8eFCJyevU6fe4oFhrBI=; b=of6zHvFpPQRb2/6hr45NHrdJfiZx09VMYXuLxpq2PQUt8KS1oUkCoOmS+OmlF7JAGr hqoMX/OCJX5CF+CkwY9mf3GPsVX0pCScp1Rs30/3sn1bgVtXeKJ4059RnGEyzmenQ0Iy riArBhboVDdx1F5vEZkwhsllfZiMx8RuxsFTB9nz4KZPpgk3tL/Q4XsC+szZzJmjpln5 Cc981nvyfw9PvW973kGTM0t0R/ueCCzpTQhHl2AuWb3z7I5LSFiASkN1cM/QgbmTOUcc 1W2CxovjblcHQ4M2u4KqmHUz11eSCrJv9QTiZ4qFcjXdp6r+1jji+QDPL5SpEs/T8yZ3 qmkQ== X-Gm-Message-State: AOJu0YznwJHlcRQo6csL4afh4WR4GWJ8B0vmKaq/l2EpLNRVbqORBVac gqW7Nky0g/2GhUm8U5hd/XY2urUavISWPCPFg9qD41NomAUqZHm6/l0Rae+AHG9u81RVwrwYGJX X X-Received: by 2002:a17:90b:f17:b0:2a2:937e:f958 with SMTP id br23-20020a17090b0f1700b002a2937ef958mr3713406pjb.40.1714001500260; Wed, 24 Apr 2024 16:31:40 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id z24-20020a17090abd9800b002a56b3931dfsm11737859pjr.49.2024.04.24.16.31.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:31:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 08/33] accel/tcg: Record DisasContextBase in tcg_ctx for plugins Date: Wed, 24 Apr 2024 16:31:06 -0700 Message-Id: <20240424233131.988727-9-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::533; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x533.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 Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- include/tcg/tcg.h | 1 + accel/tcg/plugin-gen.c | 1 + 2 files changed, 2 insertions(+) diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 135e36d729..2a1c080bab 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -537,6 +537,7 @@ struct TCGContext { * space for instructions (for variable-instruction-length ISAs). */ struct qemu_plugin_tb *plugin_tb; + const struct DisasContextBase *plugin_db; /* descriptor of the instruction being translated */ struct qemu_plugin_insn *plugin_insn; diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index 3db74ae9bf..94bbad6dc7 100644 --- a/accel/tcg/plugin-gen.c +++ b/accel/tcg/plugin-gen.c @@ -329,6 +329,7 @@ bool plugin_gen_tb_start(CPUState *cpu, const DisasContextBase *db, tcg_gen_plugin_cb(PLUGIN_GEN_FROM_TB); } + tcg_ctx->plugin_db = db; tcg_ctx->plugin_insn = NULL; return ret; From patchwork Wed Apr 24 23:31:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791578 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1106008wrq; Wed, 24 Apr 2024 16:32:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVdIjZVpD67ZmoswyXFr4JpL3eiBFY1kp/WIrspOXB2JuAJG0mql7dImagE3y/RKYFu8/zJaIPoPWtK/8f9B/Ai X-Google-Smtp-Source: AGHT+IE5Mctb+yG0lc/oHTmJoVHr7yAS1OPMLGNd5BUSO6lbsb2MVpjQJh/9rRnX7vZ16OmBMp64 X-Received: by 2002:a05:6358:d385:b0:18d:9e5f:aaec with SMTP id mp5-20020a056358d38500b0018d9e5faaecmr3951357rwb.31.1714001535986; Wed, 24 Apr 2024 16:32:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714001535; cv=none; d=google.com; s=arc-20160816; b=rp6hymRFCDrYGZy0kQDe0jSD6QUcEJiYnKAWu44rTYdPZLx4steHzp3qlBDir0TOol DugoWnLs1vQU3LHLeXFZPqN2G7B3PxgC8SKez0q9GUluLfGcLgcVHKPb9pExQt6H6Q1j c4pmwDAAGtwZTLv1s6DtabbZJf0EWYLMdGiKiWzXrL5zHOlRfEvRfL/hVkirEx3Pb4IW rmijpytmP0GWcMrOatmxii/POSRpoDGqoz294xcttTKffE685vTDT1dK+0jpwArGz/FA omWGioLRoBGiUcHIRACddEJeERKMU5g3vgCu6Os6y4H1fLzVUJOls7nlbVFUbQYVdJSu wR3w== 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:to:from :dkim-signature; bh=T2Vrez6mekYUNx0Ri9P+RnqhJ98QDuVTU99320zojAI=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=PkhXY5s1pwy7FEbqBmQvNZLFQeGQm5uLJ/LdxrspiBZdED+LP+5RyeLQyxoG+wEZTh dPN7ZsbhlsDpVt1iXCAdXI3xWlEeXOaC2LriyBvUjZfpzXgtIQ9PO65RI5GMrGaACUJ2 HsWb4WSFAx6fx9QPE5C5hEpztPvwajImkeKxCLuiRccF6+BJgHQbgqXPaGrP/QVB27y2 heOnmRhb61yjATt87fszdl3qICzDMQIiy8iFrB9dJ92wXDj1iGeurTJgIfZs+ZTnlOzu 07v/fNReCg8oi9y6j+8ED9pBMdJ1HrWjfg2cxKntAoljZ8pr3mlKWdvKgVKYPXdKjyWJ yq7w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ILrRpKxm; 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 ey23-20020a05622a4c1700b00439bb06779csi8948417qtb.331.2024.04.24.16.32.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:32:15 -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=ILrRpKxm; 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 1rzm5d-0005qT-DT; Wed, 24 Apr 2024 19:31:49 -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 1rzm5Y-0005ob-Ux for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:44 -0400 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzm5W-0003S0-R2 for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:44 -0400 Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-2a54fb929c8so340442a91.3 for ; Wed, 24 Apr 2024 16:31:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714001501; x=1714606301; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=T2Vrez6mekYUNx0Ri9P+RnqhJ98QDuVTU99320zojAI=; b=ILrRpKxmhE4zjNTCIk5BVahwlp9KytRwYBThqbPsZb8nliuSXvlgsYAob+KVhCQR39 US8DLDVhXkFxCGZ6SE7s8BFjxOJXmD7yqU+j7QSJk3qIJPckhMywk0VLMzbnPZSqQ25f GwLtSJ10yjDdAqJ8+PxYdUaTl9Fe0CoNAEisnHg0bhfM93EyfToL+6alLCDEijUoDc7Z xlhj7GK+vufpPGOw9J/T4HLyHS4NeITdFzX9N9ngntdNpCrVXMseh1Eu5pNvZzFwb9wu wK3F2410lLXDTSK/DnByLCc5IUUsXPnZQZvgtHxk9eWR7SMhBXe2ZsHO7FSYno6g+0YL L06Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714001501; x=1714606301; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=T2Vrez6mekYUNx0Ri9P+RnqhJ98QDuVTU99320zojAI=; b=ay3uDdfwgC2YJcFgy0Nc3b2q/tqOiDp/udq2R0H6ub8ENaF4Kkl/MmOU0JkvOvMrcu 9ML/5uuN6IV6vWeHddDbq8WPXkQfQBmQxJOmMFSELWiU4FqTg/w8hwukhAxjFi8EVuvq yFIyqeEFvQaqJxEbJ7N50GkEoRYCM9wqd7uOUYMeteze5MZlvleUHxpgrlt6QLPfYdbS eUiB/RG9OyDE51TJJzyFTMti1922NvlsY5uztoJwNNDsSQ2oKshb5yA4nE52Sg4L7cT7 dxnvnrhUsneBVI5nqxhq7GQuSvEtsHs8czAFXmPWvm1diA5tBgLhOzzVZJFz4IukOpMp zcdA== X-Gm-Message-State: AOJu0Yx+0UtdM1HkGbvI4I7+orpWip4K/STIlO7MGeOfSoWpZ4Af/NYj 7faEgslPXJ/Pn02v2rNCb/87UKpi7BgpQeyFBACO5Bg2RDnryGfD2pj9VCKJ4ZNcHKw9I9i0A7f i X-Received: by 2002:a17:90a:8405:b0:2aa:c5a0:99a7 with SMTP id j5-20020a17090a840500b002aac5a099a7mr4181726pjn.12.1714001501214; Wed, 24 Apr 2024 16:31:41 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id z24-20020a17090abd9800b002a56b3931dfsm11737859pjr.49.2024.04.24.16.31.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:31:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 09/33] plugins: Copy memory in qemu_plugin_insn_data Date: Wed, 24 Apr 2024 16:31:07 -0700 Message-Id: <20240424233131.988727-10-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::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.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 Instead of returning a host pointer, copy the data into storage provided by the caller. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- include/qemu/qemu-plugin.h | 15 +++++++-------- contrib/plugins/execlog.c | 5 +++-- contrib/plugins/howvec.c | 4 ++-- plugins/api.c | 7 +++++-- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index 4fc6c3739b..5f36c2d1ac 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -61,7 +61,7 @@ typedef uint64_t qemu_plugin_id_t; extern QEMU_PLUGIN_EXPORT int qemu_plugin_version; -#define QEMU_PLUGIN_VERSION 2 +#define QEMU_PLUGIN_VERSION 3 /** * struct qemu_info_t - system information for plugins @@ -394,17 +394,16 @@ struct qemu_plugin_insn * qemu_plugin_tb_get_insn(const struct qemu_plugin_tb *tb, size_t idx); /** - * qemu_plugin_insn_data() - return ptr to instruction data + * qemu_plugin_insn_data() - copy instruction data * @insn: opaque instruction handle from qemu_plugin_tb_get_insn() + * @dest: destination into which data is copied + * @len: length of dest * - * Note: data is only valid for duration of callback. See - * qemu_plugin_insn_size() to calculate size of stream. - * - * Returns: pointer to a stream of bytes containing the value of this - * instructions opcode. + * Returns the number of bytes copied, minimum of @len and insn size. */ QEMU_PLUGIN_API -const void *qemu_plugin_insn_data(const struct qemu_plugin_insn *insn); +size_t qemu_plugin_insn_data(const struct qemu_plugin_insn *insn, + void *dest, size_t len); /** * qemu_plugin_insn_size() - return size of instruction diff --git a/contrib/plugins/execlog.c b/contrib/plugins/execlog.c index fab18113d4..371db97eb1 100644 --- a/contrib/plugins/execlog.c +++ b/contrib/plugins/execlog.c @@ -258,8 +258,9 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb) NULL); } } else { - uint32_t insn_opcode; - insn_opcode = *((uint32_t *)qemu_plugin_insn_data(insn)); + uint32_t insn_opcode = 0; + qemu_plugin_insn_data(insn, &insn_opcode, sizeof(insn_opcode)); + char *output = g_strdup_printf("0x%"PRIx64", 0x%"PRIx32", \"%s\"", insn_vaddr, insn_opcode, insn_disas); diff --git a/contrib/plugins/howvec.c b/contrib/plugins/howvec.c index 94bbc53820..9be67f7453 100644 --- a/contrib/plugins/howvec.c +++ b/contrib/plugins/howvec.c @@ -252,7 +252,7 @@ static struct qemu_plugin_scoreboard *find_counter( { int i; uint64_t *cnt = NULL; - uint32_t opcode; + uint32_t opcode = 0; InsnClassExecCount *class = NULL; /* @@ -261,7 +261,7 @@ static struct qemu_plugin_scoreboard *find_counter( * They would probably benefit from a more tailored plugin. * However we can fall back to individual instruction counting. */ - opcode = *((uint32_t *)qemu_plugin_insn_data(insn)); + qemu_plugin_insn_data(insn, &opcode, sizeof(opcode)); for (i = 0; !cnt && i < class_table_sz; i++) { class = &class_table[i]; diff --git a/plugins/api.c b/plugins/api.c index 3912c9cc8f..4e9125ea29 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -216,9 +216,12 @@ qemu_plugin_tb_get_insn(const struct qemu_plugin_tb *tb, size_t idx) * instruction being translated. */ -const void *qemu_plugin_insn_data(const struct qemu_plugin_insn *insn) +size_t qemu_plugin_insn_data(const struct qemu_plugin_insn *insn, + void *dest, size_t len) { - return insn->data->data; + len = MIN(len, insn->data->len); + memcpy(dest, insn->data->data, len); + return len; } size_t qemu_plugin_insn_size(const struct qemu_plugin_insn *insn) From patchwork Wed Apr 24 23:31:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791580 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1106007wrq; Wed, 24 Apr 2024 16:32:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUQ4oaEGWtZbfQGQltO5klvDn+UlOQU+v3qEmuS/PRkx4Xu0EvLNHvFWJInhTlgiWmvurSoEqyHMf6sM+2rhIBd X-Google-Smtp-Source: AGHT+IEbCx9lUc2zVVyl+jL8A5edlQMIkn9hSzfqQTYp8oH2yLKW0E20D3aq4svyhAZUXhRIVOua X-Received: by 2002:ac8:5f14:0:b0:438:5264:e865 with SMTP id x20-20020ac85f14000000b004385264e865mr4585946qta.10.1714001535931; Wed, 24 Apr 2024 16:32:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714001535; cv=none; d=google.com; s=arc-20160816; b=pmk4UscbLcF5QYy74uRwCJAL2/MDb3VUfuhTt+1PiAllXKMOmFUJGn2EXwwjRxAUk8 uV/BrorvDM8MXj0gxiuTZH0jB3jyBlGeraRpKRmB8c28E6X+aiMk/t8zUERm0fCn2KKV WCUrDtT+LKAp7Tmc58pnNEV+nOED0rzHQBgzMYaUAPVbEK48MsWN6ysHq4VixO+nC2FP z8R12CzM2z64Z6DvwLbV7Vvyk9mRZiRhH82DindneRzJ3h5vbfvWbnNhQjO8t94ZqaJk tJxKKxlE9zWnuYZABIMLoX84SLGK/QSqm4TLQYpQ8RBPFHZnoCwASHZMNbhYG2Cu9xP1 ZVVw== 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:to:from :dkim-signature; bh=klixi9bNxAQDyfNDVaZxjig2PNXDSzSH4KeZpVMjb1U=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=L7/S7f8RuWiRlMlIPW9sendKlM0As25CKUSkS7K8LrGm/Bcgu15MciRjZjNnSy2d5h u/jFtZoK++3SGXmD2qjNR8ZHEjaI2gX8X6Mv7a1hgXZ6zBHz5FPctrJ7uTsB4/5DGUgO Z8pmlGieDaqOy/BcPtu4M4V/qEa6ip8zOxUIySmDlDpGvWl7wZPwSQcSSNffU/n52tGu nVme8GcoBgI2wzxQAEN0tTzTVWqsku0PXwF/pSrhZJIzqnG/mcMw1WN8sQKhZohnLew3 oF5ZCVIZ4IukgeE6eG0Nfsz4nQNwUbCd87mT7knGFOREwTMi3zQ/ZgQfU0AL70yl/6Za htRg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WK6bif1a; 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 e21-20020a05622a111500b0043688048328si16828905qty.481.2024.04.24.16.32.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:32:15 -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=WK6bif1a; 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 1rzm5e-0005qq-3v; Wed, 24 Apr 2024 19:31:50 -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 1rzm5Z-0005or-GJ for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:47 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzm5X-0003SD-J4 for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:45 -0400 Received: by mail-pj1-x1032.google.com with SMTP id 98e67ed59e1d1-2a4df5d83c7so360599a91.0 for ; Wed, 24 Apr 2024 16:31:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714001502; x=1714606302; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=klixi9bNxAQDyfNDVaZxjig2PNXDSzSH4KeZpVMjb1U=; b=WK6bif1ayj7dRP5XUu827SywcM4p1nIRhgW+WXWyFFmWfL/E87lXzZj27qGmEWtLIa MCjsLMmRlR0GeQFkd6q3DfaM7EITsD53v/JVOICjCp1AhY3/dN7R4UQPTaTzc5R57XFh 9NmLPT6rVwPUQmuaek+ZHf//o7dRqPM8jj/2qP2xErOL/Jx1gtG42P3puO3fnRGpTPNx mUroH22h4Pq97CJp+TiUoXxM7d8X6pT6ZhBdrNinpJXMSVCDVAQScOCi73aG12kwqKMC hQrxJJdS1/eBoURm26PQhvxAe+Piceqa9QGKm1WOjO1KiIz5ue1ffm56fxpEzpMyhSld A8yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714001502; x=1714606302; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=klixi9bNxAQDyfNDVaZxjig2PNXDSzSH4KeZpVMjb1U=; b=wrw63k4y2TUNyAcCKRSKeJIaN4SPoU9LYNTFf6Z61B2BFwsdjeGXLLI//rReo7D1Yc X2eo1RXPDOp7heURXNVuVRot2wLM2Avzi0/vhIwjbv7QmhEWYxPkeYjSHSQNmmkVf7Ar d33KcU3Wuye7+u8vg/ae4N52ric49SPqK2bwPaPQ19bpGWd6brffDUN1S77RFDHdT+hQ FyXqppjtXPpBkGWB4btBlq6KLztaGQJJgHA7rXPHFmFr9pL0pWN5D9AwIY/n0OrPLZjs cy5eslEa5T2BXE5gEc9LesTaKkA0ft0EZDQbGYin8jxrqlrtWAj47WqIMEcXOR5DfYgf mQbw== X-Gm-Message-State: AOJu0YyIXngZCLBNkiRh98ghUegMXAHxCl7H2sH2fUKHuNmszHa7cZRB aMm/UrZKl799hwkVtbnPCj/fnBD/F/HPUYbE8O0bsZ5bn+gDo8cQF1s2rpNW9f737A4QjiePQkN F X-Received: by 2002:a17:90b:3d02:b0:2af:9067:8097 with SMTP id pt2-20020a17090b3d0200b002af90678097mr2384707pjb.23.1714001501990; Wed, 24 Apr 2024 16:31:41 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id z24-20020a17090abd9800b002a56b3931dfsm11737859pjr.49.2024.04.24.16.31.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:31:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 10/33] accel/tcg: Implement translator_st Date: Wed, 24 Apr 2024 16:31:08 -0700 Message-Id: <20240424233131.988727-11-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::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.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 Copy data out of a completed translation. This will be used for both plugins and disassembly. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- include/exec/translator.h | 23 ++++++++++++++++ accel/tcg/translator.c | 55 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) diff --git a/include/exec/translator.h b/include/exec/translator.h index e92dfba035..3c354a4310 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -246,6 +246,29 @@ translator_ldq_swap(CPUArchState *env, DisasContextBase *db, */ void translator_fake_ldb(DisasContextBase *db, vaddr pc, uint8_t insn8); +/** + * translator_st + * @db: disassembly context + * @dest: address to copy into + * @addr: virtual address within TB + * @len: length + * + * Copy @len bytes from @addr into @dest. + * All bytes must have been read during translation. + * Return true on success or false on failure. + */ +bool translator_st(const DisasContextBase *db, void *dest, + vaddr addr, size_t len); + +/** + * translator_st_len + * @db: disassembly context + * + * Return the number of bytes available to copy from the + * current translation block with translator_st. + */ +size_t translator_st_len(const DisasContextBase *db); + #ifdef NEED_CPU_H /* * Return whether addr is on the same page as where disassembly started. diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 6863455ed9..7f63a8085d 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -353,6 +353,61 @@ static void record_save(DisasContextBase *db, vaddr pc, memcpy(db->record + (offset - db->record_start), from, size); } +size_t translator_st_len(const DisasContextBase *db) +{ + return db->fake_insn ? db->record_len : db->tb->size; +} + +bool translator_st(const DisasContextBase *db, void *dest, + vaddr addr, size_t len) +{ + size_t offset, offset_end; + + if (addr < db->pc_first) { + return false; + } + offset = addr - db->pc_first; + offset_end = offset + len; + if (offset_end > translator_st_len(db)) { + return false; + } + + if (!db->fake_insn) { + size_t offset_page1 = -(db->pc_first | TARGET_PAGE_MASK); + + /* Get all the bytes from the first page. */ + if (db->host_addr[0]) { + if (offset_end <= offset_page1) { + memcpy(dest, db->host_addr[0] + offset, len); + return true; + } + if (offset < offset_page1) { + size_t len0 = offset_page1 - offset; + memcpy(dest, db->host_addr[0] + offset, len0); + offset += len0; + dest += len0; + } + } + + /* Get any bytes from the second page. */ + if (db->host_addr[1] && offset >= offset_page1) { + memcpy(dest, db->host_addr[1] + (offset - offset_page1), + offset_end - offset); + return true; + } + } + + /* Else get recorded bytes. */ + if (db->record_len != 0 && + offset >= db->record_start && + offset_end <= db->record_start + db->record_len) { + memcpy(dest, db->record + (offset - db->record_start), + offset_end - offset); + return true; + } + return false; +} + static void plugin_insn_append(vaddr pc, const void *from, size_t size) { #ifdef CONFIG_PLUGIN From patchwork Wed Apr 24 23:31:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791588 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1106367wrq; Wed, 24 Apr 2024 16:33:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVqKuFemj/+Ve4YOuhQJpz4ylkFfT9KSlZypajka/Yto8jBmVyYN1MyL5GszM27HDUwpkd9nljj7ts4qFNTEL7i X-Google-Smtp-Source: AGHT+IHzLkqdPyT5bxEm6t+mdnrxpdQW4sQa9aHhMFzevfrtR4RhNwhxcVIXFyUk2l1x4WYTG/H+ X-Received: by 2002:a05:620a:24ca:b0:78e:ef2c:74 with SMTP id m10-20020a05620a24ca00b0078eef2c0074mr5132511qkn.33.1714001595944; Wed, 24 Apr 2024 16:33:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714001595; cv=none; d=google.com; s=arc-20160816; b=AtifaFmPxnO67HRTZtxu3SxzOce7YmTzdZpThN+1hRA9JHhLHwKMuDuDMcCgP+SRju Mna5rQi+4JNgBkFqIQdcYUjOqEkIlftP/5AOprHlLgqLOVb5KQlYZj7qRgJtCCZqO8JV Cx/UKAXGjG3jRciuS71e9F+UdfbnIjyuE2nj5EGrl9EGmtULxScRF6JtaHsvP6KU7mXF l6lVfJm5fXJYCPUJgYx40xFOXAm1P8ie5OSZZlJhrKGjikXyGWXt5kPmnWknQVaKKfbi vb9BOUo+9KWb+wpXIGHf/jl24U5GkdLf8HFGJoSlNBc/tuqGKcewKW2NLUDTUc0oFI7S c3sQ== 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:to:from :dkim-signature; bh=spELkUKERJaUgQmzIV25Fn+zqZ87OeTfDF4MrbqHfVg=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=fT/AjcY5nHvgegtO8clFmpeLmKNckWjHpL51QZ4Gdn+W7QTmWW5gdRU9oZk73HpB9h 3aVjGFZRCFfW7qO98fC96paHN/99KH5KWl0yFgS/hOYHc+Q2fuUMZIf5hFXhCnaeRLPO IwNNHEDKD0KON5gKIf79pTaIF9TL/Y4JqJFLc1nwoxk8NsJ4bzYQ0fQg31hAoLmSGDvo qMoKV0eZV7GQsN23h+omSUQ7bI5LIlqBgzDo6TC7Ys6tg7LtvHeehfgyMt7LCu7laF1J tjlm9JxMuAHUwx4RrzVYt4GN7z3XQWPYTLERy3/zQu2vzDDeCRDKrb5HM3oH3hB55w69 Ubgw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HGCo7v48; 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 wg5-20020a05620a568500b0078ed77c0a24si15917771qkn.192.2024.04.24.16.33.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:33:15 -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=HGCo7v48; 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 1rzm5f-0005rT-N4; Wed, 24 Apr 2024 19:31:51 -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 1rzm5b-0005oz-Qt for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:48 -0400 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzm5Y-0003Se-Gc for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:46 -0400 Received: by mail-pg1-x534.google.com with SMTP id 41be03b00d2f7-6001399f22bso308165a12.0 for ; Wed, 24 Apr 2024 16:31:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714001503; x=1714606303; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=spELkUKERJaUgQmzIV25Fn+zqZ87OeTfDF4MrbqHfVg=; b=HGCo7v48Uy1cUFlBSbRzkyAABXU0//CsC2EZ5jRgge8+P86kCBZ/DKUAR6FT5OSgrC EmIt6mbU+bVffcEuPafNFVIpZ0nay3Bk+QwK2KmIm66V283e5GIOxfdYHGvJ7CPhzBKR 80RWLj47MDwKkGU7F4Ydfm/6tULhj0gyyCJREDdCHBsj453aJ35tACKkJM2dpPX5VRgk LqYG1ZbRvUPapB5Mu5Z+AyAr2I9KP7VzEbJOCZUuR+L3Y84m3QzL/qXWTmjibs3fujLv IlFp18X/JlBZyLTgPqPEi9t0UvRaFAWknrcFoiUiSXrocrwDcQh0CGuJMsp/pzq0KQTq qfzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714001503; x=1714606303; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=spELkUKERJaUgQmzIV25Fn+zqZ87OeTfDF4MrbqHfVg=; b=ekFl8q9ruYn/imEc7+sm3dzeUn/5xmo/FfkueDjWj6/6Bm3sdLuy3ZaoWjoEIOTNeC O3sn/0TkJnqmbGSCRZjNIzl+wMjO8lpYOzkTcL2pJ0T91D0F+7AIPgbSJxUIEE2zqscb 0Nk6p2pm+UU8K/Q96gnq5+2LOgDgOpBtgT05SEHut3BfSkW+QPNqeY25X/+4UN5p1558 9RYrzQHoH3kZ81BOq8HBWLvRYxGXtcBmLA5XWvVSafYEwVebJr+CuwIXkksTiXrOzk3Z NnlCSsK3VvdBOSvAm8vZ7dNla8lg2uGPZK6fJGgtqj5pZweAMlPNkqiSNJQQ3gEq5vjz ph1A== X-Gm-Message-State: AOJu0YzBo7g3mpnIWjaw2t+gmviI+zIy/kgjbRAiXE4mIU91/ngtC2gD c+7W8P2PxU8ZwRPQ5GdQRWefKX8oYMirRFCrtFUHzngKmLCPzd4tThK5uohGzer3Bfctr8edaRg h X-Received: by 2002:a17:90b:b12:b0:2ab:a991:6eb8 with SMTP id bf18-20020a17090b0b1200b002aba9916eb8mr3876600pjb.42.1714001502905; Wed, 24 Apr 2024 16:31:42 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id z24-20020a17090abd9800b002a56b3931dfsm11737859pjr.49.2024.04.24.16.31.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:31:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 11/33] plugins: Use translator_st for qemu_plugin_insn_data Date: Wed, 24 Apr 2024 16:31:09 -0700 Message-Id: <20240424233131.988727-12-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::534; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x534.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 Use the bytes that we record for the entire TB, rather than a per-insn GByteArray. Record the length of the insn in plugin_gen_insn_end rather than infering from the length of the array. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- include/qemu/plugin.h | 14 +------------- accel/tcg/plugin-gen.c | 7 +++++-- accel/tcg/translator.c | 26 -------------------------- plugins/api.c | 12 +++++++----- tcg/tcg.c | 3 +-- 5 files changed, 14 insertions(+), 48 deletions(-) diff --git a/include/qemu/plugin.h b/include/qemu/plugin.h index 07b1755990..c32bb97667 100644 --- a/include/qemu/plugin.h +++ b/include/qemu/plugin.h @@ -97,11 +97,11 @@ struct qemu_plugin_dyn_cb { /* Internal context for instrumenting an instruction */ struct qemu_plugin_insn { - GByteArray *data; uint64_t vaddr; void *haddr; GArray *insn_cbs; GArray *mem_cbs; + uint8_t len; bool calls_helpers; /* if set, the instruction calls helpers that might access guest memory */ @@ -116,18 +116,6 @@ struct qemu_plugin_scoreboard { QLIST_ENTRY(qemu_plugin_scoreboard) entry; }; -/* - * qemu_plugin_insn allocate and cleanup functions. We don't expect to - * cleanup many of these structures. They are reused for each fresh - * translation. - */ - -static inline void qemu_plugin_insn_cleanup_fn(gpointer data) -{ - struct qemu_plugin_insn *insn = (struct qemu_plugin_insn *) data; - g_byte_array_free(insn->data, true); -} - /* Internal context for this TranslationBlock */ struct qemu_plugin_tb { GPtrArray *insns; diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index 94bbad6dc7..be2451be58 100644 --- a/accel/tcg/plugin-gen.c +++ b/accel/tcg/plugin-gen.c @@ -346,11 +346,9 @@ void plugin_gen_insn_start(CPUState *cpu, const DisasContextBase *db) ptb->n = n; if (n <= ptb->insns->len) { insn = g_ptr_array_index(ptb->insns, n - 1); - g_byte_array_set_size(insn->data, 0); } else { assert(n - 1 == ptb->insns->len); insn = g_new0(struct qemu_plugin_insn, 1); - insn->data = g_byte_array_sized_new(4); g_ptr_array_add(ptb->insns, insn); } @@ -389,6 +387,11 @@ void plugin_gen_insn_start(CPUState *cpu, const DisasContextBase *db) void plugin_gen_insn_end(void) { + const DisasContextBase *db = tcg_ctx->plugin_db; + struct qemu_plugin_insn *pinsn = tcg_ctx->plugin_insn; + + pinsn->len = db->fake_insn ? db->record_len : db->pc_next - pinsn->vaddr; + tcg_gen_plugin_cb(PLUGIN_GEN_AFTER_INSN); } diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 7f63a8085d..df73312f99 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -408,27 +408,6 @@ bool translator_st(const DisasContextBase *db, void *dest, return false; } -static void plugin_insn_append(vaddr pc, const void *from, size_t size) -{ -#ifdef CONFIG_PLUGIN - struct qemu_plugin_insn *insn = tcg_ctx->plugin_insn; - size_t off; - - if (insn == NULL) { - return; - } - off = pc - insn->vaddr; - if (off < insn->data->len) { - g_byte_array_set_size(insn->data, off); - } else if (off > insn->data->len) { - /* we have an unexpected gap */ - g_assert_not_reached(); - } - - insn->data = g_byte_array_append(insn->data, from, size); -#endif -} - uint8_t translator_ldub(CPUArchState *env, DisasContextBase *db, vaddr pc) { uint8_t raw; @@ -437,7 +416,6 @@ uint8_t translator_ldub(CPUArchState *env, DisasContextBase *db, vaddr pc) raw = cpu_ldub_code(env, pc); record_save(db, pc, &raw, sizeof(raw)); } - plugin_insn_append(pc, &raw, sizeof(raw)); return raw; } @@ -452,7 +430,6 @@ uint16_t translator_lduw(CPUArchState *env, DisasContextBase *db, vaddr pc) raw = tswap16(tgt); record_save(db, pc, &raw, sizeof(raw)); } - plugin_insn_append(pc, &raw, sizeof(raw)); return tgt; } @@ -467,7 +444,6 @@ uint32_t translator_ldl(CPUArchState *env, DisasContextBase *db, vaddr pc) raw = tswap32(tgt); record_save(db, pc, &raw, sizeof(raw)); } - plugin_insn_append(pc, &raw, sizeof(raw)); return tgt; } @@ -482,7 +458,6 @@ uint64_t translator_ldq(CPUArchState *env, DisasContextBase *db, vaddr pc) raw = tswap64(tgt); record_save(db, pc, &raw, sizeof(raw)); } - plugin_insn_append(pc, &raw, sizeof(raw)); return tgt; } @@ -491,5 +466,4 @@ void translator_fake_ldb(DisasContextBase *db, vaddr pc, uint8_t insn8) assert(pc >= db->pc_first); db->fake_insn = true; record_save(db, pc, &insn8, sizeof(insn8)); - plugin_insn_append(pc, &insn8, sizeof(insn8)); } diff --git a/plugins/api.c b/plugins/api.c index 4e9125ea29..7b8b7523b3 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -43,6 +43,7 @@ #include "exec/exec-all.h" #include "exec/gdbstub.h" #include "exec/ram_addr.h" +#include "exec/translator.h" #include "disas/disas.h" #include "plugin.h" #ifndef CONFIG_USER_ONLY @@ -219,14 +220,15 @@ qemu_plugin_tb_get_insn(const struct qemu_plugin_tb *tb, size_t idx) size_t qemu_plugin_insn_data(const struct qemu_plugin_insn *insn, void *dest, size_t len) { - len = MIN(len, insn->data->len); - memcpy(dest, insn->data->data, len); - return len; + const DisasContextBase *db = tcg_ctx->plugin_db; + + len = MIN(len, insn->len); + return translator_st(db, dest, insn->vaddr, len) ? len : 0; } size_t qemu_plugin_insn_size(const struct qemu_plugin_insn *insn) { - return insn->data->len; + return insn->len; } uint64_t qemu_plugin_insn_vaddr(const struct qemu_plugin_insn *insn) @@ -242,7 +244,7 @@ void *qemu_plugin_insn_haddr(const struct qemu_plugin_insn *insn) char *qemu_plugin_insn_disas(const struct qemu_plugin_insn *insn) { CPUState *cpu = current_cpu; - return plugin_disas(cpu, insn->vaddr, insn->data->len); + return plugin_disas(cpu, insn->vaddr, insn->len); } const char *qemu_plugin_insn_symbol(const struct qemu_plugin_insn *insn) diff --git a/tcg/tcg.c b/tcg/tcg.c index d248c52e96..691b2342a2 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -765,8 +765,7 @@ static void alloc_tcg_plugin_context(TCGContext *s) { #ifdef CONFIG_PLUGIN s->plugin_tb = g_new0(struct qemu_plugin_tb, 1); - s->plugin_tb->insns = - g_ptr_array_new_with_free_func(qemu_plugin_insn_cleanup_fn); + s->plugin_tb->insns = g_ptr_array_new(); #endif } From patchwork Wed Apr 24 23:31:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791606 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1107402wrq; Wed, 24 Apr 2024 16:36:12 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVrWDx+cQRkwdLCGsH/MMO9dJPxGBxa5Rbyw9eoF5z+RPdEKHgPpjR0vkwn00UWKbJyR2SAlhQGemfwE5miOnUS X-Google-Smtp-Source: AGHT+IGeWy0kvsfPaIUoVDQ2ePVqd/6ywj/yRwFtYo9ez99ssqS7Rv8mvO0yW128A6qLyBXfMDzy X-Received: by 2002:a05:620a:248f:b0:790:8108:6b3f with SMTP id i15-20020a05620a248f00b0079081086b3fmr2005648qkn.14.1714001772510; Wed, 24 Apr 2024 16:36:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714001772; cv=none; d=google.com; s=arc-20160816; b=pU4D9OZSKifLz4yysduksWZkgo6061F2MHjKi6Uxf4HTokOIbSHCvYLe9qQGXR7/T3 G8B9Yz5+n90esVAcqSlyctuFGwbZdV+c7UDuFbCYiRf70wvW0H9Nf7gnYk2BEzk0ZBIZ 1jh4mslF9Mr9qJ0MW5r3bH22CbwESfIm7PhNUxO5zRxcK5lud9x3nN7H1GULNfn5nktZ JI/sM1kS2A09N8O6DFL6q65G5N7yMEOdC6n7uzchphqZDk3jMaU3Mr3Z4rQhwjdv8Fg3 wS92SO0Kmh+UyIQYEKoi5cwTQKOrg/JcOjGuQdWTiDjfF3Dd1yjgB272Ah9UjIQTRkZp fYjg== 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:to:from :dkim-signature; bh=0UouwPRH3wiOAKSw9/lZXQqYu42fLT9B5DWzvUjcMtE=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=q3s3VHfCyjx77DXjueuElfiiBAK1TBQR9jOLSKt0c1J7P+KtYO7MLB74p7tQ+1+9/g 46/pvfjAJ0fPjZqD6TihllipcsPx2h7cPvEJICDcE5M9IC8Uqs4nvYgiwIF99V2bHDhm iCSpk5WiBUFkA7pi+uJqYe2OkU9EJdXIasOqMlN5FCdKHQ3yeeU2xrMh4TBvF4K7tSw+ yTnIk5UQozFK51p6kH83igKqR4BxN+M+tvTCdivtglMG0jH8nqATqgdO2asymiubsb7G 8e711kPcM2Rq9Pevfz83Jd/XsZ3g+qHq2mRaHuGM/TIHelHY+XJnCeikXE/ZxOLv+YiC RRRg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QskXoIfF; 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 wa13-20020a05620a4d0d00b0078ede2c40d0si16309759qkn.740.2024.04.24.16.36.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:36:12 -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=QskXoIfF; 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 1rzm5g-0005tJ-QD; Wed, 24 Apr 2024 19:31:52 -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 1rzm5b-0005p0-Qo for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:48 -0400 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzm5Z-0003Sm-3I for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:46 -0400 Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-5dcc4076c13so344153a12.0 for ; Wed, 24 Apr 2024 16:31:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714001504; x=1714606304; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=0UouwPRH3wiOAKSw9/lZXQqYu42fLT9B5DWzvUjcMtE=; b=QskXoIfFD9ECj4+c74073CtaV1gvF5cL170QHg/fuTcYbslFWXE8vO8IlDlTGMLDtX fWU6cKwiSLxh8LYQkT8Rbu0FMgkkaVL43LXDEjmPREmQUXM/pJw2LOGTcTqym4tGIjiv yR3yI1Bq6nt8luzoA2Vr4uKhWJ94AOcMaCNu+ytoy7ClLcpuaPSplW+VKaqqMnW72QHK m/6RMiJZwXeRPb6Rwjr2ZysWLt5DVf3fOfO+f18fTSyt7Wefsqr22cEh1S2wDPF1San5 onIgfe0UeiyZ6gKhQLL7iI5n6brVB3ZyhuV9vD987z6DzaAUPgEYdU10N1dlD9GNzvFb 5/yQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714001504; x=1714606304; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0UouwPRH3wiOAKSw9/lZXQqYu42fLT9B5DWzvUjcMtE=; b=xSjioeySt1t0UfXPPiVY4ACPXfTzWqCm9y0KaKdizJEP45lX0GtBhiRjlUvgv/+RzD BiKljGe/l1jznYi+NjqqM5l5+UIthbxqBN4AwCKi8DdHyHWFB/ERD6zIVMj+a2CPnU6n N7NcOf/kwerlXatXljEFnxmH42S87LxoIM/iqLO9OfYpbYjWfHlfMdtpESnD3nVwf8Vs SHlLr373g3fP26xCRDV80OiZmpmAyjhhJpmwXydNgQ+DyrlfL58iwKZTch0TAOaQgXsA 7K3xpS1V7ZnmgsVFoxrcNnbJb5g7EWrzFZHuGxdJM8Dyj4SkPy/F1gSzq3l+yQh5N0vz wwwQ== X-Gm-Message-State: AOJu0Yy7xxqcjEdM12z+iE+NcjHmKRk2RXGiRQ9PvED/m6CT6xXsz6CR +oILZ2ghs8gKf1uIf1opY6va19x8z4Vnl8+Rg3ZXXifTzgNmt/ZDD0lA7rUXmxTz6qpxFGjy5jE 5 X-Received: by 2002:a17:90b:1d0d:b0:2aa:d88d:d706 with SMTP id on13-20020a17090b1d0d00b002aad88dd706mr1694186pjb.4.1714001503763; Wed, 24 Apr 2024 16:31:43 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id z24-20020a17090abd9800b002a56b3931dfsm11737859pjr.49.2024.04.24.16.31.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:31:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 12/33] plugins: Read mem_only directly from TB cflags Date: Wed, 24 Apr 2024 16:31:10 -0700 Message-Id: <20240424233131.988727-13-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::530; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x530.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 Do not pass around a boolean between multiple structures, just read it from the TranslationBlock in the TCGContext. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- include/exec/plugin-gen.h | 7 +++---- include/qemu/plugin.h | 3 --- accel/tcg/plugin-gen.c | 4 +--- accel/tcg/translator.c | 2 +- plugins/api.c | 14 +++++++++----- 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/include/exec/plugin-gen.h b/include/exec/plugin-gen.h index f333f33198..cbb2ca2131 100644 --- a/include/exec/plugin-gen.h +++ b/include/exec/plugin-gen.h @@ -18,8 +18,7 @@ struct DisasContextBase; #ifdef CONFIG_PLUGIN -bool plugin_gen_tb_start(CPUState *cpu, const struct DisasContextBase *db, - bool supress); +bool plugin_gen_tb_start(CPUState *cpu, const struct DisasContextBase *db); void plugin_gen_tb_end(CPUState *cpu, size_t num_insns); void plugin_gen_insn_start(CPUState *cpu, const struct DisasContextBase *db); void plugin_gen_insn_end(void); @@ -28,8 +27,8 @@ void plugin_gen_disable_mem_helpers(void); #else /* !CONFIG_PLUGIN */ -static inline bool -plugin_gen_tb_start(CPUState *cpu, const struct DisasContextBase *db, bool sup) +static inline +bool plugin_gen_tb_start(CPUState *cpu, const struct DisasContextBase *db) { return false; } diff --git a/include/qemu/plugin.h b/include/qemu/plugin.h index c32bb97667..03081be543 100644 --- a/include/qemu/plugin.h +++ b/include/qemu/plugin.h @@ -106,8 +106,6 @@ struct qemu_plugin_insn { /* if set, the instruction calls helpers that might access guest memory */ bool mem_helper; - - bool mem_only; }; /* A scoreboard is an array of values, indexed by vcpu_index */ @@ -124,7 +122,6 @@ struct qemu_plugin_tb { uint64_t vaddr2; void *haddr1; void *haddr2; - bool mem_only; /* 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 be2451be58..a4656859c6 100644 --- a/accel/tcg/plugin-gen.c +++ b/accel/tcg/plugin-gen.c @@ -303,8 +303,7 @@ static void plugin_gen_inject(struct qemu_plugin_tb *plugin_tb) } } -bool plugin_gen_tb_start(CPUState *cpu, const DisasContextBase *db, - bool mem_only) +bool plugin_gen_tb_start(CPUState *cpu, const DisasContextBase *db) { bool ret = false; @@ -323,7 +322,6 @@ bool plugin_gen_tb_start(CPUState *cpu, const DisasContextBase *db, ptb->vaddr2 = -1; ptb->haddr1 = db->host_addr[0]; ptb->haddr2 = NULL; - ptb->mem_only = mem_only; ptb->mem_helper = false; tcg_gen_plugin_cb(PLUGIN_GEN_FROM_TB); diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index df73312f99..5a059ce83e 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -143,7 +143,7 @@ void translator_loop(CPUState *cpu, TranslationBlock *tb, int *max_insns, ops->tb_start(db, cpu); tcg_debug_assert(db->is_jmp == DISAS_NEXT); /* no early exit */ - plugin_enabled = plugin_gen_tb_start(cpu, db, cflags & CF_MEMI_ONLY); + plugin_enabled = plugin_gen_tb_start(cpu, db); db->plugin_enabled = plugin_enabled; while (true) { diff --git a/plugins/api.c b/plugins/api.c index 7b8b7523b3..39895a1cb1 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -87,12 +87,17 @@ void qemu_plugin_register_vcpu_exit_cb(qemu_plugin_id_t id, plugin_register_cb(id, QEMU_PLUGIN_EV_VCPU_EXIT, cb); } +static bool tb_is_mem_only(void) +{ + return tb_cflags(tcg_ctx->gen_tb) & CF_MEMI_ONLY; +} + void qemu_plugin_register_vcpu_tb_exec_cb(struct qemu_plugin_tb *tb, qemu_plugin_vcpu_udata_cb_t cb, enum qemu_plugin_cb_flags flags, void *udata) { - if (!tb->mem_only) { + if (!tb_is_mem_only()) { plugin_register_dyn_cb__udata(&tb->cbs, cb, flags, udata); } } @@ -103,7 +108,7 @@ void qemu_plugin_register_vcpu_tb_exec_inline_per_vcpu( qemu_plugin_u64 entry, uint64_t imm) { - if (!tb->mem_only) { + if (!tb_is_mem_only()) { plugin_register_inline_op_on_entry(&tb->cbs, 0, op, entry, imm); } } @@ -113,7 +118,7 @@ void qemu_plugin_register_vcpu_insn_exec_cb(struct qemu_plugin_insn *insn, enum qemu_plugin_cb_flags flags, void *udata) { - if (!insn->mem_only) { + if (!tb_is_mem_only()) { plugin_register_dyn_cb__udata(&insn->insn_cbs, cb, flags, udata); } } @@ -124,7 +129,7 @@ void qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu( qemu_plugin_u64 entry, uint64_t imm) { - if (!insn->mem_only) { + if (!tb_is_mem_only()) { plugin_register_inline_op_on_entry(&insn->insn_cbs, 0, op, entry, imm); } } @@ -206,7 +211,6 @@ qemu_plugin_tb_get_insn(const struct qemu_plugin_tb *tb, size_t idx) return NULL; } insn = g_ptr_array_index(tb->insns, idx); - insn->mem_only = tb->mem_only; return insn; } From patchwork Wed Apr 24 23:31:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791591 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1106528wrq; Wed, 24 Apr 2024 16:33:39 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUs/C8l1S1gMcPg6JVQKhu6Zwkr1HyqJX3unWAYyg75G3hK1QT2vfM7hQYHhdUE2B2mtLMamL19xTvG6yijHrzw X-Google-Smtp-Source: AGHT+IFF81iIAF5yahTR4lS3LW71o6q6sY4qUmViVq1uT9/+cc/aMMuvhIPPyC36qr9aetSiFDME X-Received: by 2002:a37:f501:0:b0:790:94aa:9628 with SMTP id l1-20020a37f501000000b0079094aa9628mr2034410qkk.15.1714001619413; Wed, 24 Apr 2024 16:33:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714001619; cv=none; d=google.com; s=arc-20160816; b=MhXxvi+NJGHCtfr/OLu5fG54dxsxWR6gUNuMTrh6guk9DY6BVlESyQuK9YZgACIIfg 0XiCGoozv7SbzHjEucHVGYXw69eEECVrDr16q3Mz1boe4MSVTaVU2MU7dlgb8P3MRBhM ws1YRNlY1Qzb6w6l28H+2mxaCujwpxFNyJa6I1y8stgaOIPMxn2MDndbk+GhXQEEWQF0 rdGmVKLp/t1uriKjvkngdzTFOdrrKI0v/hUkLJKW1mCnIU4pVsxdsxmF7M7yOCRddG9M pexGnVj+cAmw6PcetuKtLgapzCswcyHjzXgQ2IUgMm3xmhWaM8uepZ/3wonlcQPPAM8R 9N4w== 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:to:from :dkim-signature; bh=Wv67pMXMsVcEOwYDni8f26C2u4kTVwgef8xc6CDT8l8=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=L9MCeaJV+tQsAeVOeiXxpit4+wyUOzw+/u2vYRIhaM5a/uMms6Czv141WpFdQsPhXK SXQjVKaJwRT4XWeGUc0hGHkGOciZMnvGweOjWHyNRBPvVKyzeaekbjDAJApP2Wkk0yUS K4lni8eEE36nok6gN9ntYUoC5+t8JRuqAoWe/xdpXbBviBXLIDBRosXCDWJqM9qEOqHl UoHXm686myuc52ZaS8ERZ+J6RyTYEK7PhjEyyk9uyWrmxK6ZXz0rH3bs8e+sOklzdWKH 3tdYIeWfkZa9/nkRk3EiOVq4o5RN1yPYRMXPNL4w5cX14hPYuRSPiO3sFjTnA78/6qt/ 2sQA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sLV5oU+U; 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 y5-20020a05620a09c500b0078f158474e1si14812106qky.581.2024.04.24.16.33.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:33:39 -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=sLV5oU+U; 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-0005vL-TI; 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-0005qW-FP for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:49 -0400 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzm5b-0003T5-7q for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:48 -0400 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1e2b1cd446fso3240685ad.3 for ; Wed, 24 Apr 2024 16:31:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714001504; x=1714606304; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Wv67pMXMsVcEOwYDni8f26C2u4kTVwgef8xc6CDT8l8=; b=sLV5oU+Uw0T4UL4iQlbocUTMqV2YHv6NCaNJketkZ14ADOQTQM5TFyeRhBEoNBy4g9 QsQbEvn84naHPlVGpVMFkevl9cd6092hEYDrATsu8Q1sdeJ17PsCYdvdPUTUAPw+YGrT 28Uvg4HrzesgQt5jInifMX1HA4lgN5pMHRwoKNoKo7vOcFT0PNAhrUb2aDJxw1Iw7qWX NnSawB0/mQeJeqO4i+gqj0QwCKcFI+wW32f1HHavS1c6pnX2SSaY0ngT0CE20xsm5bw7 k178U9IkzxU04pWG1hg/KMSBOMACDT6LtqEODa0yViVv08BQOVmkm6HUElrbL1uGoE7V 2Dyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714001504; x=1714606304; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Wv67pMXMsVcEOwYDni8f26C2u4kTVwgef8xc6CDT8l8=; b=MzRwfZdlc98kdPhZqnLcJpzhLEfulNy7Q4gx/51ROF91ixX19NdXYunhFcvohhcjmK B3SXDfBZ7H3AL6AVn+kcWwTUN6vFfMAbwdYGP7Az4QHoGG7zYLU8kAPPIz9nCFb5G83k AU6jrU6aNSZLfqWWqkKxiZ7tAfZEC5nzpsjgqcD69eY4O2kaQzcMNHKoHBxBOU1mAmPQ 37pHpMgkbstiCrOIfzBIRQYy28IKxlc/coriwVGKC4Y9idIUFjayN0gdi9hgU8oDnSoz YkU0eowD0rqTCezQQxEMfz4AiAVopdajCAEBasrWqKGwRjdELImbJBk9cLojD4V52SWa hQoQ== X-Gm-Message-State: AOJu0YwMeGJVOUXdD3n8BuGj12dTvTVJKQnQi7gp2NsTPz4t3xa4Q1r9 +Q4iA9akReOyLHtQxIuJLO549g1mNcOJ0SXcSJmwX+pfkAxIF9NtRtAY8ENh1cX2lNbqsmBvv0J E X-Received: by 2002:a17:90a:ec15:b0:2a2:d498:eec2 with SMTP id l21-20020a17090aec1500b002a2d498eec2mr3678391pjy.40.1714001504519; Wed, 24 Apr 2024 16:31:44 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id z24-20020a17090abd9800b002a56b3931dfsm11737859pjr.49.2024.04.24.16.31.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:31:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 13/33] plugins: Use DisasContextBase for qemu_plugin_insn_haddr Date: Wed, 24 Apr 2024 16:31:11 -0700 Message-Id: <20240424233131.988727-14-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::62d; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62d.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 can delay the computation of haddr until the plugin actually requests it. Signed-off-by: Richard Henderson Reviewed-by: Pierrick Bouvier --- include/qemu/plugin.h | 4 ---- accel/tcg/plugin-gen.c | 20 -------------------- plugins/api.c | 25 ++++++++++++++++++++++++- 3 files changed, 24 insertions(+), 25 deletions(-) diff --git a/include/qemu/plugin.h b/include/qemu/plugin.h index 03081be543..3db0e75d16 100644 --- a/include/qemu/plugin.h +++ b/include/qemu/plugin.h @@ -98,7 +98,6 @@ struct qemu_plugin_dyn_cb { /* Internal context for instrumenting an instruction */ struct qemu_plugin_insn { uint64_t vaddr; - void *haddr; GArray *insn_cbs; GArray *mem_cbs; uint8_t len; @@ -119,9 +118,6 @@ struct qemu_plugin_tb { GPtrArray *insns; size_t n; uint64_t vaddr; - uint64_t vaddr2; - void *haddr1; - void *haddr2; /* 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 a4656859c6..b036773d3c 100644 --- a/accel/tcg/plugin-gen.c +++ b/accel/tcg/plugin-gen.c @@ -319,9 +319,6 @@ bool plugin_gen_tb_start(CPUState *cpu, const DisasContextBase *db) ret = true; ptb->vaddr = db->pc_first; - ptb->vaddr2 = -1; - ptb->haddr1 = db->host_addr[0]; - ptb->haddr2 = NULL; ptb->mem_helper = false; tcg_gen_plugin_cb(PLUGIN_GEN_FROM_TB); @@ -363,23 +360,6 @@ void plugin_gen_insn_start(CPUState *cpu, const DisasContextBase *db) pc = db->pc_next; insn->vaddr = pc; - /* - * Detect page crossing to get the new host address. - * Note that we skip this when haddr1 == NULL, e.g. when we're - * fetching instructions from a region not backed by RAM. - */ - if (ptb->haddr1 == NULL) { - insn->haddr = NULL; - } else if (is_same_page(db, db->pc_next)) { - insn->haddr = ptb->haddr1 + pc - ptb->vaddr; - } else { - if (ptb->vaddr2 == -1) { - ptb->vaddr2 = TARGET_PAGE_ALIGN(db->pc_first); - get_page_addr_code_hostp(cpu_env(cpu), ptb->vaddr2, &ptb->haddr2); - } - insn->haddr = ptb->haddr2 + pc - ptb->vaddr2; - } - tcg_gen_plugin_cb(PLUGIN_GEN_FROM_INSN); } diff --git a/plugins/api.c b/plugins/api.c index 39895a1cb1..4b6690c7d6 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -242,7 +242,30 @@ uint64_t qemu_plugin_insn_vaddr(const struct qemu_plugin_insn *insn) void *qemu_plugin_insn_haddr(const struct qemu_plugin_insn *insn) { - return insn->haddr; + const DisasContextBase *db = tcg_ctx->plugin_db; + vaddr page0_last = db->pc_first | ~TARGET_PAGE_MASK; + + if (db->fake_insn) { + return NULL; + } + + /* + * ??? The return value is not intended for use of host memory, + * but as a proxy for address space and physical address. + * Thus we are only interested in the first byte and do not + * care about spanning pages. + */ + if (insn->vaddr <= page0_last) { + if (db->host_addr[0] == NULL) { + return NULL; + } + return db->host_addr[0] + insn->vaddr - db->pc_first; + } else { + if (db->host_addr[1] == NULL) { + return NULL; + } + return db->host_addr[1] + insn->vaddr - (page0_last + 1); + } } char *qemu_plugin_insn_disas(const struct qemu_plugin_insn *insn) 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 * From patchwork Wed Apr 24 23:31:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791604 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1107297wrq; Wed, 24 Apr 2024 16:35:50 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVoeorp6XySeeyyuOwvaUFMP+PRRGtvj7jAEa/JrDgPi2BGDrCToyVp/yz5+N73yX+02/Ehph8k3O3hXDZAJswG X-Google-Smtp-Source: AGHT+IHMvUcC3Ui7vv4sbwLt9nm3jb4u+BJDX//dxVwUgx/7ox2C77i7NrooAJQK9I0YrioXpX0i X-Received: by 2002:a05:622a:1788:b0:439:b3f1:a94c with SMTP id s8-20020a05622a178800b00439b3f1a94cmr1796110qtk.34.1714001750417; Wed, 24 Apr 2024 16:35:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714001750; cv=none; d=google.com; s=arc-20160816; b=HGiTHKjS8sixZFU5QKi1id3s15fPPTCv3VxB8n2jDx1XrUnny4RKsOiOKZCol06jNX Czq/YyUGo1JSwaxLbBVetxfuZjO+24evs7Q/f+6PJ3qzaaMn8R+XFiCl1gM/XVDwzWqM 5lBPH3bNItCSXBcvMsbX8z1ei0PTp4pi84BPuBTVRcfYrZCbfanOPsBZ1dEd1rOadeLh eTRYLWW4xRG8lDxdVhjuEJzpjYznzvT1ZsLnoXA3qs65DIISRFP/Dn4Ralz6VvGybfOv Os+LBYEPtM9/eoP+zVo3KDgdYzf01FEHgxQi38HIE1v9f5KAiQLM4s1maQhrcq4X/fyz cyqQ== 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:to:from :dkim-signature; bh=ftBOVEixPIVqS15sO6yzpwdLAXRK5ukeZC44nc/EnDQ=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=IBAeAb64eCrZ9/Te1XoELEByffGT3VPHFyY53c4iIWhJyOaaPGatm+giQJZ6SU49NE /laiOS48PKYvorTweBXtqOVN8VQkE43HI/z75Z9RXeF20rJ7wSEOD50LMMICwyeR1Ppn ZOsV60gBn7hTaxVegcxWbbOuqAs8Ye+fuu7KBTTdLu0FjZr5GmRFomkTml1OW9NkCQg6 OwpZ8T4eFi0SoAfN7941hMpZwwKqK0gt7dbqJWsDJn5GLIzui91n2qmyagQ7r/uRXZLQ Ykaz/ET2J9aCnqDN+gejLTQNFV656ah+0P/3Ndh1f0yQQyfVwnMUBcLyRvmIDouht4cx JfXQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eZXE+hPQ; 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 y13-20020a05622a164d00b004347d192386si16764861qtj.107.2024.04.24.16.35.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:35:50 -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=eZXE+hPQ; 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 1rzm5j-0005wW-G7; Wed, 24 Apr 2024 19:31:55 -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 1rzm5e-0005qt-SL for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:51 -0400 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzm5b-0003TQ-JL for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:50 -0400 Received: by mail-pg1-x531.google.com with SMTP id 41be03b00d2f7-5dcc4076c13so344158a12.0 for ; Wed, 24 Apr 2024 16:31:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714001506; x=1714606306; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=ftBOVEixPIVqS15sO6yzpwdLAXRK5ukeZC44nc/EnDQ=; b=eZXE+hPQo+TLs2J+VlJtfV+zSCEsYfKkcx5dbde8bS8iDnGMWzPAe9nN/hCmjaPzp/ kH2uMFGMhqfespvwt/IRdzj7C+AJi2ebjP1bn0EuFg/aI4ti0er/UGTzkH+zv+nw/9tE QOjqQ3fx99RSPMw/NXCVBLu1+RNrufgTGY6ZTC5BHiPlHP6Ggvpqu2enZVQg4zx+RxbR xY3M23DkDWU+x226ircCJ89VGUdC9oGOaaPUYO5FhI0NKhM15h5s3uaJxzTsDzNgz5sJ i6Z+gGjHJAzL4nflFJY5hI0Z4dFB3Fk8MPtmyNh7eTOV7dWP0Uc4VDu8M/10/kqpPDVM /51A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714001506; x=1714606306; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ftBOVEixPIVqS15sO6yzpwdLAXRK5ukeZC44nc/EnDQ=; b=tqVRXM7eG59i0giacv3rYsNZ/tFtOz6qfHw5dpr/NZKzjMdL4X4Enx/jGZkpCkqHuv WXD/jC4NViuGe2zi05aTMsPBs0ejlB3FjkoqPiTcXPe7xrCa/diFsXothh5mdzNJdnlQ woalsIr3GlToNxqmEehfextIj77vn7Loq1XVavMMuh0y/ksvOYosCke3Z6MgE4rd3qyf bbJF/h4dmvtQA1peGNy0ONVaGG29DZ/ZqxB3v3tpABlLiftQbOblEiD4f2wsZDkaYaXT fH7bC5HoJr2kbX4WzIIEsZiPsWk27kdq1WDA+EdcU5CVqO3PvbiwYNsGiNAXKDQviKtz wQrg== X-Gm-Message-State: AOJu0YyJkadcsOs2stl+ZbHmKHlk2RM9HrkZDil12fDmoaeYa39omkAg OcPjga/INjYFFkzbVHnbGZvj65Vs5fW1s5Zofjm+qvnBLmZAILr8Tq8HPVWQOrOY8CiVrEvF6Xo l X-Received: by 2002:a17:90a:e58d:b0:29b:c31:1fe1 with SMTP id g13-20020a17090ae58d00b0029b0c311fe1mr1740865pjz.10.1714001506267; Wed, 24 Apr 2024 16:31:46 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id z24-20020a17090abd9800b002a56b3931dfsm11737859pjr.49.2024.04.24.16.31.45 for (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 Subject: [PATCH v2 15/33] plugins: Merge alloc_tcg_plugin_context into plugin_gen_tb_start Date: Wed, 24 Apr 2024 16:31:13 -0700 Message-Id: <20240424233131.988727-16-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::531; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x531.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 don't need to allocate plugin context at startup, we can wait until we actually use it. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- accel/tcg/plugin-gen.c | 36 ++++++++++++++++++++---------------- tcg/tcg.c | 11 ----------- 2 files changed, 20 insertions(+), 27 deletions(-) diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index 2c52306f80..8ebf215645 100644 --- a/accel/tcg/plugin-gen.c +++ b/accel/tcg/plugin-gen.c @@ -305,28 +305,32 @@ static void plugin_gen_inject(struct qemu_plugin_tb *plugin_tb) bool plugin_gen_tb_start(CPUState *cpu, const DisasContextBase *db) { - bool ret = false; + struct qemu_plugin_tb *ptb; - if (test_bit(QEMU_PLUGIN_EV_VCPU_TB_TRANS, cpu->plugin_state->event_mask)) { - struct qemu_plugin_tb *ptb = tcg_ctx->plugin_tb; - - /* reset callbacks */ - if (ptb->cbs) { - g_array_set_size(ptb->cbs, 0); - } - ptb->n = 0; - - ret = true; - - ptb->mem_helper = false; - - tcg_gen_plugin_cb(PLUGIN_GEN_FROM_TB); + if (!test_bit(QEMU_PLUGIN_EV_VCPU_TB_TRANS, + cpu->plugin_state->event_mask)) { + return false; } tcg_ctx->plugin_db = db; tcg_ctx->plugin_insn = NULL; + ptb = tcg_ctx->plugin_tb; - return ret; + if (ptb) { + /* Reset callbacks */ + if (ptb->cbs) { + g_array_set_size(ptb->cbs, 0); + } + ptb->n = 0; + ptb->mem_helper = false; + } else { + ptb = g_new0(struct qemu_plugin_tb, 1); + tcg_ctx->plugin_tb = ptb; + ptb->insns = g_ptr_array_new(); + } + + tcg_gen_plugin_cb(PLUGIN_GEN_FROM_TB); + return true; } void plugin_gen_insn_start(CPUState *cpu, const DisasContextBase *db) diff --git a/tcg/tcg.c b/tcg/tcg.c index 691b2342a2..6cc9f205c4 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -761,14 +761,6 @@ QEMU_BUILD_BUG_ON((int)(offsetof(CPUNegativeOffsetState, tlb.f[0]) - < MIN_TLB_MASK_TABLE_OFS); #endif -static void alloc_tcg_plugin_context(TCGContext *s) -{ -#ifdef CONFIG_PLUGIN - s->plugin_tb = g_new0(struct qemu_plugin_tb, 1); - s->plugin_tb->insns = g_ptr_array_new(); -#endif -} - /* * All TCG threads except the parent (i.e. the one that called tcg_context_init * and registered the target's TCG globals) must register with this function @@ -813,7 +805,6 @@ void tcg_register_thread(void) qatomic_set(&tcg_ctxs[n], s); if (n > 0) { - alloc_tcg_plugin_context(s); tcg_region_initial_alloc(s); } @@ -1360,8 +1351,6 @@ static void tcg_context_init(unsigned max_cpus) indirect_reg_alloc_order[i] = tcg_target_reg_alloc_order[i]; } - alloc_tcg_plugin_context(s); - tcg_ctx = s; /* * In user-mode we simply share the init context among threads, since we From patchwork Wed Apr 24 23:31:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791581 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1106010wrq; Wed, 24 Apr 2024 16:32:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU3bfRixUKtxJhfb5AtuLb3CZc5FTLEo11l3aO4yOm6c02TJocSHRy3xc7NIDc3WtZTesIL0LhYtC662ST35WZg X-Google-Smtp-Source: AGHT+IHRQ3ub/+7hyNjPgiGBaWUJh952LxJejDXBrQVj6GTDBroK4Tpoq81gw75LIxzN7PYWC9CT X-Received: by 2002:a05:6358:d58b:b0:17e:bfb8:dd86 with SMTP id ms11-20020a056358d58b00b0017ebfb8dd86mr4920218rwb.3.1714001536087; Wed, 24 Apr 2024 16:32:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714001536; cv=none; d=google.com; s=arc-20160816; b=cxfcqOPUsCDelKUFa3zYxdvt6UTNXYz4xmp4fjtGMOX4WorHutrrVJQfk8kCRo+vYs 4MBvbdcSdvrVdYftNIX0Sxe1tR+3NrmvPs4VrtGE9WBmuYc+2bCkTowdDcc+EYBNxu3p 9r1na6Jh6X3lDQnEsoFkIN7IJBe4QvP8aiO5Ft3UJRvea9JwfAwO5q24bf5v1rfZCLft H2U3NsB7Cd+tgDxvylQ7eRWKOAGZn0hgrtssmxcjxnie5wHtr7rcdIE+zi3ZFvEFfpIR ipSuu2Hm1w8khih/nSiBigiRLI91hREQ6y42A1/NpupHeHHEhyOtnSUttAAmKv65l6Zn wzWw== 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=XFrLbtTWZqMXjl/6bK1Ddf7A37VML+LFMWZ1QmUI27s=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=w76zdim6lHGwzp3LpryKcfpi34ctQhpIR+TOCJfjsjXHfGQSYSzd7FTw3KfC82x2AQ YOGFUb/2uR4BK7KujLtdxe8HesGRN7n7JrTfe/Ifr/vqPKpHlAoWu0hR6ucp9Ez9GYi8 tnJO/bQ9UlljGqjvgTNMnKvIpyyc6v7UwB5VKtjXZ3GhXRbGYQXCL+BOKigmhgXoYYIO 0NGuzl5tBgDJBKfP2PleM9tp3tx3P7xS9RAusTASbQgKhSIqysM9NEpSYpns7qC7lVGJ 929ZXaUPRjx8Ddtpy+L42U3h7+F2UN9yeXDYDxTbPplvvri3dLBnJjaukgzl/32+4qBA 2P/Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IWsIr6Ig; 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 y18-20020a05622a121200b0043784bd3531si17153844qtx.27.2024.04.24.16.32.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:32:16 -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=IWsIr6Ig; 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 1rzm5k-0005wd-8k; Wed, 24 Apr 2024 19:31:56 -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 1rzm5g-0005sw-Cm for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:52 -0400 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzm5d-0003Th-7T for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:52 -0400 Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-2ab791bce6fso349828a91.1 for ; Wed, 24 Apr 2024 16:31:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714001507; x=1714606307; 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=XFrLbtTWZqMXjl/6bK1Ddf7A37VML+LFMWZ1QmUI27s=; b=IWsIr6Igr0o3Sm7snviEPdedwNoVPJYoXPrkagp3NrgCl45z20OL4CsReY08kjONrg 7B6buwAyVXywSh5wob3b42BnZuOdBAVfnFcTGYBOWFwr9trO1bljWmEUfaAOzrDv0Ulc bcOQZ7Swm80ucuuGRetdaR/wNyZN2DsmAQCek+GoBlYGH25A72e3G9xcKmM8sH/UAPim h7spDNjTwg9qPW+1TE3lLP2LbJVQWTFadxO31Shav3FsXwaG2SPGxecphxcX2CrQN6WR I9h+QaX97snavizixOU6RLNXV4FF6EhXyNuS+6OaObVOQ61ua3qFpN5t1CADdcD5NI6A QjZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714001507; x=1714606307; 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=XFrLbtTWZqMXjl/6bK1Ddf7A37VML+LFMWZ1QmUI27s=; b=GJQSCNspth8bbT14zT+4XeoNCpfz/7NeBfZHq/L9cnganxdnxb0zlBp02qt+bwarSg m+a+JsyX9D6RxjsqGEbdmLF4K8bF+QuJs71GLC41SmKApSYdx5yuK8C/rgbn1v2RwHQR zjhLQjC7K9A1jXxVqpEwjjF25WuWPYnSzg7AqpP4yEevOoLGgtqLTqORpujxDNXE4Vsj QLeWNRaAEgYIg5zhFDVh1ejuY5ExOtTHmHTuVu1HXWReepmlxlZVeKASVl29VGlD+lKI DVHDeTsgTlwc9LPsiO9GkGpyID1CBLKAPzYZ50lr/cab7vg0EeWIhvCgrU4O3LWx545h 75IA== X-Gm-Message-State: AOJu0YzSA+eOHjImtmh96V3Srv5qJErEGTI5ObvrVXWHwk/pq24vA9Cc is/TZinVbAZ2lUhxDaGSfKMC/DZzY0ZQjjNekdVa0B79QUIbHvvyB4wSyjqIJiZN+bqNwN/rGP0 l X-Received: by 2002:a17:90a:4943:b0:2a5:e087:768a with SMTP id c61-20020a17090a494300b002a5e087768amr4163275pjh.29.1714001507176; Wed, 24 Apr 2024 16:31:47 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id z24-20020a17090abd9800b002a56b3931dfsm11737859pjr.49.2024.04.24.16.31.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:31:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 16/33] accel/tcg: Provide default implementation of disas_log Date: Wed, 24 Apr 2024 16:31:14 -0700 Message-Id: <20240424233131.988727-17-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::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.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 Almost all of the disas_log implementations are identical. Unify them within translator_loop. Drop extra Priv/Virt logging from target/riscv. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- accel/tcg/translator.c | 9 ++++++++- target/alpha/translate.c | 9 --------- target/arm/tcg/translate-a64.c | 11 ----------- target/arm/tcg/translate.c | 12 ------------ target/avr/translate.c | 8 -------- target/cris/translate.c | 11 ----------- target/hexagon/translate.c | 9 --------- target/hppa/translate.c | 6 ++++-- target/i386/tcg/translate.c | 11 ----------- target/loongarch/tcg/translate.c | 8 -------- target/m68k/translate.c | 9 --------- target/microblaze/translate.c | 9 --------- target/mips/tcg/translate.c | 9 --------- target/openrisc/translate.c | 11 ----------- target/ppc/translate.c | 9 --------- target/riscv/translate.c | 18 ------------------ target/rx/translate.c | 8 -------- target/sh4/translate.c | 9 --------- target/sparc/translate.c | 9 --------- target/tricore/translate.c | 9 --------- target/xtensa/translate.c | 9 --------- 21 files changed, 12 insertions(+), 191 deletions(-) diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 5a059ce83e..db586b894a 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -16,6 +16,7 @@ #include "exec/cpu_ldst.h" #include "tcg/tcg-op-common.h" #include "internal-target.h" +#include "disas/disas.h" static void set_can_do_io(DisasContextBase *db, bool val) { @@ -225,7 +226,13 @@ void translator_loop(CPUState *cpu, TranslationBlock *tb, int *max_insns, FILE *logfile = qemu_log_trylock(); if (logfile) { fprintf(logfile, "----------------\n"); - ops->disas_log(db, cpu, logfile); + + if (ops->disas_log) { + ops->disas_log(db, cpu, logfile); + } else { + fprintf(logfile, "IN: %s\n", lookup_symbol(db->pc_first)); + target_disas(logfile, cpu, db->pc_first, db->tb->size); + } fprintf(logfile, "\n"); qemu_log_unlock(logfile); } diff --git a/target/alpha/translate.c b/target/alpha/translate.c index a97cd54f0c..9669334da8 100644 --- a/target/alpha/translate.c +++ b/target/alpha/translate.c @@ -20,7 +20,6 @@ #include "qemu/osdep.h" #include "cpu.h" #include "sysemu/cpus.h" -#include "disas/disas.h" #include "qemu/host-utils.h" #include "exec/exec-all.h" #include "tcg/tcg-op.h" @@ -2940,20 +2939,12 @@ static void alpha_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) } } -static void alpha_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cpu, FILE *logfile) -{ - fprintf(logfile, "IN: %s\n", lookup_symbol(dcbase->pc_first)); - target_disas(logfile, cpu, dcbase->pc_first, dcbase->tb->size); -} - static const TranslatorOps alpha_tr_ops = { .init_disas_context = alpha_tr_init_disas_context, .tb_start = alpha_tr_tb_start, .insn_start = alpha_tr_insn_start, .translate_insn = alpha_tr_translate_insn, .tb_stop = alpha_tr_tb_stop, - .disas_log = alpha_tr_disas_log, }; void gen_intermediate_code(CPUState *cpu, TranslationBlock *tb, int *max_insns, diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 2666d52711..636862870f 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -22,7 +22,6 @@ #include "translate.h" #include "translate-a64.h" #include "qemu/log.h" -#include "disas/disas.h" #include "arm_ldst.h" #include "semihosting/semihost.h" #include "cpregs.h" @@ -14363,20 +14362,10 @@ static void aarch64_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) } } -static void aarch64_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cpu, FILE *logfile) -{ - DisasContext *dc = container_of(dcbase, DisasContext, base); - - fprintf(logfile, "IN: %s\n", lookup_symbol(dc->base.pc_first)); - target_disas(logfile, cpu, dc->base.pc_first, dc->base.tb->size); -} - const TranslatorOps aarch64_translator_ops = { .init_disas_context = aarch64_tr_init_disas_context, .tb_start = aarch64_tr_tb_start, .insn_start = aarch64_tr_insn_start, .translate_insn = aarch64_tr_translate_insn, .tb_stop = aarch64_tr_tb_stop, - .disas_log = aarch64_tr_disas_log, }; diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c index dc49a8d806..d605e10f11 100644 --- a/target/arm/tcg/translate.c +++ b/target/arm/tcg/translate.c @@ -23,7 +23,6 @@ #include "translate.h" #include "translate-a32.h" #include "qemu/log.h" -#include "disas/disas.h" #include "arm_ldst.h" #include "semihosting/semihost.h" #include "cpregs.h" @@ -9663,22 +9662,12 @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) } } -static void arm_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cpu, FILE *logfile) -{ - DisasContext *dc = container_of(dcbase, DisasContext, base); - - fprintf(logfile, "IN: %s\n", lookup_symbol(dc->base.pc_first)); - target_disas(logfile, cpu, dc->base.pc_first, dc->base.tb->size); -} - static const TranslatorOps arm_translator_ops = { .init_disas_context = arm_tr_init_disas_context, .tb_start = arm_tr_tb_start, .insn_start = arm_tr_insn_start, .translate_insn = arm_tr_translate_insn, .tb_stop = arm_tr_tb_stop, - .disas_log = arm_tr_disas_log, }; static const TranslatorOps thumb_translator_ops = { @@ -9687,7 +9676,6 @@ static const TranslatorOps thumb_translator_ops = { .insn_start = arm_tr_insn_start, .translate_insn = thumb_tr_translate_insn, .tb_stop = arm_tr_tb_stop, - .disas_log = arm_tr_disas_log, }; /* generate intermediate code for basic block 'tb'. */ diff --git a/target/avr/translate.c b/target/avr/translate.c index 87e2bd5ef1..6df93d4c77 100644 --- a/target/avr/translate.c +++ b/target/avr/translate.c @@ -2787,20 +2787,12 @@ static void avr_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) } } -static void avr_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cs, FILE *logfile) -{ - fprintf(logfile, "IN: %s\n", lookup_symbol(dcbase->pc_first)); - target_disas(logfile, cs, dcbase->pc_first, dcbase->tb->size); -} - static const TranslatorOps avr_tr_ops = { .init_disas_context = avr_tr_init_disas_context, .tb_start = avr_tr_tb_start, .insn_start = avr_tr_insn_start, .translate_insn = avr_tr_translate_insn, .tb_stop = avr_tr_tb_stop, - .disas_log = avr_tr_disas_log, }; void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_insns, diff --git a/target/cris/translate.c b/target/cris/translate.c index b3a4d61d0a..b5410189d4 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -25,7 +25,6 @@ #include "qemu/osdep.h" #include "cpu.h" -#include "disas/disas.h" #include "exec/exec-all.h" #include "tcg/tcg-op.h" #include "exec/helper-proto.h" @@ -3148,22 +3147,12 @@ static void cris_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) } } -static void cris_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cpu, FILE *logfile) -{ - if (!DISAS_CRIS) { - fprintf(logfile, "IN: %s\n", lookup_symbol(dcbase->pc_first)); - target_disas(logfile, cpu, dcbase->pc_first, dcbase->tb->size); - } -} - static const TranslatorOps cris_tr_ops = { .init_disas_context = cris_tr_init_disas_context, .tb_start = cris_tr_tb_start, .insn_start = cris_tr_insn_start, .translate_insn = cris_tr_translate_insn, .tb_stop = cris_tr_tb_stop, - .disas_log = cris_tr_disas_log, }; void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_insns, diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c index c9bf0e7508..1344a3e4ab 100644 --- a/target/hexagon/translate.c +++ b/target/hexagon/translate.c @@ -1138,21 +1138,12 @@ static void hexagon_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) } } -static void hexagon_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cpu, FILE *logfile) -{ - fprintf(logfile, "IN: %s\n", lookup_symbol(dcbase->pc_first)); - target_disas(logfile, cpu, dcbase->pc_first, dcbase->tb->size); -} - - static const TranslatorOps hexagon_tr_ops = { .init_disas_context = hexagon_tr_init_disas_context, .tb_start = hexagon_tr_tb_start, .insn_start = hexagon_tr_insn_start, .translate_insn = hexagon_tr_translate_packet, .tb_stop = hexagon_tr_tb_stop, - .disas_log = hexagon_tr_disas_log, }; void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_insns, diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 42fa480950..cafba84631 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -4815,12 +4815,12 @@ static void hppa_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) } } +#ifdef CONFIG_USER_ONLY static void hppa_tr_disas_log(const DisasContextBase *dcbase, CPUState *cs, FILE *logfile) { target_ulong pc = dcbase->pc_first; -#ifdef CONFIG_USER_ONLY switch (pc) { case 0x00: fprintf(logfile, "IN:\n0x00000000: (null)\n"); @@ -4835,11 +4835,11 @@ static void hppa_tr_disas_log(const DisasContextBase *dcbase, fprintf(logfile, "IN:\n0x00000100: syscall\n"); return; } -#endif fprintf(logfile, "IN: %s\n", lookup_symbol(pc)); target_disas(logfile, cs, pc, dcbase->tb->size); } +#endif static const TranslatorOps hppa_tr_ops = { .init_disas_context = hppa_tr_init_disas_context, @@ -4847,7 +4847,9 @@ static const TranslatorOps hppa_tr_ops = { .insn_start = hppa_tr_insn_start, .translate_insn = hppa_tr_translate_insn, .tb_stop = hppa_tr_tb_stop, +#ifdef CONFIG_USER_ONLY .disas_log = hppa_tr_disas_log, +#endif }; void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_insns, diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index c05d9e5225..6658adc4bc 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -20,7 +20,6 @@ #include "qemu/host-utils.h" #include "cpu.h" -#include "disas/disas.h" #include "exec/exec-all.h" #include "tcg/tcg-op.h" #include "tcg/tcg-op-gvec.h" @@ -7074,22 +7073,12 @@ static void i386_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) } } -static void i386_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cpu, FILE *logfile) -{ - DisasContext *dc = container_of(dcbase, DisasContext, base); - - fprintf(logfile, "IN: %s\n", lookup_symbol(dc->base.pc_first)); - target_disas(logfile, cpu, dc->base.pc_first, dc->base.tb->size); -} - static const TranslatorOps i386_tr_ops = { .init_disas_context = i386_tr_init_disas_context, .tb_start = i386_tr_tb_start, .insn_start = i386_tr_insn_start, .translate_insn = i386_tr_translate_insn, .tb_stop = i386_tr_tb_stop, - .disas_log = i386_tr_disas_log, }; /* generate intermediate code for basic block 'tb'. */ diff --git a/target/loongarch/tcg/translate.c b/target/loongarch/tcg/translate.c index 7567712655..1fca4afc73 100644 --- a/target/loongarch/tcg/translate.c +++ b/target/loongarch/tcg/translate.c @@ -325,20 +325,12 @@ static void loongarch_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) } } -static void loongarch_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cpu, FILE *logfile) -{ - qemu_log("IN: %s\n", lookup_symbol(dcbase->pc_first)); - target_disas(logfile, cpu, dcbase->pc_first, dcbase->tb->size); -} - static const TranslatorOps loongarch_tr_ops = { .init_disas_context = loongarch_tr_init_disas_context, .tb_start = loongarch_tr_tb_start, .insn_start = loongarch_tr_insn_start, .translate_insn = loongarch_tr_translate_insn, .tb_stop = loongarch_tr_tb_stop, - .disas_log = loongarch_tr_disas_log, }; void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_insns, diff --git a/target/m68k/translate.c b/target/m68k/translate.c index 8a194f2f21..175762685c 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -20,7 +20,6 @@ #include "qemu/osdep.h" #include "cpu.h" -#include "disas/disas.h" #include "exec/exec-all.h" #include "tcg/tcg-op.h" #include "qemu/log.h" @@ -6063,20 +6062,12 @@ static void m68k_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) } } -static void m68k_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cpu, FILE *logfile) -{ - fprintf(logfile, "IN: %s\n", lookup_symbol(dcbase->pc_first)); - target_disas(logfile, cpu, dcbase->pc_first, dcbase->tb->size); -} - static const TranslatorOps m68k_tr_ops = { .init_disas_context = m68k_tr_init_disas_context, .tb_start = m68k_tr_tb_start, .insn_start = m68k_tr_insn_start, .translate_insn = m68k_tr_translate_insn, .tb_stop = m68k_tr_tb_stop, - .disas_log = m68k_tr_disas_log, }; void gen_intermediate_code(CPUState *cpu, TranslationBlock *tb, int *max_insns, diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index 0941aa67c0..08d98dab07 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -20,7 +20,6 @@ #include "qemu/osdep.h" #include "cpu.h" -#include "disas/disas.h" #include "exec/exec-all.h" #include "tcg/tcg-op.h" #include "exec/helper-proto.h" @@ -1771,20 +1770,12 @@ static void mb_tr_tb_stop(DisasContextBase *dcb, CPUState *cs) } } -static void mb_tr_disas_log(const DisasContextBase *dcb, - CPUState *cs, FILE *logfile) -{ - fprintf(logfile, "IN: %s\n", lookup_symbol(dcb->pc_first)); - target_disas(logfile, cs, dcb->pc_first, dcb->tb->size); -} - static const TranslatorOps mb_tr_ops = { .init_disas_context = mb_tr_init_disas_context, .tb_start = mb_tr_tb_start, .insn_start = mb_tr_insn_start, .translate_insn = mb_tr_translate_insn, .tb_stop = mb_tr_tb_stop, - .disas_log = mb_tr_disas_log, }; void gen_intermediate_code(CPUState *cpu, TranslationBlock *tb, int *max_insns, diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c index 06c108cc9c..333469b268 100644 --- a/target/mips/tcg/translate.c +++ b/target/mips/tcg/translate.c @@ -29,7 +29,6 @@ #include "exec/translation-block.h" #include "semihosting/semihost.h" #include "trace.h" -#include "disas/disas.h" #include "fpu_helper.h" #define HELPER_H "helper.h" @@ -15475,20 +15474,12 @@ static void mips_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) } } -static void mips_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cs, FILE *logfile) -{ - fprintf(logfile, "IN: %s\n", lookup_symbol(dcbase->pc_first)); - target_disas(logfile, cs, dcbase->pc_first, dcbase->tb->size); -} - static const TranslatorOps mips_tr_ops = { .init_disas_context = mips_tr_init_disas_context, .tb_start = mips_tr_tb_start, .insn_start = mips_tr_insn_start, .translate_insn = mips_tr_translate_insn, .tb_stop = mips_tr_tb_stop, - .disas_log = mips_tr_disas_log, }; void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_insns, diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c index 23fff46084..ca566847cb 100644 --- a/target/openrisc/translate.c +++ b/target/openrisc/translate.c @@ -21,7 +21,6 @@ #include "qemu/osdep.h" #include "cpu.h" #include "exec/exec-all.h" -#include "disas/disas.h" #include "tcg/tcg-op.h" #include "qemu/log.h" #include "qemu/bitops.h" @@ -1638,22 +1637,12 @@ static void openrisc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) } } -static void openrisc_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cs, FILE *logfile) -{ - DisasContext *s = container_of(dcbase, DisasContext, base); - - fprintf(logfile, "IN: %s\n", lookup_symbol(s->base.pc_first)); - target_disas(logfile, cs, s->base.pc_first, s->base.tb->size); -} - static const TranslatorOps openrisc_tr_ops = { .init_disas_context = openrisc_tr_init_disas_context, .tb_start = openrisc_tr_tb_start, .insn_start = openrisc_tr_insn_start, .translate_insn = openrisc_tr_translate_insn, .tb_stop = openrisc_tr_tb_stop, - .disas_log = openrisc_tr_disas_log, }; void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_insns, diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 93ffec787c..49dee6cab0 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -21,7 +21,6 @@ #include "qemu/osdep.h" #include "cpu.h" #include "internal.h" -#include "disas/disas.h" #include "exec/exec-all.h" #include "tcg/tcg-op.h" #include "tcg/tcg-op-gvec.h" @@ -7405,20 +7404,12 @@ static void ppc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) } } -static void ppc_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cs, FILE *logfile) -{ - fprintf(logfile, "IN: %s\n", lookup_symbol(dcbase->pc_first)); - target_disas(logfile, cs, dcbase->pc_first, dcbase->tb->size); -} - static const TranslatorOps ppc_tr_ops = { .init_disas_context = ppc_tr_init_disas_context, .tb_start = ppc_tr_tb_start, .insn_start = ppc_tr_insn_start, .translate_insn = ppc_tr_translate_insn, .tb_stop = ppc_tr_tb_stop, - .disas_log = ppc_tr_disas_log, }; void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_insns, diff --git a/target/riscv/translate.c b/target/riscv/translate.c index 9ff09ebdb6..c999e942e1 100644 --- a/target/riscv/translate.c +++ b/target/riscv/translate.c @@ -20,7 +20,6 @@ #include "qemu/log.h" #include "cpu.h" #include "tcg/tcg-op.h" -#include "disas/disas.h" #include "exec/cpu_ldst.h" #include "exec/exec-all.h" #include "exec/helper-proto.h" @@ -1270,29 +1269,12 @@ static void riscv_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) } } -static void riscv_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cpu, FILE *logfile) -{ -#ifndef CONFIG_USER_ONLY - RISCVCPU *rvcpu = RISCV_CPU(cpu); - CPURISCVState *env = &rvcpu->env; -#endif - - fprintf(logfile, "IN: %s\n", lookup_symbol(dcbase->pc_first)); -#ifndef CONFIG_USER_ONLY - fprintf(logfile, "Priv: "TARGET_FMT_ld"; Virt: %d\n", - env->priv, env->virt_enabled); -#endif - target_disas(logfile, cpu, dcbase->pc_first, dcbase->tb->size); -} - static const TranslatorOps riscv_tr_ops = { .init_disas_context = riscv_tr_init_disas_context, .tb_start = riscv_tr_tb_start, .insn_start = riscv_tr_insn_start, .translate_insn = riscv_tr_translate_insn, .tb_stop = riscv_tr_tb_stop, - .disas_log = riscv_tr_disas_log, }; void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_insns, diff --git a/target/rx/translate.c b/target/rx/translate.c index f6e9e0ec90..92fb2b43ad 100644 --- a/target/rx/translate.c +++ b/target/rx/translate.c @@ -2247,20 +2247,12 @@ static void rx_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) } } -static void rx_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cs, FILE *logfile) -{ - fprintf(logfile, "IN: %s\n", lookup_symbol(dcbase->pc_first)); - target_disas(logfile, cs, dcbase->pc_first, dcbase->tb->size); -} - static const TranslatorOps rx_tr_ops = { .init_disas_context = rx_tr_init_disas_context, .tb_start = rx_tr_tb_start, .insn_start = rx_tr_insn_start, .translate_insn = rx_tr_translate_insn, .tb_stop = rx_tr_tb_stop, - .disas_log = rx_tr_disas_log, }; void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_insns, diff --git a/target/sh4/translate.c b/target/sh4/translate.c index ebb6c901bf..da5b6f046f 100644 --- a/target/sh4/translate.c +++ b/target/sh4/translate.c @@ -19,7 +19,6 @@ #include "qemu/osdep.h" #include "cpu.h" -#include "disas/disas.h" #include "exec/exec-all.h" #include "tcg/tcg-op.h" #include "exec/helper-proto.h" @@ -2301,20 +2300,12 @@ static void sh4_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) } } -static void sh4_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cs, FILE *logfile) -{ - fprintf(logfile, "IN: %s\n", lookup_symbol(dcbase->pc_first)); - target_disas(logfile, cs, dcbase->pc_first, dcbase->tb->size); -} - static const TranslatorOps sh4_tr_ops = { .init_disas_context = sh4_tr_init_disas_context, .tb_start = sh4_tr_tb_start, .insn_start = sh4_tr_insn_start, .translate_insn = sh4_tr_translate_insn, .tb_stop = sh4_tr_tb_stop, - .disas_log = sh4_tr_disas_log, }; void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_insns, diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 571b3e3f03..dd99be0e04 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -21,7 +21,6 @@ #include "qemu/osdep.h" #include "cpu.h" -#include "disas/disas.h" #include "exec/helper-proto.h" #include "exec/exec-all.h" #include "tcg/tcg-op.h" @@ -5042,20 +5041,12 @@ static void sparc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) } } -static void sparc_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cpu, FILE *logfile) -{ - fprintf(logfile, "IN: %s\n", lookup_symbol(dcbase->pc_first)); - target_disas(logfile, cpu, dcbase->pc_first, dcbase->tb->size); -} - static const TranslatorOps sparc_tr_ops = { .init_disas_context = sparc_tr_init_disas_context, .tb_start = sparc_tr_tb_start, .insn_start = sparc_tr_insn_start, .translate_insn = sparc_tr_translate_insn, .tb_stop = sparc_tr_tb_stop, - .disas_log = sparc_tr_disas_log, }; void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_insns, diff --git a/target/tricore/translate.c b/target/tricore/translate.c index c45e1d992e..a46a03e1fd 100644 --- a/target/tricore/translate.c +++ b/target/tricore/translate.c @@ -20,7 +20,6 @@ #include "qemu/osdep.h" #include "cpu.h" -#include "disas/disas.h" #include "exec/exec-all.h" #include "tcg/tcg-op.h" #include "exec/cpu_ldst.h" @@ -8453,20 +8452,12 @@ static void tricore_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) } } -static void tricore_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cpu, FILE *logfile) -{ - fprintf(logfile, "IN: %s\n", lookup_symbol(dcbase->pc_first)); - target_disas(logfile, cpu, dcbase->pc_first, dcbase->tb->size); -} - static const TranslatorOps tricore_tr_ops = { .init_disas_context = tricore_tr_init_disas_context, .tb_start = tricore_tr_tb_start, .insn_start = tricore_tr_insn_start, .translate_insn = tricore_tr_translate_insn, .tb_stop = tricore_tr_tb_stop, - .disas_log = tricore_tr_disas_log, }; diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index b206d57fc4..42109d33ad 100644 --- a/target/xtensa/translate.c +++ b/target/xtensa/translate.c @@ -32,7 +32,6 @@ #include "cpu.h" #include "exec/exec-all.h" -#include "disas/disas.h" #include "tcg/tcg-op.h" #include "qemu/log.h" #include "qemu/qemu-print.h" @@ -1221,20 +1220,12 @@ static void xtensa_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) } } -static void xtensa_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cpu, FILE *logfile) -{ - fprintf(logfile, "IN: %s\n", lookup_symbol(dcbase->pc_first)); - target_disas(logfile, cpu, dcbase->pc_first, dcbase->tb->size); -} - static const TranslatorOps xtensa_translator_ops = { .init_disas_context = xtensa_tr_init_disas_context, .tb_start = xtensa_tr_tb_start, .insn_start = xtensa_tr_insn_start, .translate_insn = xtensa_tr_translate_insn, .tb_stop = xtensa_tr_tb_stop, - .disas_log = xtensa_tr_disas_log, }; void gen_intermediate_code(CPUState *cpu, TranslationBlock *tb, int *max_insns, From patchwork Wed Apr 24 23:31:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791609 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1107555wrq; Wed, 24 Apr 2024 16:36:37 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWr2DyRi/oiE0vl1/urjRhGiZxRlsSR73CLce9daekd8EJXpHFxV8YBWE9F8kzip5wZZHEDRystnrw+2cMh47Dk X-Google-Smtp-Source: AGHT+IEOtUAJH6Yk2jgWHKLkwovJRb7YT9eNRstR17+zqKiziP5hQGd03MHxkApM7TelzORQbf76 X-Received: by 2002:a0c:f749:0:b0:699:3883:5474 with SMTP id e9-20020a0cf749000000b0069938835474mr4310670qvo.33.1714001797100; Wed, 24 Apr 2024 16:36:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714001797; cv=none; d=google.com; s=arc-20160816; b=MfMbHPw3HAUNg+51pPTRF7PAHPnAqEv+Td1zJEIZAAQQfjB0jjoLBMzBJbjsfbz44O 3oIurdKBYv2dGaZOrrmpaRJ3dqCvDHzrFTr+r9RmnIJKSnuxYcPW1pyjQkQOGdk6MHE2 mgPQMlxuTbCtWmgtgySn+2ed3AusAcgfDdLC6KYdCQjbwUy5vaTnBM2Tgkdf3zKQp/Ub 2Ms4l6IcoPSLeNCjkh/aRE2nmImaNIFutS6G8+lkw11TUV2qd+c3V0EMPAjVAg5Hevmd w4HOdIgxXm27AVGG9brfMeF7N6mlfAzQrXJKbTLIctPliQ2k1lCTZV+p91B6DMW1MZIO dYYg== 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=udtyyROxDVvgFlN2ODG5uKnex/HkXV/I+K4Ewok5QlI=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=OIDAGq8HTUkzMn00Pp7nRBizMHeGYw4fM1nQChTqSwnN3dtrM0x5HV+pZmJj6+dBO/ ciuEeLiHtPY8yihMMDfLiLm6erIxS3K/nxbcyP4nljwoJXHCgXKbbF5zydeZTEOEJQxt QHu5P1/Z9fp8Mj3S7GYH0lwgmM83KGNFI/mFQtdh46qDJp2JKUQ3nTTeRR5j1RRitGBO f/BbAIL1ir4zZBbMBeTYIRpP9mjcosDM2uCbOQgSzbplbnlBp9jGxAfHacQG09frAJwf s6IM3dGBzerA9damzyBZR19PgAeaOp618F8K1+IUDP7FiB9z0TDAE4vJTQjrSdCmFDA2 alrA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GoE+Q51W; 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 e8-20020a0562140d8800b006993226cc11si16245420qve.566.2024.04.24.16.36.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:36:37 -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=GoE+Q51W; 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 1rzm5j-0005wX-Fj; Wed, 24 Apr 2024 19:31:55 -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 1rzm5f-0005qv-0U for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:51 -0400 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzm5d-0003Tq-9g for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:50 -0400 Received: by mail-pg1-x52a.google.com with SMTP id 41be03b00d2f7-5f415fd71f8so323808a12.3 for ; Wed, 24 Apr 2024 16:31:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714001508; x=1714606308; 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=udtyyROxDVvgFlN2ODG5uKnex/HkXV/I+K4Ewok5QlI=; b=GoE+Q51WpgP+TesOQfrnXUYuEV2e7QIn0K2udoQNFJhEoyMEpbSjHEBL3NE7ZABwg5 jPEkAHc9aOlND5PE+CTyWzK/K0CXFOmymDHEsAND8UjrnWiXepMfnLbva8osZZQEXrRv Q1huEvn8gXP6g8YqE9ij+TdPVndVzqKDO/Vi9uDKPvMYV0AV/Qxz840GFkizm9jg8N4T 6uLAUw1Ezdt7cvEjlKDQECdIhDIOxIrD/HstzkQxNra4Pup4Sn7x0i7S2k9bMPF4fe2K M7vvZIzfvySFgePA2aEUd4csVWaUKs2VH/yOveTmodjrkl4EVEN5eA6TnhThzecqc4LA NPfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714001508; x=1714606308; 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=udtyyROxDVvgFlN2ODG5uKnex/HkXV/I+K4Ewok5QlI=; b=eFJ036VD7Ll2/ghtpDOD7talZvCPNdalcRfgUaRmA81I/iEuiulELFOhFy71r68Hjg u8FkPFH5McGu8ITEXgfwKscte3u0CN5BJkxRiZzX+UeheDNkPxQeJXI4PXAIsgtGKZoQ HwF0zDW0oJy5V/vw8b3Ia9f1FShwnCxEL3iJyKoyvk5Skn1UXa0Bre2ofFvJYBuRekcS CjkJc5hpumVaJvAEtU0NsOpcPKqyyrucv8WBYHuH/iK9zklHIgl1XyweUzKqptSu+fzb Tin877plGLJcjfFxo9jDhcWU1+QNSJAnfdPXYhGtE3KpDRyE9YDtqg+nFPuWA7vkyoP2 Gq1Q== X-Gm-Message-State: AOJu0YwJLDCZtXvE/pSWgoAAjojtqScm88/UINuOW17vH6jScgp5cQBC Ad9F7GFu/OxBFgdT6UP2GgmlUItNb3rcM9zIkHnaQZQk7JpHlahae8waiPESjyIlFK23mae1V84 z X-Received: by 2002:a05:6a20:6a1d:b0:1a9:85a0:afeb with SMTP id p29-20020a056a206a1d00b001a985a0afebmr4562937pzk.20.1714001507978; Wed, 24 Apr 2024 16:31:47 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id z24-20020a17090abd9800b002a56b3931dfsm11737859pjr.49.2024.04.24.16.31.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:31:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 17/33] accel/tcg: Return bool from TranslatorOps.disas_log Date: Wed, 24 Apr 2024 16:31:15 -0700 Message-Id: <20240424233131.988727-18-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::52a; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52a.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 have eliminated most uses of this hook. Reduce further by allowing the hook to handle only the special cases, returning false for normal processing. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- include/exec/translator.h | 2 +- accel/tcg/translator.c | 5 ++--- target/hppa/translate.c | 15 ++++++--------- target/s390x/tcg/translate.c | 8 +++----- 4 files changed, 12 insertions(+), 18 deletions(-) diff --git a/include/exec/translator.h b/include/exec/translator.h index 3c354a4310..bd76d6446b 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -135,7 +135,7 @@ typedef struct TranslatorOps { void (*insn_start)(DisasContextBase *db, CPUState *cpu); void (*translate_insn)(DisasContextBase *db, CPUState *cpu); void (*tb_stop)(DisasContextBase *db, CPUState *cpu); - void (*disas_log)(const DisasContextBase *db, CPUState *cpu, FILE *f); + bool (*disas_log)(const DisasContextBase *db, CPUState *cpu, FILE *f); } TranslatorOps; /** diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index db586b894a..8e8c4e1bf8 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -227,9 +227,8 @@ void translator_loop(CPUState *cpu, TranslationBlock *tb, int *max_insns, if (logfile) { fprintf(logfile, "----------------\n"); - if (ops->disas_log) { - ops->disas_log(db, cpu, logfile); - } else { + if (!ops->disas_log || + !ops->disas_log(db, cpu, logfile)) { fprintf(logfile, "IN: %s\n", lookup_symbol(db->pc_first)); target_disas(logfile, cpu, db->pc_first, db->tb->size); } diff --git a/target/hppa/translate.c b/target/hppa/translate.c index cafba84631..e8a542c039 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -19,7 +19,6 @@ #include "qemu/osdep.h" #include "cpu.h" -#include "disas/disas.h" #include "qemu/host-utils.h" #include "exec/exec-all.h" #include "tcg/tcg-op.h" @@ -4816,7 +4815,7 @@ static void hppa_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) } #ifdef CONFIG_USER_ONLY -static void hppa_tr_disas_log(const DisasContextBase *dcbase, +static bool hppa_tr_disas_log(const DisasContextBase *dcbase, CPUState *cs, FILE *logfile) { target_ulong pc = dcbase->pc_first; @@ -4824,20 +4823,18 @@ static void hppa_tr_disas_log(const DisasContextBase *dcbase, switch (pc) { case 0x00: fprintf(logfile, "IN:\n0x00000000: (null)\n"); - return; + return true; case 0xb0: fprintf(logfile, "IN:\n0x000000b0: light-weight-syscall\n"); - return; + return true; case 0xe0: fprintf(logfile, "IN:\n0x000000e0: set-thread-pointer-syscall\n"); - return; + return true; case 0x100: fprintf(logfile, "IN:\n0x00000100: syscall\n"); - return; + return true; } - - fprintf(logfile, "IN: %s\n", lookup_symbol(pc)); - target_disas(logfile, cs, pc, dcbase->tb->size); + return false; } #endif diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index 6d7f6e7064..d74939389a 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -31,7 +31,6 @@ #include "qemu/osdep.h" #include "cpu.h" #include "s390x-internal.h" -#include "disas/disas.h" #include "exec/exec-all.h" #include "tcg/tcg-op.h" #include "tcg/tcg-op-gvec.h" @@ -6520,7 +6519,7 @@ static void s390x_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) } } -static void s390x_tr_disas_log(const DisasContextBase *dcbase, +static bool s390x_tr_disas_log(const DisasContextBase *dcbase, CPUState *cs, FILE *logfile) { DisasContext *dc = container_of(dcbase, DisasContext, base); @@ -6528,10 +6527,9 @@ static void s390x_tr_disas_log(const DisasContextBase *dcbase, if (unlikely(dc->ex_value)) { /* ??? Unfortunately target_disas can't use host memory. */ fprintf(logfile, "IN: EXECUTE %016" PRIx64, dc->ex_value); - } else { - fprintf(logfile, "IN: %s\n", lookup_symbol(dc->base.pc_first)); - target_disas(logfile, cs, dc->base.pc_first, dc->base.tb->size); + return true; } + return false; } static const TranslatorOps s390x_tr_ops = { From patchwork Wed Apr 24 23:31:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791605 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1107394wrq; Wed, 24 Apr 2024 16:36:10 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW0ggFwN/NsrQGJiiY7Ez4+qz3r5yk1+R66kHCMfGvybU6m9800lq9q8vx3Qof4qfxomArEjpYU51LjJ86XQQ14 X-Google-Smtp-Source: AGHT+IGIZpADQ2ZIB/aMj+T1ihYE4JZokWwyIrL56WibxUMPTHi0Qbh9w36BKY4CSzrHwaJEc4MN X-Received: by 2002:ac8:5d86:0:b0:43a:e53:4060 with SMTP id d6-20020ac85d86000000b0043a0e534060mr4581790qtx.19.1714001770652; Wed, 24 Apr 2024 16:36:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714001770; cv=none; d=google.com; s=arc-20160816; b=QnwmH3i1XhJl3mrf3RZeAempILS6U8a6WLJPpfvo5xauikaLfRxrUINyWbCyJQ3pcT dJzS/dwtamwowJMBNvMDBGrSj+pOxY4rzVPFepEOOX1NXaXghT9AF5iF1DUlvF8htKly orBMk8bnY3YM8sYl+VSBrRvjr6nR/gymLB56lE68Jr1oNS/MTQd8eli4qzfmS415R9Z8 uiAzY9Csct9si8YsBHqj9YV1zj6ryzs2J1mQFThlMxddDnuLMfRQ77sFXbCc0GP5cTL9 R0sYFFfkhwZjCynommhR4tTNMslNozeqkiwiCdypnH/HlNslUprUS7IMDdgDXUQDNukL wd2A== 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:to:from :dkim-signature; bh=Pp0+YXVT5Ke/IjF6zfAube67/o8HFdzfuGERssKOo+k=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=CSFH1c/46s15I1mGSQ5+JP3FtIj9PSFuB+xCgOBE5df0gd12mT8Q3qmOZAJOIJqSHY EF6ra7Hl6psX90ZRsAXzzL9+i/0xnurmtWzfbpHt4004Yx0IuOtKfSk5oC0CwbduqKcz +HuW90eMV+5KF0ZMkoWmtFNs+qyUs8YDVgIYJExJDZdbou30rP1nhgZSTgJJC2rrFCrY T0eG/IkQIviuanYftaUc/yF3cbqJkmNOyTpDe2ZOaLI8OYZCqQ0jc2jJ3VHfXQ77nUh2 1NFh7LPte6GiaKkZkdcJSj7jsCotHW+L8Tyw3r42rtQkB/+gCjBppOuv51CFZSql3L1W wIKQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zK9oWMuE; 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 dr7-20020a05622a528700b00432de20772dsi13081850qtb.584.2024.04.24.16.36.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:36:10 -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=zK9oWMuE; 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 1rzm5n-0005yZ-Ry; Wed, 24 Apr 2024 19:31:59 -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 1rzm5i-0005v4-89 for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:54 -0400 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzm5e-0003UE-Kl for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:53 -0400 Received: by mail-pj1-x1030.google.com with SMTP id 98e67ed59e1d1-2a614b0391dso372881a91.1 for ; Wed, 24 Apr 2024 16:31:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714001509; x=1714606309; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Pp0+YXVT5Ke/IjF6zfAube67/o8HFdzfuGERssKOo+k=; b=zK9oWMuEfKM8XOvGyfIxpMlLgMZ97++8n5780qBW6WfCUSHGMsCmIn/I/saiZ80lRq QBiUNZcwLwI/gNcKG7s22WbK17YOpBgrvSnkcmpCtVljIRAkpHgG1uMzu7/I/8jQ8pe8 9poA+D+1J42ZRslsDQ/VSncUXMCqVMGZBaxlYVJgClKfIV/XTP0r3H9GsgSk/moxuQD3 z9YpiPgv6YfofQwhplqy92NpeNWeiecKigrJuR2IOTrCy/JbGkfoMMBc6mkSCxoLe91M O7+DSGqXS8zTTFp0kqZsSEv4D3AzrqOHBJSPUc0SVLN5gpaHq9o+i1VDjWaOqlUuwVnf Pp7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714001509; x=1714606309; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Pp0+YXVT5Ke/IjF6zfAube67/o8HFdzfuGERssKOo+k=; b=NWcpN/DCoNObTwjDYGobbePTkWxpHKMQERAxcKLzNI7h81vAEBqxBXbW2gY9uSkzhg 8fScshG9/CfVZIfERCx7QvpNm9H+i8rcwpCs/SnW5PkXnI2cCzZUcytA9D/T902N872B 48Bi6Zvlz4VzIECe3XYfQR1KgjmCkeKDoVCmnApnu7Uvdnxd3iIQqKTyueJ7okPk3Sj9 Yv7ktUXxuFtbEMttWH5bEvhTyS1VEa/G6egzq5KMGG/QWgn998eSwEvLbaGOG7E1BRMH WCnXlhy4KyOOTyZ8h/o/819adhSnQW3+bF377eIa2/EfNw/EQqYbBBe30stTTcvgEfQj KdQA== X-Gm-Message-State: AOJu0YyL5I5pstNdG1TL0yKodoYXDvFNIPUJPjSMtvDRw9PuR6DLj2C/ 05aR1Hzm4x18os4UGdai5CQhQEXp+4qvHJYqGF2bhQ853Nr87FWAxqK2BhofW4GfQ+Seelxg21k r X-Received: by 2002:a17:90b:3506:b0:2a7:e71:eb72 with SMTP id ls6-20020a17090b350600b002a70e71eb72mr4117027pjb.0.1714001508870; Wed, 24 Apr 2024 16:31:48 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id z24-20020a17090abd9800b002a56b3931dfsm11737859pjr.49.2024.04.24.16.31.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:31:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 18/33] disas: Split disas.c Date: Wed, 24 Apr 2024 16:31:16 -0700 Message-Id: <20240424233131.988727-19-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::1030; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1030.google.com X-Spam_score_int: 0 X-Spam_score: -0.1 X-Spam_bar: / X-Spam_report: (-0.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, PDS_OTHER_BAD_TLD=1.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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 The routines in disas-common.c are also used from disas-mon.c. Otherwise the rest of disassembly is only used from tcg. While we're at it, put host and target code into separate files. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- disas/disas-internal.h | 4 + include/disas/disas.h | 4 + disas/disas-common.c | 117 ++++++++++++++ disas/disas-host.c | 129 ++++++++++++++++ disas/disas-target.c | 84 ++++++++++ disas/disas.c | 337 ----------------------------------------- disas/objdump.c | 37 +++++ disas/meson.build | 8 +- 8 files changed, 381 insertions(+), 339 deletions(-) create mode 100644 disas/disas-common.c create mode 100644 disas/disas-host.c create mode 100644 disas/disas-target.c delete mode 100644 disas/disas.c create mode 100644 disas/objdump.c diff --git a/disas/disas-internal.h b/disas/disas-internal.h index 84a01f126f..ed32e704cc 100644 --- a/disas/disas-internal.h +++ b/disas/disas-internal.h @@ -14,8 +14,12 @@ typedef struct CPUDebug { CPUState *cpu; } CPUDebug; +void disas_initialize_debug(CPUDebug *s); void disas_initialize_debug_target(CPUDebug *s, CPUState *cpu); int disas_gstring_printf(FILE *stream, const char *fmt, ...) G_GNUC_PRINTF(2, 3); +int print_insn_od_host(bfd_vma pc, disassemble_info *info); +int print_insn_od_target(bfd_vma pc, disassemble_info *info); + #endif diff --git a/include/disas/disas.h b/include/disas/disas.h index 176775eff7..54a5e68443 100644 --- a/include/disas/disas.h +++ b/include/disas/disas.h @@ -2,13 +2,17 @@ #define QEMU_DISAS_H /* Disassemble this for me please... (debugging). */ +#ifdef CONFIG_TCG void disas(FILE *out, const void *code, size_t size); void target_disas(FILE *out, CPUState *cpu, uint64_t code, size_t size); +#endif void monitor_disas(Monitor *mon, CPUState *cpu, uint64_t pc, int nb_insn, bool is_physical); +#ifdef CONFIG_PLUGIN char *plugin_disas(CPUState *cpu, uint64_t addr, size_t size); +#endif /* Look up symbol for debugging purpose. Returns "" if unknown. */ const char *lookup_symbol(uint64_t orig_addr); diff --git a/disas/disas-common.c b/disas/disas-common.c new file mode 100644 index 0000000000..e4118a381f --- /dev/null +++ b/disas/disas-common.c @@ -0,0 +1,117 @@ +/* + * Common routines for disassembly. + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "disas/disas.h" +#include "disas/capstone.h" +#include "hw/core/cpu.h" +#include "exec/memory.h" +#include "disas-internal.h" + + +/* Filled in by elfload.c. Simplistic, but will do for now. */ +struct syminfo *syminfos = NULL; + +/* + * Get LENGTH bytes from info's buffer, at target address memaddr. + * Transfer them to myaddr. + */ +static int target_read_memory(bfd_vma memaddr, bfd_byte *myaddr, int length, + struct disassemble_info *info) +{ + CPUDebug *s = container_of(info, CPUDebug, info); + int r = cpu_memory_rw_debug(s->cpu, memaddr, myaddr, length, 0); + return r ? EIO : 0; +} + +/* + * Print an error message. We can assume that this is in response to + * an error return from {host,target}_read_memory. + */ +static void perror_memory(int status, bfd_vma memaddr, + struct disassemble_info *info) +{ + if (status != EIO) { + /* Can't happen. */ + info->fprintf_func(info->stream, "Unknown error %d\n", status); + } else { + /* Address between memaddr and memaddr + len was out of bounds. */ + info->fprintf_func(info->stream, + "Address 0x%" PRIx64 " is out of bounds.\n", + memaddr); + } +} + +/* Print address in hex. */ +static void print_address(bfd_vma addr, struct disassemble_info *info) +{ + info->fprintf_func(info->stream, "0x%" PRIx64, addr); +} + +/* Stub prevents some fruitless earching in optabs disassemblers. */ +static int symbol_at_address(bfd_vma addr, struct disassemble_info *info) +{ + return 1; +} + +void disas_initialize_debug(CPUDebug *s) +{ + memset(s, 0, sizeof(*s)); + s->info.arch = bfd_arch_unknown; + s->info.cap_arch = -1; + s->info.cap_insn_unit = 4; + s->info.cap_insn_split = 4; + s->info.memory_error_func = perror_memory; + s->info.symbol_at_address_func = symbol_at_address; +} + +void disas_initialize_debug_target(CPUDebug *s, CPUState *cpu) +{ + disas_initialize_debug(s); + + s->cpu = cpu; + s->info.read_memory_func = target_read_memory; + s->info.print_address_func = print_address; + if (target_words_bigendian()) { + s->info.endian = BFD_ENDIAN_BIG; + } else { + s->info.endian = BFD_ENDIAN_LITTLE; + } + + CPUClass *cc = CPU_GET_CLASS(cpu); + if (cc->disas_set_info) { + cc->disas_set_info(cpu, &s->info); + } +} + +int disas_gstring_printf(FILE *stream, const char *fmt, ...) +{ + /* We abuse the FILE parameter to pass a GString. */ + GString *s = (GString *)stream; + int initial_len = s->len; + va_list va; + + va_start(va, fmt); + g_string_append_vprintf(s, fmt, va); + va_end(va); + + return s->len - initial_len; +} + +/* Look up symbol for debugging purpose. Returns "" if unknown. */ +const char *lookup_symbol(uint64_t orig_addr) +{ + const char *symbol = ""; + struct syminfo *s; + + for (s = syminfos; s; s = s->next) { + symbol = s->lookup_symbol(s, orig_addr); + if (symbol[0] != '\0') { + break; + } + } + + return symbol; +} diff --git a/disas/disas-host.c b/disas/disas-host.c new file mode 100644 index 0000000000..8146fafe80 --- /dev/null +++ b/disas/disas-host.c @@ -0,0 +1,129 @@ +/* + * Routines for host instruction disassembly. + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "disas/disas.h" +#include "disas/capstone.h" +#include "disas-internal.h" + + +/* + * Get LENGTH bytes from info's buffer, at host address memaddr. + * Transfer them to myaddr. + */ +static int host_read_memory(bfd_vma memaddr, bfd_byte *myaddr, int length, + struct disassemble_info *info) +{ + if (memaddr < info->buffer_vma + || memaddr + length > info->buffer_vma + info->buffer_length) { + /* Out of bounds. Use EIO because GDB uses it. */ + return EIO; + } + memcpy (myaddr, info->buffer + (memaddr - info->buffer_vma), length); + return 0; +} + +/* Print address in hex, truncated to the width of a host virtual address. */ +static void host_print_address(bfd_vma addr, struct disassemble_info *info) +{ + info->fprintf_func(info->stream, "0x%" PRIxPTR, (uintptr_t)addr); +} + +static void initialize_debug_host(CPUDebug *s) +{ + disas_initialize_debug(s); + + s->info.read_memory_func = host_read_memory; + s->info.print_address_func = host_print_address; +#if HOST_BIG_ENDIAN + s->info.endian = BFD_ENDIAN_BIG; +#else + s->info.endian = BFD_ENDIAN_LITTLE; +#endif +#if defined(CONFIG_TCG_INTERPRETER) + s->info.print_insn = print_insn_tci; +#elif defined(__i386__) + s->info.mach = bfd_mach_i386_i386; + s->info.cap_arch = CS_ARCH_X86; + s->info.cap_mode = CS_MODE_32; + s->info.cap_insn_unit = 1; + s->info.cap_insn_split = 8; +#elif defined(__x86_64__) + s->info.mach = bfd_mach_x86_64; + s->info.cap_arch = CS_ARCH_X86; + s->info.cap_mode = CS_MODE_64; + s->info.cap_insn_unit = 1; + s->info.cap_insn_split = 8; +#elif defined(_ARCH_PPC) + s->info.cap_arch = CS_ARCH_PPC; +# ifdef _ARCH_PPC64 + s->info.cap_mode = CS_MODE_64; +# endif +#elif defined(__riscv) +#if defined(_ILP32) || (__riscv_xlen == 32) + s->info.print_insn = print_insn_riscv32; +#elif defined(_LP64) + s->info.print_insn = print_insn_riscv64; +#else +#error unsupported RISC-V ABI +#endif +#elif defined(__aarch64__) + s->info.cap_arch = CS_ARCH_ARM64; +#elif defined(__alpha__) + s->info.print_insn = print_insn_alpha; +#elif defined(__sparc__) + s->info.print_insn = print_insn_sparc; + s->info.mach = bfd_mach_sparc_v9b; +#elif defined(__arm__) + /* TCG only generates code for arm mode. */ + s->info.cap_arch = CS_ARCH_ARM; +#elif defined(__MIPSEB__) + s->info.print_insn = print_insn_big_mips; +#elif defined(__MIPSEL__) + s->info.print_insn = print_insn_little_mips; +#elif defined(__m68k__) + s->info.print_insn = print_insn_m68k; +#elif defined(__s390__) + s->info.cap_arch = CS_ARCH_SYSZ; + s->info.cap_insn_unit = 2; + s->info.cap_insn_split = 6; +#elif defined(__hppa__) + s->info.print_insn = print_insn_hppa; +#elif defined(__loongarch__) + s->info.print_insn = print_insn_loongarch; +#endif +} + +/* Disassemble this for me please... (debugging). */ +void disas(FILE *out, const void *code, size_t size) +{ + uintptr_t pc; + int count; + CPUDebug s; + + initialize_debug_host(&s); + s.info.fprintf_func = fprintf; + s.info.stream = out; + s.info.buffer = code; + s.info.buffer_vma = (uintptr_t)code; + s.info.buffer_length = size; + s.info.show_opcodes = true; + + if (s.info.cap_arch >= 0 && cap_disas_host(&s.info, code, size)) { + return; + } + + if (s.info.print_insn == NULL) { + s.info.print_insn = print_insn_od_host; + } + for (pc = (uintptr_t)code; size > 0; pc += count, size -= count) { + fprintf(out, "0x%08" PRIxPTR ": ", pc); + count = s.info.print_insn(pc, &s.info); + fprintf(out, "\n"); + if (count < 0) { + break; + } + } +} diff --git a/disas/disas-target.c b/disas/disas-target.c new file mode 100644 index 0000000000..82313b2a67 --- /dev/null +++ b/disas/disas-target.c @@ -0,0 +1,84 @@ +/* + * Routines for target instruction disassembly. + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "disas/disas.h" +#include "disas/capstone.h" +#include "disas-internal.h" + + +void target_disas(FILE *out, CPUState *cpu, uint64_t code, size_t size) +{ + uint64_t pc; + int count; + CPUDebug s; + + disas_initialize_debug_target(&s, cpu); + s.info.fprintf_func = fprintf; + s.info.stream = out; + s.info.buffer_vma = code; + s.info.buffer_length = size; + s.info.show_opcodes = true; + + if (s.info.cap_arch >= 0 && cap_disas_target(&s.info, code, size)) { + return; + } + + if (s.info.print_insn == NULL) { + s.info.print_insn = print_insn_od_target; + } + + for (pc = code; size > 0; pc += count, size -= count) { + fprintf(out, "0x%08" PRIx64 ": ", pc); + count = s.info.print_insn(pc, &s.info); + fprintf(out, "\n"); + if (count < 0) { + break; + } + if (size < count) { + fprintf(out, + "Disassembler disagrees with translator over instruction " + "decoding\n" + "Please report this to qemu-devel@nongnu.org\n"); + break; + } + } +} + +#ifdef CONFIG_PLUGIN +static void plugin_print_address(bfd_vma addr, struct disassemble_info *info) +{ + /* does nothing */ +} + +/* + * We should only be dissembling one instruction at a time here. If + * there is left over it usually indicates the front end has read more + * bytes than it needed. + */ +char *plugin_disas(CPUState *cpu, uint64_t addr, size_t size) +{ + CPUDebug s; + GString *ds = g_string_new(NULL); + + disas_initialize_debug_target(&s, cpu); + s.info.fprintf_func = disas_gstring_printf; + s.info.stream = (FILE *)ds; /* abuse this slot */ + s.info.buffer_vma = addr; + s.info.buffer_length = size; + s.info.print_address_func = plugin_print_address; + + if (s.info.cap_arch >= 0 && cap_disas_plugin(&s.info, addr, size)) { + ; /* done */ + } else if (s.info.print_insn) { + s.info.print_insn(addr, &s.info); + } else { + ; /* cannot disassemble -- return empty string */ + } + + /* Return the buffer, freeing the GString container. */ + return g_string_free(ds, false); +} +#endif /* CONFIG_PLUGIN */ diff --git a/disas/disas.c b/disas/disas.c deleted file mode 100644 index 7e3b0bb46c..0000000000 --- a/disas/disas.c +++ /dev/null @@ -1,337 +0,0 @@ -/* General "disassemble this chunk" code. Used for debugging. */ -#include "qemu/osdep.h" -#include "disas/disas-internal.h" -#include "elf.h" -#include "qemu/qemu-print.h" -#include "disas/disas.h" -#include "disas/capstone.h" -#include "hw/core/cpu.h" -#include "exec/memory.h" - -/* Filled in by elfload.c. Simplistic, but will do for now. */ -struct syminfo *syminfos = NULL; - -/* - * Get LENGTH bytes from info's buffer, at host address memaddr. - * Transfer them to myaddr. - */ -static int host_read_memory(bfd_vma memaddr, bfd_byte *myaddr, int length, - struct disassemble_info *info) -{ - if (memaddr < info->buffer_vma - || memaddr + length > info->buffer_vma + info->buffer_length) { - /* Out of bounds. Use EIO because GDB uses it. */ - return EIO; - } - memcpy (myaddr, info->buffer + (memaddr - info->buffer_vma), length); - return 0; -} - -/* - * Get LENGTH bytes from info's buffer, at target address memaddr. - * Transfer them to myaddr. - */ -static int target_read_memory(bfd_vma memaddr, bfd_byte *myaddr, int length, - struct disassemble_info *info) -{ - CPUDebug *s = container_of(info, CPUDebug, info); - int r = cpu_memory_rw_debug(s->cpu, memaddr, myaddr, length, 0); - return r ? EIO : 0; -} - -/* - * Print an error message. We can assume that this is in response to - * an error return from {host,target}_read_memory. - */ -static void perror_memory(int status, bfd_vma memaddr, - struct disassemble_info *info) -{ - if (status != EIO) { - /* Can't happen. */ - info->fprintf_func(info->stream, "Unknown error %d\n", status); - } else { - /* Address between memaddr and memaddr + len was out of bounds. */ - info->fprintf_func(info->stream, - "Address 0x%" PRIx64 " is out of bounds.\n", - memaddr); - } -} - -/* Print address in hex. */ -static void print_address(bfd_vma addr, struct disassemble_info *info) -{ - info->fprintf_func(info->stream, "0x%" PRIx64, addr); -} - -/* Print address in hex, truncated to the width of a host virtual address. */ -static void host_print_address(bfd_vma addr, struct disassemble_info *info) -{ - print_address((uintptr_t)addr, info); -} - -/* Stub prevents some fruitless earching in optabs disassemblers. */ -static int symbol_at_address(bfd_vma addr, struct disassemble_info *info) -{ - return 1; -} - -static int print_insn_objdump(bfd_vma pc, disassemble_info *info, - const char *prefix) -{ - int i, n = info->buffer_length; - g_autofree uint8_t *buf = g_malloc(n); - - if (info->read_memory_func(pc, buf, n, info) == 0) { - for (i = 0; i < n; ++i) { - if (i % 32 == 0) { - info->fprintf_func(info->stream, "\n%s: ", prefix); - } - info->fprintf_func(info->stream, "%02x", buf[i]); - } - } else { - info->fprintf_func(info->stream, "unable to read memory"); - } - return n; -} - -static int print_insn_od_host(bfd_vma pc, disassemble_info *info) -{ - return print_insn_objdump(pc, info, "OBJD-H"); -} - -static int print_insn_od_target(bfd_vma pc, disassemble_info *info) -{ - return print_insn_objdump(pc, info, "OBJD-T"); -} - -static void initialize_debug(CPUDebug *s) -{ - memset(s, 0, sizeof(*s)); - s->info.arch = bfd_arch_unknown; - s->info.cap_arch = -1; - s->info.cap_insn_unit = 4; - s->info.cap_insn_split = 4; - s->info.memory_error_func = perror_memory; - s->info.symbol_at_address_func = symbol_at_address; -} - -void disas_initialize_debug_target(CPUDebug *s, CPUState *cpu) -{ - initialize_debug(s); - - s->cpu = cpu; - s->info.read_memory_func = target_read_memory; - s->info.print_address_func = print_address; - if (target_words_bigendian()) { - s->info.endian = BFD_ENDIAN_BIG; - } else { - s->info.endian = BFD_ENDIAN_LITTLE; - } - - CPUClass *cc = CPU_GET_CLASS(cpu); - if (cc->disas_set_info) { - cc->disas_set_info(cpu, &s->info); - } -} - -static void initialize_debug_host(CPUDebug *s) -{ - initialize_debug(s); - - s->info.read_memory_func = host_read_memory; - s->info.print_address_func = host_print_address; -#if HOST_BIG_ENDIAN - s->info.endian = BFD_ENDIAN_BIG; -#else - s->info.endian = BFD_ENDIAN_LITTLE; -#endif -#if defined(CONFIG_TCG_INTERPRETER) - s->info.print_insn = print_insn_tci; -#elif defined(__i386__) - s->info.mach = bfd_mach_i386_i386; - s->info.cap_arch = CS_ARCH_X86; - s->info.cap_mode = CS_MODE_32; - s->info.cap_insn_unit = 1; - s->info.cap_insn_split = 8; -#elif defined(__x86_64__) - s->info.mach = bfd_mach_x86_64; - s->info.cap_arch = CS_ARCH_X86; - s->info.cap_mode = CS_MODE_64; - s->info.cap_insn_unit = 1; - s->info.cap_insn_split = 8; -#elif defined(_ARCH_PPC) - s->info.cap_arch = CS_ARCH_PPC; -# ifdef _ARCH_PPC64 - s->info.cap_mode = CS_MODE_64; -# endif -#elif defined(__riscv) -#if defined(_ILP32) || (__riscv_xlen == 32) - s->info.print_insn = print_insn_riscv32; -#elif defined(_LP64) - s->info.print_insn = print_insn_riscv64; -#else -#error unsupported RISC-V ABI -#endif -#elif defined(__aarch64__) - s->info.cap_arch = CS_ARCH_ARM64; -#elif defined(__alpha__) - s->info.print_insn = print_insn_alpha; -#elif defined(__sparc__) - s->info.print_insn = print_insn_sparc; - s->info.mach = bfd_mach_sparc_v9b; -#elif defined(__arm__) - /* TCG only generates code for arm mode. */ - s->info.cap_arch = CS_ARCH_ARM; -#elif defined(__MIPSEB__) - s->info.print_insn = print_insn_big_mips; -#elif defined(__MIPSEL__) - s->info.print_insn = print_insn_little_mips; -#elif defined(__m68k__) - s->info.print_insn = print_insn_m68k; -#elif defined(__s390__) - s->info.cap_arch = CS_ARCH_SYSZ; - s->info.cap_insn_unit = 2; - s->info.cap_insn_split = 6; -#elif defined(__hppa__) - s->info.print_insn = print_insn_hppa; -#elif defined(__loongarch__) - s->info.print_insn = print_insn_loongarch; -#endif -} - -/* Disassemble this for me please... (debugging). */ -void target_disas(FILE *out, CPUState *cpu, uint64_t code, size_t size) -{ - uint64_t pc; - int count; - CPUDebug s; - - disas_initialize_debug_target(&s, cpu); - s.info.fprintf_func = fprintf; - s.info.stream = out; - s.info.buffer_vma = code; - s.info.buffer_length = size; - s.info.show_opcodes = true; - - if (s.info.cap_arch >= 0 && cap_disas_target(&s.info, code, size)) { - return; - } - - if (s.info.print_insn == NULL) { - s.info.print_insn = print_insn_od_target; - } - - for (pc = code; size > 0; pc += count, size -= count) { - fprintf(out, "0x%08" PRIx64 ": ", pc); - count = s.info.print_insn(pc, &s.info); - fprintf(out, "\n"); - if (count < 0) { - break; - } - if (size < count) { - fprintf(out, - "Disassembler disagrees with translator over instruction " - "decoding\n" - "Please report this to qemu-devel@nongnu.org\n"); - break; - } - } -} - -int disas_gstring_printf(FILE *stream, const char *fmt, ...) -{ - /* We abuse the FILE parameter to pass a GString. */ - GString *s = (GString *)stream; - int initial_len = s->len; - va_list va; - - va_start(va, fmt); - g_string_append_vprintf(s, fmt, va); - va_end(va); - - return s->len - initial_len; -} - -static void plugin_print_address(bfd_vma addr, struct disassemble_info *info) -{ - /* does nothing */ -} - - -/* - * We should only be dissembling one instruction at a time here. If - * there is left over it usually indicates the front end has read more - * bytes than it needed. - */ -char *plugin_disas(CPUState *cpu, uint64_t addr, size_t size) -{ - CPUDebug s; - GString *ds = g_string_new(NULL); - - disas_initialize_debug_target(&s, cpu); - s.info.fprintf_func = disas_gstring_printf; - s.info.stream = (FILE *)ds; /* abuse this slot */ - s.info.buffer_vma = addr; - s.info.buffer_length = size; - s.info.print_address_func = plugin_print_address; - - if (s.info.cap_arch >= 0 && cap_disas_plugin(&s.info, addr, size)) { - ; /* done */ - } else if (s.info.print_insn) { - s.info.print_insn(addr, &s.info); - } else { - ; /* cannot disassemble -- return empty string */ - } - - /* Return the buffer, freeing the GString container. */ - return g_string_free(ds, false); -} - -/* Disassemble this for me please... (debugging). */ -void disas(FILE *out, const void *code, size_t size) -{ - uintptr_t pc; - int count; - CPUDebug s; - - initialize_debug_host(&s); - s.info.fprintf_func = fprintf; - s.info.stream = out; - s.info.buffer = code; - s.info.buffer_vma = (uintptr_t)code; - s.info.buffer_length = size; - s.info.show_opcodes = true; - - if (s.info.cap_arch >= 0 && cap_disas_host(&s.info, code, size)) { - return; - } - - if (s.info.print_insn == NULL) { - s.info.print_insn = print_insn_od_host; - } - for (pc = (uintptr_t)code; size > 0; pc += count, size -= count) { - fprintf(out, "0x%08" PRIxPTR ": ", pc); - count = s.info.print_insn(pc, &s.info); - fprintf(out, "\n"); - if (count < 0) { - break; - } - } - -} - -/* Look up symbol for debugging purpose. Returns "" if unknown. */ -const char *lookup_symbol(uint64_t orig_addr) -{ - const char *symbol = ""; - struct syminfo *s; - - for (s = syminfos; s; s = s->next) { - symbol = s->lookup_symbol(s, orig_addr); - if (symbol[0] != '\0') { - break; - } - } - - return symbol; -} diff --git a/disas/objdump.c b/disas/objdump.c new file mode 100644 index 0000000000..9859f23419 --- /dev/null +++ b/disas/objdump.c @@ -0,0 +1,37 @@ +/* + * Dump disassembly as text, for processing by scripts/disas-objdump.pl. + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "disas-internal.h" + + +static int print_insn_objdump(bfd_vma pc, disassemble_info *info, + const char *prefix) +{ + int i, n = info->buffer_length; + g_autofree uint8_t *buf = g_malloc(n); + + if (info->read_memory_func(pc, buf, n, info) == 0) { + for (i = 0; i < n; ++i) { + if (i % 32 == 0) { + info->fprintf_func(info->stream, "\n%s: ", prefix); + } + info->fprintf_func(info->stream, "%02x", buf[i]); + } + } else { + info->fprintf_func(info->stream, "unable to read memory"); + } + return n; +} + +int print_insn_od_host(bfd_vma pc, disassemble_info *info) +{ + return print_insn_objdump(pc, info, "OBJD-H"); +} + +int print_insn_od_target(bfd_vma pc, disassemble_info *info) +{ + return print_insn_objdump(pc, info, "OBJD-T"); +} diff --git a/disas/meson.build b/disas/meson.build index 5c8073beb3..20d6aef9a7 100644 --- a/disas/meson.build +++ b/disas/meson.build @@ -14,7 +14,11 @@ common_ss.add(when: 'CONFIG_SH4_DIS', if_true: files('sh4.c')) common_ss.add(when: 'CONFIG_SPARC_DIS', if_true: files('sparc.c')) common_ss.add(when: 'CONFIG_XTENSA_DIS', if_true: files('xtensa.c')) common_ss.add(when: capstone, if_true: [files('capstone.c'), capstone]) -common_ss.add(files('disas.c')) - +common_ss.add(when: 'CONFIG_TCG', if_true: files( + 'disas-host.c', + 'disas-target.c', + 'objdump.c' +)) +common_ss.add(files('disas-common.c')) system_ss.add(files('disas-mon.c')) specific_ss.add(capstone) From patchwork Wed Apr 24 23:31:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791590 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1106513wrq; Wed, 24 Apr 2024 16:33:38 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVWFY7Kt2kiek0DzvxrdXqkmMg6Ep7huRDdSgfDRwkShNx0ymtDq58OVvvJL/s5JhsdJUAEygKLUJPwYq9jt/XX X-Google-Smtp-Source: AGHT+IHbhNjuwtmDrstOaGZu6cMgsYzkMWn9bLUfpL5j+vGOc02yLWAkISPLJZPk0rIPvc5dFi/a X-Received: by 2002:ac8:7f45:0:b0:439:6113:4dd0 with SMTP id g5-20020ac87f45000000b0043961134dd0mr3970246qtk.65.1714001618689; Wed, 24 Apr 2024 16:33:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714001618; cv=none; d=google.com; s=arc-20160816; b=ppPfElJmUnrZV57/5K7TdLuP0lH7rIq9g1gNQB7kaxIq+/kLflNRdFZ0ojIsWpYOb8 Qw+2bH3A/r4AASKqjDgrNgh7/my3GmyJJpZoSO3PpmEUmT96odJoF62eB8vJuDTVfMrh g5KJMq1pg3jDyVlvCFOs3HyReKknJh1fGZU+F5AI2WKmbGW6lyDG/QLVEh51lDyboZm3 uICPL7dbUNVXnxhXmD92deMQokw694G8XHTSixILzThQ0w4hD+38V5vKFvs6k07tsS1x XzbAuVHorq4X+9Hg3IRh2CTGU5pTY18V+SQhmf1Gn0wRACrvrS6K6MTj0hVkkvwWVOTo wq6A== 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:to:from :dkim-signature; bh=EfgEgduM5tnEf0qPxFIi5z72enVcbh8+15waZvRvIfY=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=NASsXZz575PbJDzQiZtN3meK1jBf9HsbN9zdjFlKvGPDZfAtx4BSbqUFzK8wunn4ho 37Ujo0tywEfC6V+d/PglANKELsP+ucRhLsLNcWbU1zyQbz7/sVNcPXHoFBhtLwNcJLKd qF5SdiMdeQuVwPAti2rd7fqUzZk2dZkSQRwZvlrWWso0Qhs69FaSj3Lktp6Flb58Q9uz tuN3olAAJMhkxeByvKE4JlQmKqID2/PoRxBXbnR7JASWlOZz2FJpJc5xRR/g0Mqnqxag zMfqEF2Un2fe5SvvT4Hs3w7zhNNNFE12nAevtfI7KqSq8mADhXutBjKJNUB97HZbVy+N oiUw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Zd3ktxbz; 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 cc7-20020a05622a410700b0043a2e535023si2091625qtb.428.2024.04.24.16.33.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:33:38 -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=Zd3ktxbz; 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 1rzm5k-0005wk-Ke; Wed, 24 Apr 2024 19:31:56 -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 1rzm5h-0005u5-CZ for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:53 -0400 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzm5f-0003UO-CK for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:53 -0400 Received: by mail-pg1-x534.google.com with SMTP id 41be03b00d2f7-5dca1efad59so269495a12.2 for ; Wed, 24 Apr 2024 16:31:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714001510; x=1714606310; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=EfgEgduM5tnEf0qPxFIi5z72enVcbh8+15waZvRvIfY=; b=Zd3ktxbzXHPidWFp56NZIHupcuRyQWPpyhTPDuRnsyg+ulZFoG6HEG/Cv8bjE7+hKP 3BwPXw15hN6HZbTcJi3Jj68kwUrzKcc/tjcE49fYN/uHwlbL6gSiN4M5hml341rreHpE iHrTaLcxqAu4DAedgPBbRJmS7M7Pm9bAvv+6nk1SCkz7TFrxeFjgzGjmai5hwRu5ulJ9 0teoW6KYuMlFN58bAvNskzqP3ZKhZovbYAekfwUrRNNzpy/anEeeN8wCl/jyHBdtfnGY x0hCfBhhKGmRlQnB6i/iwhot/rPQOT1i3MLYEnhZGDj+Rorc9G9EuPdjwlr+M0o01d1v nfLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714001510; x=1714606310; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EfgEgduM5tnEf0qPxFIi5z72enVcbh8+15waZvRvIfY=; b=Vq84Z2iqz9cF47fa+p7Ykk3mk2+QaGJ5cU2682N83F6ZC29LiE0zh2a2owMLHxnw6n nA8SiVP653PY3wBdUtaL55Fv/1KHLuOk/lGF69vLIb5bxJDVxPaz5boS7k6FV3n4kQU+ 7J6VBm1eWI+cT0hvM5fzLVNsqMbzbMWyfIVvob45DBzjb1ubOacQQsgWM28DS7Bowf2F bfA+XMaclMZU4rsGIBEqE8A2QmVMNFFeQ5ph6PbhzJjzDvgYHdL+x4sllqp2kZIWOu3l lElEkBbK5lEOpJ8/zMIImrc5aRgKCQHj9m6omMumrqnvJzKEVTgLTLI+Sex0bAIPKxb0 eThQ== X-Gm-Message-State: AOJu0Yydzbw1bA2kM68QQ7N6a25FTxmeArWGdz4d4gQdcz97zG2yKNig +U7tC1BOGU6EUYbArfD9rsECJjj82hz+jnGCI/lFdJT55NK5rl3iihtEBxumvCm4mamwx76A+3X L X-Received: by 2002:a17:90a:289:b0:2a5:f19:978d with SMTP id w9-20020a17090a028900b002a50f19978dmr3996176pja.37.1714001509777; Wed, 24 Apr 2024 16:31:49 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id z24-20020a17090abd9800b002a56b3931dfsm11737859pjr.49.2024.04.24.16.31.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:31:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 19/33] disas: Use translator_st to get disassembly data Date: Wed, 24 Apr 2024 16:31:17 -0700 Message-Id: <20240424233131.988727-20-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::534; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x534.google.com X-Spam_score_int: 0 X-Spam_score: -0.1 X-Spam_bar: / X-Spam_report: (-0.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, PDS_OTHER_BAD_TLD=1.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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 Read from already translated pages, or saved mmio data. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- include/disas/disas.h | 5 +++-- include/exec/translator.h | 4 ++-- include/qemu/typedefs.h | 1 + accel/tcg/translator.c | 2 +- disas/disas-common.c | 14 -------------- disas/disas-mon.c | 15 +++++++++++++++ disas/disas-target.c | 19 +++++++++++++++++-- plugins/api.c | 4 ++-- 8 files changed, 41 insertions(+), 23 deletions(-) diff --git a/include/disas/disas.h b/include/disas/disas.h index 54a5e68443..c702b1effc 100644 --- a/include/disas/disas.h +++ b/include/disas/disas.h @@ -4,14 +4,15 @@ /* Disassemble this for me please... (debugging). */ #ifdef CONFIG_TCG void disas(FILE *out, const void *code, size_t size); -void target_disas(FILE *out, CPUState *cpu, uint64_t code, size_t size); +void target_disas(FILE *out, CPUState *cpu, const DisasContextBase *db); #endif void monitor_disas(Monitor *mon, CPUState *cpu, uint64_t pc, int nb_insn, bool is_physical); #ifdef CONFIG_PLUGIN -char *plugin_disas(CPUState *cpu, uint64_t addr, size_t size); +char *plugin_disas(CPUState *cpu, const DisasContextBase *db, + uint64_t addr, size_t size); #endif /* Look up symbol for debugging purpose. Returns "" if unknown. */ diff --git a/include/exec/translator.h b/include/exec/translator.h index bd76d6446b..8c3a8aa3d1 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -79,7 +79,7 @@ typedef enum DisasJumpType { * * Architecture-agnostic disassembly context. */ -typedef struct DisasContextBase { +struct DisasContextBase { TranslationBlock *tb; vaddr pc_first; vaddr pc_next; @@ -103,7 +103,7 @@ typedef struct DisasContextBase { int record_start; int record_len; uint8_t record[32]; -} DisasContextBase; +}; /** * TranslatorOps: diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h index 50c277cf0b..0b3cf3f3ec 100644 --- a/include/qemu/typedefs.h +++ b/include/qemu/typedefs.h @@ -50,6 +50,7 @@ typedef struct CPUTLBEntryFull CPUTLBEntryFull; typedef struct DeviceListener DeviceListener; typedef struct DeviceState DeviceState; typedef struct DirtyBitmapSnapshot DirtyBitmapSnapshot; +typedef struct DisasContextBase DisasContextBase; typedef struct DisplayChangeListener DisplayChangeListener; typedef struct DriveInfo DriveInfo; typedef struct DumpState DumpState; diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 8e8c4e1bf8..e968d530d8 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -230,7 +230,7 @@ void translator_loop(CPUState *cpu, TranslationBlock *tb, int *max_insns, if (!ops->disas_log || !ops->disas_log(db, cpu, logfile)) { fprintf(logfile, "IN: %s\n", lookup_symbol(db->pc_first)); - target_disas(logfile, cpu, db->pc_first, db->tb->size); + target_disas(logfile, cpu, db); } fprintf(logfile, "\n"); qemu_log_unlock(logfile); diff --git a/disas/disas-common.c b/disas/disas-common.c index e4118a381f..e4118e996b 100644 --- a/disas/disas-common.c +++ b/disas/disas-common.c @@ -7,25 +7,12 @@ #include "disas/disas.h" #include "disas/capstone.h" #include "hw/core/cpu.h" -#include "exec/memory.h" #include "disas-internal.h" /* Filled in by elfload.c. Simplistic, but will do for now. */ struct syminfo *syminfos = NULL; -/* - * Get LENGTH bytes from info's buffer, at target address memaddr. - * Transfer them to myaddr. - */ -static int target_read_memory(bfd_vma memaddr, bfd_byte *myaddr, int length, - struct disassemble_info *info) -{ - CPUDebug *s = container_of(info, CPUDebug, info); - int r = cpu_memory_rw_debug(s->cpu, memaddr, myaddr, length, 0); - return r ? EIO : 0; -} - /* * Print an error message. We can assume that this is in response to * an error return from {host,target}_read_memory. @@ -72,7 +59,6 @@ void disas_initialize_debug_target(CPUDebug *s, CPUState *cpu) disas_initialize_debug(s); s->cpu = cpu; - s->info.read_memory_func = target_read_memory; s->info.print_address_func = print_address; if (target_words_bigendian()) { s->info.endian = BFD_ENDIAN_BIG; diff --git a/disas/disas-mon.c b/disas/disas-mon.c index 5d6d9aa02d..37bf16ac79 100644 --- a/disas/disas-mon.c +++ b/disas/disas-mon.c @@ -11,6 +11,19 @@ #include "hw/core/cpu.h" #include "monitor/monitor.h" +/* + * Get LENGTH bytes from info's buffer, at target address memaddr. + * Transfer them to myaddr. + */ +static int +virtual_read_memory(bfd_vma memaddr, bfd_byte *myaddr, int length, + struct disassemble_info *info) +{ + CPUDebug *s = container_of(info, CPUDebug, info); + int r = cpu_memory_rw_debug(s->cpu, memaddr, myaddr, length, 0); + return r ? EIO : 0; +} + static int physical_read_memory(bfd_vma memaddr, bfd_byte *myaddr, int length, struct disassemble_info *info) @@ -38,6 +51,8 @@ void monitor_disas(Monitor *mon, CPUState *cpu, uint64_t pc, if (is_physical) { s.info.read_memory_func = physical_read_memory; + } else { + s.info.read_memory_func = virtual_read_memory; } s.info.buffer_vma = pc; diff --git a/disas/disas-target.c b/disas/disas-target.c index 82313b2a67..48f3a365dc 100644 --- a/disas/disas-target.c +++ b/disas/disas-target.c @@ -6,16 +6,28 @@ #include "qemu/osdep.h" #include "disas/disas.h" #include "disas/capstone.h" +#include "exec/translator.h" #include "disas-internal.h" -void target_disas(FILE *out, CPUState *cpu, uint64_t code, size_t size) +static int translator_read_memory(bfd_vma memaddr, bfd_byte *myaddr, + int length, struct disassemble_info *info) { + const DisasContextBase *db = info->application_data; + return translator_st(db, myaddr, memaddr, length) ? 0 : EIO; +} + +void target_disas(FILE *out, CPUState *cpu, const struct DisasContextBase *db) +{ + uint64_t code = db->pc_first; + size_t size = translator_st_len(db); uint64_t pc; int count; CPUDebug s; disas_initialize_debug_target(&s, cpu); + s.info.read_memory_func = translator_read_memory; + s.info.application_data = (void *)db; s.info.fprintf_func = fprintf; s.info.stream = out; s.info.buffer_vma = code; @@ -58,12 +70,15 @@ static void plugin_print_address(bfd_vma addr, struct disassemble_info *info) * there is left over it usually indicates the front end has read more * bytes than it needed. */ -char *plugin_disas(CPUState *cpu, uint64_t addr, size_t size) +char *plugin_disas(CPUState *cpu, const DisasContextBase *db, + uint64_t addr, size_t size) { CPUDebug s; GString *ds = g_string_new(NULL); disas_initialize_debug_target(&s, cpu); + s.info.read_memory_func = translator_read_memory; + s.info.application_data = (void *)db; s.info.fprintf_func = disas_gstring_printf; s.info.stream = (FILE *)ds; /* abuse this slot */ s.info.buffer_vma = addr; diff --git a/plugins/api.c b/plugins/api.c index 36ab47cdae..c084f335dd 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -271,8 +271,8 @@ void *qemu_plugin_insn_haddr(const struct qemu_plugin_insn *insn) char *qemu_plugin_insn_disas(const struct qemu_plugin_insn *insn) { - CPUState *cpu = current_cpu; - return plugin_disas(cpu, insn->vaddr, insn->len); + return plugin_disas(tcg_ctx->cpu, tcg_ctx->plugin_db, + insn->vaddr, insn->len); } const char *qemu_plugin_insn_symbol(const struct qemu_plugin_insn *insn) From patchwork Wed Apr 24 23:31:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791598 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1106805wrq; Wed, 24 Apr 2024 16:34:27 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVJ4CiBUuyAS3xsc/ihb8rLdL5G+QC0a4i2sT013HEPwWRrr/EQQNm4P61qwBNyWmWH8fWfjbymqjG6cPYdRqd1 X-Google-Smtp-Source: AGHT+IH6JbUDM+dTgAruiqE/B7CLvHQvyLU+nVxzZFbmlJufE3ZbaUBm/3diHZOEArNTbAGKU1Pg X-Received: by 2002:a05:622a:5e8d:b0:439:bb99:8314 with SMTP id er13-20020a05622a5e8d00b00439bb998314mr5279000qtb.25.1714001667086; Wed, 24 Apr 2024 16:34:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714001667; cv=none; d=google.com; s=arc-20160816; b=lSodTm65XYQQwkvT54Z7dFGNm0yW/epwLqrdtd7F4dYw6wKJfSsWlZvfW50L8coo4y 329RGPkVJLOejsQOn8D3AI6odw+Fh6kQV0bbA2dGYicidS4W5C4kSh9X/yCcjtZCo2mz nua/IdrOSRLoVswc4i3mrQZT1prI5ehmeKVbqOO9rsPjzJPsegSPIljEnnjkMMD97PCh +ChxAgn0KwB7OtXOWuEs+6VOaKUyzBVPjxdiT8SQMI6Gpuy0z5hpaoK3rI+VpGtjEmjd cNLJrlbE9RjUzqjT796LMicf81LHhpHjcJOYhUfKOCWmDald1SddHvm0ugvYe0tSqDSA nP0Q== 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=/EhXPPMxaAY9EqFJpabnI69teg9b6N6lI3TZrlx6dqE=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=lcaWzEqffYcqIYaJ3lS3G42mntVGFfriOEwl3RSooz19kOl4pvaL2dlIBuegayOlJH JgEOZSkcDyjKeOXXwtuv7ZhjsGn3mXhZ98mPbcWkADu83XyF7bpxe4y/MHs/ZNgbY7+q byIW3Pl0FwUYFvjh0CPVb8asPV+BR7gnOeyayr8kdtyHfOJ/jg2baAqhzOp2djfxWCTQ fyGTpDFDILG5TM8chSYA/pTVlj/DzS5RYO/hmuBGRFodzttyH4bxwgA0g66ZfeCqklLG 3U7CkY3CMjLfAw6vz+48t8LYONfVcKV2s9lXMyudW+MTj32hSYiz+fRx6STDayTupOoc VtfQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yHe1tlPR; 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 t1-20020a05622a148100b00435ecc552b3si16974248qtx.409.2024.04.24.16.34.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:34:27 -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=yHe1tlPR; 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 1rzm5n-0005yz-VF; Wed, 24 Apr 2024 19:31:59 -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 1rzm5h-0005ug-OI for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:53 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzm5g-0003Vh-1D for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:53 -0400 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1e51398cc4eso3621575ad.2 for ; Wed, 24 Apr 2024 16:31:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714001510; x=1714606310; 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=/EhXPPMxaAY9EqFJpabnI69teg9b6N6lI3TZrlx6dqE=; b=yHe1tlPRJ8hLdPa2OaNUvyNHHlJsvaEEEWvyj5rGS4e+zu/TaHKcgJ8K5LDkcGc7Bn FTB/suFpmdKjFiW08P9124YE03lvSWYWEDeAP0kapIXYy8Uf9MBV5JCZwT/H2c+70unv HGybqIyMT+9gS0W0+t/UwMIVYmza863hks7GrxM5PPKc1lRRxj4ZL/+7KE7jHkqioe/d Xgtp/UFN4zWRPUjci1EDRRjvthRy53HvOkmB9HqifFbJy+P/aWwho1ApZ9VPZ4IuVNTt jrgMdsbcJGRRfZK5ElT1XXLHcfA4pCq2LYNX36AByx1Fsvc+ZFnZQwhrOkskXinBZTvO /ajw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714001510; x=1714606310; 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=/EhXPPMxaAY9EqFJpabnI69teg9b6N6lI3TZrlx6dqE=; b=aEUDPKYdGTARg5x4Bu29lx++XVajd/w1oZt5zMRrgCY2gbRQIKbjLiIIpGtjmCZgOW vGkBDnEp/AYfxvmUSOqFinXGRK4AH5DV8Lrw7b1CBxn9tsYvUKbMdbTBymZaTf1ArNQn Yk9qPs8XIWfdYrQu0LoaMF7dbit2+GeE1IEScJdetGIivvns6xASy966jg5AAACCN7X1 BUuBwGNrtlWnojHslVEPvPj0bzP9Vo/hEDRcL6gDINMXLPMnTYo/ZmZvXdEW+8bExI/P fB+dI+JWYv3/KqV1k3l0igBZl4ArdkeENBQ7mkMrbB0ZoSK3R9hVF9AADue+BthOsFsc XSRg== X-Gm-Message-State: AOJu0Yx2reBjkTqkNbKdfaheNR3b/9fU910qafM5Dwmrn+k72QYHL3Dq fOap9DC98jUx0Psx0zl2/NVDxCKzRbVSLCdMyA58OOXu6JySrJ7dA+f1K2F7rOC0u0Fto1Q4pP6 y X-Received: by 2002:a17:90b:1e0b:b0:2a2:cf1d:895c with SMTP id pg11-20020a17090b1e0b00b002a2cf1d895cmr4028357pjb.41.1714001510617; Wed, 24 Apr 2024 16:31:50 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id z24-20020a17090abd9800b002a56b3931dfsm11737859pjr.49.2024.04.24.16.31.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:31:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 20/33] accel/tcg: Introduce translator_fake_ld Date: Wed, 24 Apr 2024 16:31:18 -0700 Message-Id: <20240424233131.988727-21-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::629; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x629.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 Replace translator_fake_ldb, which required multiple calls, with translator_fake_ld, which can take all data at once. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- include/exec/translator.h | 8 ++++---- accel/tcg/translator.c | 5 ++--- target/s390x/tcg/translate.c | 8 ++++---- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/include/exec/translator.h b/include/exec/translator.h index 8c3a8aa3d1..fc9fc64963 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -234,17 +234,17 @@ translator_ldq_swap(CPUArchState *env, DisasContextBase *db, } /** - * translator_fake_ldb - fake instruction load + * translator_fake_ld - fake instruction load * @db: Disassembly context - * @pc: program counter of instruction - * @insn8: byte of instruction + * @data: bytes of instruction + * @len: number of bytes * * This is a special case helper used where the instruction we are * about to translate comes from somewhere else (e.g. being * re-synthesised for s390x "ex"). It ensures we update other areas of * the translator with details of the executed instruction. */ -void translator_fake_ldb(DisasContextBase *db, vaddr pc, uint8_t insn8); +void translator_fake_ld(DisasContextBase *db, const void *data, size_t len); /** * translator_st diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index e968d530d8..14622b69a8 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -467,9 +467,8 @@ uint64_t translator_ldq(CPUArchState *env, DisasContextBase *db, vaddr pc) return tgt; } -void translator_fake_ldb(DisasContextBase *db, vaddr pc, uint8_t insn8) +void translator_fake_ld(DisasContextBase *db, const void *data, size_t len) { - assert(pc >= db->pc_first); db->fake_insn = true; - record_save(db, pc, &insn8, sizeof(insn8)); + record_save(db, db->pc_first, data, len); } diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index d74939389a..2eb787e401 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -6191,6 +6191,8 @@ static const DisasInsn *extract_insn(CPUS390XState *env, DisasContext *s) const DisasInsn *info; if (unlikely(s->ex_value)) { + uint64_t be_insn; + /* Drop the EX data now, so that it's clear on exception paths. */ tcg_gen_st_i64(tcg_constant_i64(0), tcg_env, offsetof(CPUS390XState, ex_value)); @@ -6200,10 +6202,8 @@ static const DisasInsn *extract_insn(CPUS390XState *env, DisasContext *s) ilen = s->ex_value & 0xf; /* Register insn bytes with translator so plugins work. */ - for (int i = 0; i < ilen; i++) { - uint8_t byte = extract64(insn, 56 - (i * 8), 8); - translator_fake_ldb(&s->base, pc + i, byte); - } + be_insn = cpu_to_be64(insn); + translator_fake_ld(&s->base, &be_insn, ilen); op = insn >> 56; } else { insn = ld_code2(env, s, pc); From patchwork Wed Apr 24 23:31:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791586 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1106333wrq; Wed, 24 Apr 2024 16:33:10 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW25zmovjKqxIoVDVJthozGXRce1rfXljvUTEFezoNZB392ruu3slEL0XyDAaYzg+Nzs5PNYyachMbgzJxz4XT9 X-Google-Smtp-Source: AGHT+IE/XBYqftvhQpVNNUaB4r7xOqSwl99RpEb9yZTfHU2cGHVcsZs1igwnKscfBTagVnTbiRhV X-Received: by 2002:a4a:98c9:0:b0:5af:292b:6982 with SMTP id b9-20020a4a98c9000000b005af292b6982mr4273395ooj.5.1714001589865; Wed, 24 Apr 2024 16:33:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714001589; cv=none; d=google.com; s=arc-20160816; b=GdizfXp+Lkm0LYGbJZUf/wECfENrQIAMVBF7I1QVFtIY5iUfEyWwtPyOr9nmaAcyHL flVR8FjzayWw//c/4tyUKPZj/f37TdiqkwLljWXoBxdxKFur5flsHy/WPtOm8QjgxP6m UGNaPGrdUsneLNPWGo/7oWgCPQFrjavK+PVXRGrjydHeoPyfQ8Aix1ZFlrGNcZ0+Zft8 eUcQZYfPN9i1WDaONhefzCLHtwnUfG5FwAFIyq4g/s1Aw1a94sYq10ULjpsn2b5feBRt umbRf5KlM8Rd0PR0C5drTWeYZu+leOZ0ZHA7U1RGij+RnTn3H+g5UTFFYtyMgw1OTUGZ eUNg== 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:to:from :dkim-signature; bh=hN1dyhS2K76C29H8D9/k3RGranbkoht6vnkUIzOBC5w=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=0RQtPs74zJ3fMThFJTFzsoK1BU0SgL9Z1+43Hsyq726Xwb1JudqckJFJkqL0BySSjP uoXmuymR4xavV39oR2ELgPpzsEbbSa/eWMJolCjkTcL1OLnJW2N+sIP8etG5pQTciDD3 mtdx0uo0VkS5BD5ZNUNiAzc1xumgJTWy1SrSXF0CDuWW2r+65JWx0bfIul+i7lQMpsSu BigKkgQGrqO3dYh/SLxD9Gt9owfhw0uFmJ8mcdOmbdjHbYKzJ/zp5NOmEKGWfK38lZgl OPpvO3ytGzECfBPIFSto93ySJUWfAjqKRBxhv5h65PZTue0BXeDqLKIamUp/nw6aIche HP4w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=M0JNmKwk; 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 v3-20020a05622a144300b0043a1c643fc8si2754706qtx.645.2024.04.24.16.33.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:33:09 -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=M0JNmKwk; 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 1rzm5p-000601-0h; Wed, 24 Apr 2024 19:32:01 -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 1rzm5i-0005vK-IC for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:54 -0400 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzm5g-0003Yf-Sf for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:54 -0400 Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-2ae229e9176so408405a91.0 for ; Wed, 24 Apr 2024 16:31:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714001511; x=1714606311; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=hN1dyhS2K76C29H8D9/k3RGranbkoht6vnkUIzOBC5w=; b=M0JNmKwkW1bif/LeGAU5aVaTGOYlTMY3FgsQbI31TKCOZ5TYsW6ArafBCP3y+IkefO IxwLEbKsX6CQzv0yvkGqY8XwMg5iAtyZhrc5rMiGnvdd0U7iuk9XF7KHeCTGNyd1yrX4 h/3wBALCsGJvoyHQjLTY4t9gr7F/q0xrINhmZXhikpFytBxfePwNI//uigTPpCxFBWuh jKQFObUl75oOVoyhnPGmiIyUeSu8HsNmPszWqzZz1q9Ib1zX5y3vehnElkLWNn5EnoTM nO0YBlA+biCC0je7iDNfb+14CEgRIfFzumNjWUKDkqnGBkJrZFnw4tTgicy8nI7Je0R2 k5jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714001511; x=1714606311; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hN1dyhS2K76C29H8D9/k3RGranbkoht6vnkUIzOBC5w=; b=wKMHRmd1R131H60DCXvuZe5AT8HbVxrAXpn1DflEm/l9Bjza9Iz6LylXnn2AtChMI8 aBACn+Oc9gqIjjY50YEfiTTChZ+jJEpz0e7nrdGiAFUFEyizUthOh39v1m6WWC8nhotS Zc1OwJywaRCT2dW3FBfks5M0Z+zVb7l31hpzwwlXVSvEijeYXYeFkw6ZLJZ60HR3OAk0 IHF9YF1fuj6elVIBokK2Xxmpy333tLH8Df9Fx6F9sUZQBFVwRPfonFF21mqDgcJMMdsp kYDg2sViBGqROkLf01z6kijxj8be+2yZOStxIV0JWlhnv1SieYvbCRZwlqr8TyS6nzpd o1eg== X-Gm-Message-State: AOJu0Yxz9YQc4aay+Ba2+Ak2Bat/R5f8nUcLpJUAjTlzhUR/NSK8SpaZ sREKARMQmPcxmCroGh6akraVXdlG3JOAKq97SJThO4nyePsEK6hA6KPrX6zArJgF1jim16U61Yp j X-Received: by 2002:a17:90b:33cf:b0:2a4:752f:b7b7 with SMTP id lk15-20020a17090b33cf00b002a4752fb7b7mr4136603pjb.26.1714001511532; Wed, 24 Apr 2024 16:31:51 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id z24-20020a17090abd9800b002a56b3931dfsm11737859pjr.49.2024.04.24.16.31.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:31:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 21/33] target/s390x: Fix translator_fake_ld length Date: Wed, 24 Apr 2024 16:31:19 -0700 Message-Id: <20240424233131.988727-22-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::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.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 The ilen value extracted from ex_value is the length of the EXECUTE instruction itself, and so is the increment to the pc. However, the length of the synthetic insn is located in the opcode like all other instructions. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- target/s390x/tcg/translate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index 2eb787e401..95d4d6ebc3 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -6200,11 +6200,11 @@ static const DisasInsn *extract_insn(CPUS390XState *env, DisasContext *s) /* Extract the values saved by EXECUTE. */ insn = s->ex_value & 0xffffffffffff0000ull; ilen = s->ex_value & 0xf; + op = insn >> 56; /* Register insn bytes with translator so plugins work. */ be_insn = cpu_to_be64(insn); - translator_fake_ld(&s->base, &be_insn, ilen); - op = insn >> 56; + translator_fake_ld(&s->base, &be_insn, get_ilen(op)); } else { insn = ld_code2(env, s, pc); op = (insn >> 8) & 0xff; From patchwork Wed Apr 24 23:31:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791584 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1106250wrq; Wed, 24 Apr 2024 16:32:54 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCURGTIq5dhlTdZsqfWVGru+5MOvlXu1/cJbGm3JoI6Fb9YMI3VfX1EvrVaskranYL4VonEEidjnmZcPEVWtyYHB X-Google-Smtp-Source: AGHT+IFFDdO36jaWIA4I8Dxp2lcOREzhFv69xbr13lRYdvSQjhNuyh9QtRRJqus8imc4RXX98TjP X-Received: by 2002:a05:6902:102f:b0:dcb:be59:25e1 with SMTP id x15-20020a056902102f00b00dcbbe5925e1mr5107665ybt.30.1714001574420; Wed, 24 Apr 2024 16:32:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714001574; cv=none; d=google.com; s=arc-20160816; b=r2WS4xsnExE7m3u1fZ0Q0Bk7OlFR0JGgsN+nwqIGsWJ6LbMjMK/JpYZwluiK3whOOq AnIk9j7yV+WrV/CYspa+PqzPktgW7OO+yXLUCbTnmcqIWxKSkZxk5nLrpTRPcK/DXd8V CuueAi8Gm6bArtijRySEiSMK/bv4s+PsoofV2M3zltaEjekw67szFUl4ojI46SIyBhuH I0lq3qR5LRTNCuollsyQS3pKRWoTmUP6Gq8YDyn4awnEpGSpuCOoUsGGlnjHWvPVOpNp iDlhai3BeLmVff/zcc0SXaDe4HlpGxx/iLbCljectXXyoRVKmj5I7tX0vrVNKkw3UiHL vLOQ== 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:to:from :dkim-signature; bh=Bxp3OWyJKaOKfrMeAe4PH0dSXcFDE//yn/aSHHr1IuQ=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=DzN85tSoMv88mAHW1tly/PqfQ6O4pzN5NfA6ZTIGOYv53xZUY36cWzdChPqwgB+FPl zWT74YPMGCDaQGZdrgCcCG2hvVWmF1NU06GSLIr/vnX64AAuWbzvvIuveIM13kwHSXMV lcRdN1JkeI1M9y/xSMobuYLil6w1w5OAsMTXD+waU4FVKm6O7ybTlHKYJcOQXwxHJCv8 wevvi8qKxQqKMkkSgRI050YrFhE4gMHpkH81oI1oH6gPLkMKTYBooKE9M44p1lQVioWT x0ram/WY2EK6KRg04yDvmCcYacVYD9759Xz/d/ypD6IzDyQ0+9n2ER67mBqj+VDqgy9E IK0Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lQQ59a17; 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 gi4-20020a056214248400b00699361cbd68si16684208qvb.256.2024.04.24.16.32.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:32:54 -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=lQQ59a17; 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 1rzm5l-0005xV-Kq; Wed, 24 Apr 2024 19:31:57 -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 1rzm5j-0005vx-4d for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:55 -0400 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzm5h-0003bM-NI for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:54 -0400 Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-5f7a42bf0adso313631a12.1 for ; Wed, 24 Apr 2024 16:31:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714001512; x=1714606312; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Bxp3OWyJKaOKfrMeAe4PH0dSXcFDE//yn/aSHHr1IuQ=; b=lQQ59a17K3yTU7GmpQcoczfsqlrUP5c0vbLzlb45iCfrmAUXSXG81W1RcqddnHwvCV cmfJDhuMjVQsH0EkkCr8xVCGps996FJecoz1hVLqMwR/seNNV9NET5uPMKQRBZ1zVwqC w51eNQ27cF5kvtMQqtqjtr+2seYQtZIgzX1Eum5zmNeFoD0VCbyG3IAoISo9f1XhJrKu 4GqdSdMGSDsX1F5k6btgyEB3cEbIxVf6rw0l5K4oDJ7Vt8+6AUbnFF3VJsJhUw+CJxzu O/Q173sDJvLNJBlY9D9KR7hliYfuWUY3iHkN+RiIH2yne3IZ3bJ1jVQCqKxLJh/uP5k0 uVWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714001512; x=1714606312; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Bxp3OWyJKaOKfrMeAe4PH0dSXcFDE//yn/aSHHr1IuQ=; b=YzVQeYTYGbleIUm52dIubBVlVJXgcvAobC8AK7J9w7QVbNiH0HbGsx3+0I9aDOZ0Wm uRTrsz8ONEwOPgwdb2zem28xcQF+swCQvSzhXzvJIKuFdE0PsvB0/UYIrufo+5kuNi4x EGj/FxkHWnyle4x8Qw1zXqn20yuqti+v6K86y7/dpT0qVB6D8N78H8nVDLlt1BYoxENl LBHYWO7/iZPkNDt+LLjd+TdBjBKLATMDDugwPq5hP8jp40+Ub5tAU72k6scZNrTD6IwZ Kq7Vc9HW/PeAVMwPCe9uJ8NtL3OxTaZdrye/rs3cHoUwS+YOaOn94GJszxdPDPE7LRgU w8/Q== X-Gm-Message-State: AOJu0YyvGSwPB6ph1RC8ZEYSXkUPEmdlI8iPoyawbqswM/hsJAudCg0v RSa/y3EVoTR+lVvcLrcc93XYHvUohlO5ibl3XQSbCNGXifH3d9Gdx04woE71+kKnSKFoRL5aAqZ A X-Received: by 2002:a17:90a:4b4c:b0:2ae:c098:7d79 with SMTP id o12-20020a17090a4b4c00b002aec0987d79mr3729264pjl.21.1714001512385; Wed, 24 Apr 2024 16:31:52 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id z24-20020a17090abd9800b002a56b3931dfsm11737859pjr.49.2024.04.24.16.31.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:31:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 22/33] target/s390x: Disassemble EXECUTEd instructions Date: Wed, 24 Apr 2024 16:31:20 -0700 Message-Id: <20240424233131.988727-23-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::532; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x532.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 Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- target/s390x/tcg/translate.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index 95d4d6ebc3..bac033c63c 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -6525,8 +6525,9 @@ static bool s390x_tr_disas_log(const DisasContextBase *dcbase, DisasContext *dc = container_of(dcbase, DisasContext, base); if (unlikely(dc->ex_value)) { - /* ??? Unfortunately target_disas can't use host memory. */ - fprintf(logfile, "IN: EXECUTE %016" PRIx64, dc->ex_value); + /* The ex_value has been recorded with translator_fake_ld. */ + fprintf(logfile, "IN: EXECUTE\n"); + target_disas(logfile, cs, &dc->base); return true; } return false; From patchwork Wed Apr 24 23:31:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791603 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1106995wrq; Wed, 24 Apr 2024 16:34:59 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUqrMA9B4x5+6Q4fai6iwst8Y0wSaiNlLSDFZXV9COv741HnLHZRzb1Zz5dWFZG9Iv65qQHFQJOuH/psk236iXp X-Google-Smtp-Source: AGHT+IEkk0zMiKDo2KnIAu5Klf2WFAv94L+Js0RreS3ldb1oGOK5thcss/Jjga5KLduMcdLl+eaW X-Received: by 2002:ac8:7d8a:0:b0:43a:d6e:7e29 with SMTP id c10-20020ac87d8a000000b0043a0d6e7e29mr2180160qtd.0.1714001699742; Wed, 24 Apr 2024 16:34:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714001699; cv=none; d=google.com; s=arc-20160816; b=My1cAHxlb0y3BrvhdCauEHw0C9GU+iCAhvx++kfSKk+XE5OFWUjDEMsKwEiqmQuUtc saAuF2Eru0eF0roQSLSEhUHB4bya7DpECf7GP7osG75al9S29rK2C59Dh91g/TnfOC+v pjCzTRfFqSsqI3QygNEPAW6KB9zRweqwUOPE5bTmR5lI5rCmxdHeLKqGy9d6Dmbj4wpv aHbse0L28zeFzkj8Fvb2CtAKdKMPPPchTEJVcG6uiy/WyDQisLhrG+KXPK/c/wEf/8NV xrHEv1QuSlrrsae1TwRHOpm7KO7DCnPaXcF1vq+RcBpr19U8SNmed0f/e5LuXgyFpyEc frXg== 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:to:from :dkim-signature; bh=W9eiE29Bj7CMVURG9HseqahFmYGTQEZ0wVZgUH4CDAc=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=rba7I9o9H+R3jswi/prchPSxrDXRAW6nuyg1ahjoxnY7kRjfnkfli9snnwwF+Af6ue aezZilULoht/LSv1pNhxyLfY/Vl9GJgJgoFjKpLLdTuY13HbJi/yW1R1P6oYfLwnzUVl DQSrjK7nJMgEayLlkhZPj0J/MmUugdMwYdWn9PQwqxi7kCBofCcXNZ8sWouEaya369s5 3vDLtwy6RUoRWOk4TCrJqF+FV+csaD23WWt0gOgTYBn3NPw1Imq0gVbBqa/xJ1w+c5FY 8zzsROtA1uAUqbWyG+AH1E2iUESOIwvVtfeppbRNaFjKFbDtFMoavgCoXlgL9MxqkIS0 HWdw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=q4ne7GwS; 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 e12-20020ac85dcc000000b00439a18491e7si9289731qtx.67.2024.04.24.16.34.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:34:59 -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=q4ne7GwS; 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 1rzm5m-0005yE-DB; Wed, 24 Apr 2024 19:31:58 -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 1rzm5k-0005wc-63 for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:56 -0400 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzm5i-0003cb-MA for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:55 -0400 Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-5c66b093b86so1176353a12.0 for ; Wed, 24 Apr 2024 16:31:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714001513; x=1714606313; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=W9eiE29Bj7CMVURG9HseqahFmYGTQEZ0wVZgUH4CDAc=; b=q4ne7GwS5Zv1dTNDaIMTCadg3GLNYpudrwiN/no7RoQHpfSgYHBqwXF/VPFhtsB3Lt iuUtfHv17P0596RyeZudeY8hf54RuKuVJr7sbp5YZBzTRXTMU53Dg1ytrDwnosoMxRjs jAZDg+h+t1OoIFi7M+/4kTWm7NrK0sSiCs6tZbxU9Pt+Uzi6yyaG7c6A1U/rKxV2AUv6 6cBOCECeEZUjhoLqAlN/EoCH49NjoSVjaxByl2dxRJl6QlaGM0yJlpids2ldZhIV5x8A ICXOTyRpFDtXIFD7cvKSveP6ltdYFOZ+VnA+O15aCf89DD0QlOgx2JnKd8RgCKvZXA/0 +eIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714001513; x=1714606313; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=W9eiE29Bj7CMVURG9HseqahFmYGTQEZ0wVZgUH4CDAc=; b=gcf3yj9HBsPjLhPy9Gpv2EW+wlWrqhPKpj/rDj/PCCrAWkPIeZ2ncLCAq0YIBqRpa9 UPbLCnf6SY37IzPagonJ/OBIIFgFlUJLse5rTyI6qu69szikF+JoLYYCBN8hMRirOf6T J9Fb0QBxHCjzbWgdaDibYJNK38pgwETyTHmnBdwVXG1at9ca+Q61CHUyb0s5NxTzz2cO BJD09/aqIsz7i5dDea8cF9wyoILHzNs1Lu6zXQ/q7lT6eH5do7/3EcpvJy5oS2nDquCs yJrVytFmGyU0bbRrU077AkBkBek/K7jNIKkRVlrqNqIfD7VwjfM/ZmPtSdpZd9rAH8yQ llQw== X-Gm-Message-State: AOJu0YxECxvvAK1Aa13PEvxx6wx0l7iCiDIV9qcwccfJ347OP7zbq40R wslj4v0K7owzxwiUtzrUNDyHTeEqavmbzI2dGEk/RhPFsNONj0d7f7UY9IzNHN3AsKZxkm2MHqw n X-Received: by 2002:a17:90a:b104:b0:2aa:b377:d29e with SMTP id z4-20020a17090ab10400b002aab377d29emr1705370pjq.3.1714001513151; Wed, 24 Apr 2024 16:31:53 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id z24-20020a17090abd9800b002a56b3931dfsm11737859pjr.49.2024.04.24.16.31.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:31:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 23/33] target/hexagon: Use translator_ldl in pkt_crosses_page Date: Wed, 24 Apr 2024 16:31:21 -0700 Message-Id: <20240424233131.988727-24-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::52c; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52c.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 Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- target/hexagon/translate.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c index 1344a3e4ab..37dec8b5c5 100644 --- a/target/hexagon/translate.c +++ b/target/hexagon/translate.c @@ -24,7 +24,6 @@ #include "exec/helper-proto.h" #include "exec/translation-block.h" #include "exec/log.h" -#include "exec/cpu_ldst.h" #include "internal.h" #include "attribs.h" #include "insn.h" @@ -1085,7 +1084,7 @@ static bool pkt_crosses_page(CPUHexagonState *env, DisasContext *ctx) int nwords; for (nwords = 0; !found_end && nwords < PACKET_WORDS_MAX; nwords++) { - uint32_t word = cpu_ldl_code(env, + uint32_t word = translator_ldl(env, &ctx->base, ctx->base.pc_next + nwords * sizeof(uint32_t)); found_end = is_packet_end(word); } From patchwork Wed Apr 24 23:31:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791597 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1106784wrq; Wed, 24 Apr 2024 16:34:22 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXL7wHEUEIJWE4crbDbLYAv35oDjoLyHTjm8cdxUZgLmokLKnmPcT1xhS5Idv/7piG5yIH0UjbdeVGQ0CA2+49E X-Google-Smtp-Source: AGHT+IGZnjJD433k6OA6oAyWUZE9i0Z3Jrc9MeL0ZDWcwlXpZyBDZjP+eqGvBEADt3qrAvUZr10N X-Received: by 2002:a05:620a:458d:b0:78b:ea82:5eb4 with SMTP id bp13-20020a05620a458d00b0078bea825eb4mr2028150qkb.25.1714001662221; Wed, 24 Apr 2024 16:34:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714001662; cv=none; d=google.com; s=arc-20160816; b=cKBGU2SdBAzQYR9HcJN/TttgPJ40j4hTg1nVxg6xNqZ3v8yeHws+vt55oKJoft/Wts hr8+65soRbHCKDloLJsnq5DNT517ieY2lfTl5tHRrfeN6yYpBK6qiZnSFZzE0o/xYc9O Met6L044KZYDviuzYPAkX+U2CBJd8JKjmwvoia1ihkF9u7Z0CMoPHAcSblFX3QCuUJ0F x9uEaPJO1KdlGQJDPwCGr0Do0e+S0uG/rGWmOoHsZ6JlDeJcJ+klEUWmsMToY/3VyvLl KhwB/W+NhcgFBJMYlZC6vFtgxNTUAGWfRkqQYKi1EAyx3vjb9GSfxhSra8IzBGutgYY0 oa5w== 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=cTEdbzvaPZ/DA9LDwzi5gJjEqG8BdnHD2TfpPnHz8Cg=; fh=yIXiVAD5FpZIeFc+c4tpRY/5DBPhgcMqmQf6hSviIlk=; b=DK3sXDs00X06+Fmkg9TjjXdEZS4fEvxhfPhCGNMbHdTzStC4juhBwqOFpGXkrWhj0D ep54nGjmd4NeEmAeWXEwGLNqCpcFTujZp9AqDoX4igduH1+fW3BZnjxAxaGZbMM/1+Uj A5M8d1sSir71aXSsuP/E+AStVQyiHQ8meRsb3JLbX5ZXVAMs7+VBQ2OvWEdIXFoijctI kg7GCcjWuASccYLj1USlbs3QLutnAlEFa5jNoJBjYYnyeoTzcZJg7FRIzKSY6XOvuqDs tfiO8dOMQa0YvW8yiGJZhg0PqoqLFsTmQp0m/FSfnI5vnso11mw/3WSbbit0fqv39/EM uXAA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WtrZRvAR; 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 o6-20020a05620a228600b0078d6085f5easi15972250qkh.304.2024.04.24.16.34.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:34:22 -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=WtrZRvAR; 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 1rzm5m-0005yK-Km; Wed, 24 Apr 2024 19:31:58 -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 1rzm5k-0005wn-PN for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:56 -0400 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzm5j-0003gI-Ab for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:56 -0400 Received: by mail-pg1-x533.google.com with SMTP id 41be03b00d2f7-5cf2d73a183so1093497a12.1 for ; Wed, 24 Apr 2024 16:31:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714001514; x=1714606314; 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=cTEdbzvaPZ/DA9LDwzi5gJjEqG8BdnHD2TfpPnHz8Cg=; b=WtrZRvAR7c8/KLgs/GCQq0vICz6EYMXmPtlum+7ELxOIwNO8p10TZigFK6quMGyOGT ukruwTK+s9ItUmwEd4JS9ZT8frxhUbHgJ7F/DpdYa23chCM+SR2y2Eu+S5TNEOyiKGDp EMk5qLloSoM6q0Xf45v/rEf3XShCSGg++hanXuITghiilHN5GonTqTywu9elkVLHmcZF WQTCIJUwRoSQFsWFFIqUDXq21sX6SDb7yeLaTjKY4un1b64YApyE31zovl9Q9URNlNyD wCKkmc8ynhCquyMWc2kZz1OUW2PelYH2DVq4oWkIA+ZcdetafIjbVszyUZGkSGIeo7Eh D/5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714001514; x=1714606314; 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=cTEdbzvaPZ/DA9LDwzi5gJjEqG8BdnHD2TfpPnHz8Cg=; b=uw/k8AtQpb4JwtCMFqFrvbhbiY23GI7NHMMgXsx/Fy/5j/wn609cZwCrImbgcbhkef u9W8jXhGxan8wGIC6zJ74fk13CTZ3jkph1KBRX8B8F+/cp6eP/mD26bGKDMxi1gNwfYl YUwXHAxRzatA7wSw/rnJzGrWdlib0zfAF4ttpE435Q/s+MwrNsuHf7vXFy6bJM51jbca u3ClJU7hSnyNMdjv5luKnTdLfhM40IrPOakpIFTEVkQ246a2oNmLe0AwKtWLGO2VyyiN hoAuikqNmqPKff4bFY4lDXgj/RB+7ZnKqGGD1f8RsU6HJ67c38VUYJNS3QBSC806GRvD Z+5Q== X-Gm-Message-State: AOJu0Ywv/X5b6IHfnOCDqnJfJ3IyLral6GSvm8Qo+JsFh26VvtSZDubx 0j1ewUHVpQ1bQM2VoO/CRphGchVjLxbAah3FwIwZXHbLoD4qqWaVCyXExuH5JdMjlmrxRjdPOfr o X-Received: by 2002:a17:90b:98:b0:2a2:faf4:71da with SMTP id bb24-20020a17090b009800b002a2faf471damr1706459pjb.10.1714001514068; Wed, 24 Apr 2024 16:31:54 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id z24-20020a17090abd9800b002a56b3931dfsm11737859pjr.49.2024.04.24.16.31.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:31:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: "Edgar E . Iglesias" , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH v2 24/33] target/microblaze: Use translator_ldl Date: Wed, 24 Apr 2024 16:31:22 -0700 Message-Id: <20240424233131.988727-25-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::533; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x533.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 Reviewed-by: Edgar E. Iglesias Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/microblaze/translate.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index 08d98dab07..bac7e30cd1 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -24,7 +24,6 @@ #include "tcg/tcg-op.h" #include "exec/helper-proto.h" #include "exec/helper-gen.h" -#include "exec/cpu_ldst.h" #include "exec/translator.h" #include "qemu/qemu-print.h" @@ -1636,7 +1635,7 @@ static void mb_tr_translate_insn(DisasContextBase *dcb, CPUState *cs) dc->tb_flags_to_set = 0; - ir = cpu_ldl_code(cpu_env(cs), dc->base.pc_next); + ir = translator_ldl(cpu_env(cs), &dc->base, dc->base.pc_next); if (!decode(dc, ir)) { trap_illegal(dc, true); } From patchwork Wed Apr 24 23:31:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791593 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1106614wrq; Wed, 24 Apr 2024 16:33:53 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXqz48YJuWZLQwl5/edtOXLGmncKfaXz29AofgOqIm6hwFgGJqqwpnjxHFp/6Hu4vMOqjzBG3jxLfML73SO8fmj X-Google-Smtp-Source: AGHT+IF4MdxYVGcJ252mzMDno7J+ZoE3OKrVBJ4sOflsALOBDZuD+wih3rfKoOGBshqll9d1V/eg X-Received: by 2002:a05:622a:5d2:b0:434:feb7:9d77 with SMTP id d18-20020a05622a05d200b00434feb79d77mr4550381qtb.32.1714001632829; Wed, 24 Apr 2024 16:33:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714001632; cv=none; d=google.com; s=arc-20160816; b=KZhh/rnTcnFjlJOGbYSCcpDkYMSKDd57J3rhHcUjZ1IN6gmKUhQg55SOUjbsiORFG2 SthWDBWZsytuVXKWaD62fPuXG7BIpmCsnex98vxRCl/arLKPuAerOcCPUGRoq2t59YQJ V2LWIULBaDPUzu7QX6tkNygs00SVZfG5Ify8Q7dtzIlP9je+LhtVGn8K79lmtIWPDzWw Mg0PnFdtPsbM8Gv9piHO6j9w61LC1YTgyst/nb7Im0YI/2n1ktxytRT5z5LZiL5MqScD 1HvwDELaE4gEx9yBeH5N/N9tngeUIkZ508uKToSMxUWdloYTLSSumIGEp0tIfuT0tr64 Cp3g== 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=09Km9Y28Pm2ntP55oWjWMOkK8jfRjLsDy4w+uTrJZck=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=EgWmsyfqWDbNsEYwWg5EgpNqJVC46sRo0YoPL/8niWE1MK+vfGxLurtp0OFqzAsC51 Z4fxU7Usy4t0pgMBMkLObL7+ehJ/Da3wQAeCDJBVZFBJu5rW0vf7hMxRQddql8hTvIJX MFwMPrRUUjOlD3vnBPq0csCq3tbVWiNqtaImrLi3q24bHbMVeruZrfijVla9xt53m3Ut ijmvoDgBHdZxgeoOx5ORhcV/QjWu7ENXDkpjUej2Svxx7pI8qSwnsaBNNk7qJaFcxWeO Vz+miaoQrXuVPlEXqTOkul/R4ul03ZiFppKFywSm+YAcfss5Bo1te9igPcraMOOKwf4r 4jeA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Nj3rmjJu; 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 er13-20020a05622a5e8d00b004313889961dsi14212186qtb.557.2024.04.24.16.33.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:33:52 -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=Nj3rmjJu; 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 1rzm5s-000616-EI; Wed, 24 Apr 2024 19:32:04 -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 1rzm5m-0005yP-Qh for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:59 -0400 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzm5k-0003hP-6C for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:58 -0400 Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-2a484f772e2so329197a91.3 for ; Wed, 24 Apr 2024 16:31:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714001515; x=1714606315; 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=09Km9Y28Pm2ntP55oWjWMOkK8jfRjLsDy4w+uTrJZck=; b=Nj3rmjJufk6gFD0JI6eVp1+VQDKetWtK204aqBnC8IhNxjIIYzwFMydjvG4LJq14QR 4xRtv6kYVHNgOU/zQIz8exQtQGrJTFvri7W70weKQE9o0Ph+46jD7h7J+sbUFrR05oJ6 Kdf9LaiOMqXd/l1ZN37jQNFRT/QYX5I5XENNjwH9EYF02xJR/oWsNLyXJt8bq8VLvyf4 7g6myyYopgoLxGosPh8l9MzZGbV5rnq0Wgm/X/JDlmdyoXDYIo9xot8PjIKsGPI2RXIJ RrZ+Sl93px6hKRfoJwS3TK4PlbIUgG3K1ia4OX0G0hVpS0l+lU0aK7HodkuHtBC7LUo4 o9Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714001515; x=1714606315; 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=09Km9Y28Pm2ntP55oWjWMOkK8jfRjLsDy4w+uTrJZck=; b=bsNIuD2iLOof9V1niEttSyyC3k/mUOHm3OjG3A9FTpCwlFlJ8w2Z4K3t4a+/oZbX1Z +KI+cJaMHx9an2vWpLD6+ACTiqL4jJr+v4Hrab2eZQm2+ykLDP9OBIpn+791ie7TApPn kK8pAeVd8A6cUHWHh9Cpy14ErWVcWAjlO60n0Ehp6ccY6k89z8QfION6EEbagTm1B75Y zDnwAH3PskBV5aOKo2OqQ97U9Sj4O/08N/WmuiWgLUwS6/Xt0ngGqnNsX/f2CG48QcyP gBrPui70w8MUNf+mVhvStdnXEYj2zf+YIWoE8D2xK62Gf5L6QlarkWLwdLY0Kvs43Zi0 w6zw== X-Gm-Message-State: AOJu0Yyc0aetosg9J7vR5aJBTCOoOCAJ39jAjRKi/dVUa98/U2TDycSs c4DIGkFjn99ileBbz/G7pq35mFPjBU0tsuWhuL8sEowbFy9uB5oelS5rTZpypNfIJOnNtnJnKU5 A X-Received: by 2002:a17:90b:3581:b0:2ad:c098:ebca with SMTP id mm1-20020a17090b358100b002adc098ebcamr3726782pjb.20.1714001514914; Wed, 24 Apr 2024 16:31:54 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id z24-20020a17090abd9800b002a56b3931dfsm11737859pjr.49.2024.04.24.16.31.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:31:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 25/33] target/i386: Use translator_ldub for everything Date: Wed, 24 Apr 2024 16:31:23 -0700 Message-Id: <20240424233131.988727-26-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::1036; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1036.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 Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/i386/tcg/translate.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 6658adc4bc..6f04a77eed 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -23,7 +23,6 @@ #include "exec/exec-all.h" #include "tcg/tcg-op.h" #include "tcg/tcg-op-gvec.h" -#include "exec/cpu_ldst.h" #include "exec/translator.h" #include "fpu/softfloat.h" @@ -2138,9 +2137,8 @@ static uint64_t advance_pc(CPUX86State *env, DisasContext *s, int num_bytes) * This can happen even if the operand is only one byte long! */ if (((s->pc - 1) ^ (pc - 1)) & TARGET_PAGE_MASK) { - volatile uint8_t unused = - cpu_ldub_code(env, (s->pc - 1) & TARGET_PAGE_MASK); - (void) unused; + (void)translator_ldub(env, &s->base, + (s->pc - 1) & TARGET_PAGE_MASK); } siglongjmp(s->jmpbuf, 1); } @@ -2718,7 +2716,7 @@ static void gen_unknown_opcode(CPUX86State *env, DisasContext *s) fprintf(logfile, "ILLOPC: " TARGET_FMT_lx ":", pc); for (; pc < end; ++pc) { - fprintf(logfile, " %02x", cpu_ldub_code(env, pc)); + fprintf(logfile, " %02x", translator_ldub(env, &s->base, pc)); } fprintf(logfile, "\n"); qemu_log_unlock(logfile); From patchwork Wed Apr 24 23:31:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791602 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1106986wrq; Wed, 24 Apr 2024 16:34:58 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWsCwTYKUiaNv5DhHHp322gZ8K+Xi/bA7PqUwypIZ9+yF/HVaYddJw15mKuCQCkxWuh2mvlZqzi/lSXW/TDpob6 X-Google-Smtp-Source: AGHT+IFfxNFsUqj7wgR3X9i4pAlUCSM6adhRKIAgaaGLEVv6Z32mAXdv45noDXHjYbmY94DXv0XY X-Received: by 2002:a05:690c:358a:b0:615:3858:d154 with SMTP id fr10-20020a05690c358a00b006153858d154mr4508698ywb.30.1714001698056; Wed, 24 Apr 2024 16:34:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714001698; cv=none; d=google.com; s=arc-20160816; b=Zt2UVL1hM9313cRIhCmInXhWOVDx3i5Y2blwmaY1Mhzv6hyTdVS8uOwpWBdr4rZV8v kGWEwTVAzrcR+TUOp75htCXPLVI+S0i2Cf6vn2C2C55W/vEm8Us0aP2t4gVU7pvMM6x/ OlKsjkCIxBgW98IRCPTDhX3m4kl/uo+VKAMK/ZWFudc/Plpq0LF/GLRpVHi69j2nt9/z hBP9zWN0imlqfuIbnLnLPad3lTptcn/yjtqphkk4kpzJWTSGJny9VfRVC9GWgyXVVZ4p WqLACS0Iz6I6/WBlWer33VW0+jiJUYUJXl2MTs2SFFnpU3/fYw+Sg7oPHD4PEsADfwfd 9Saw== 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=Ku4i14FBhF0AsxG1wJUIaWCeb9p5uUrtgrDPrlUkN+c=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=nLj/QACFVsRIaLsXADtjGwPFLBX3IsRSPKWy1aefCDz5NdzV1VYagndW7FhuICXZHT NkNfO1iq6DlW4w4lbw75nRMlhtnNQWDmy7aoQiDg5nWvXE24V1LOM/n9KhQ7PJdq+eMe nGSvk/tpDeqzZtoe1z+k6MgvBQGK0pSfvSVyW+Cv/lsbqNpbZ8zVfoTElvOs0AM+xbLC R9HgWosTONAii7EBHVchb0UhVk69ttNXL+9m+gXl4wKkpwm3qmPutfAtIpa1XN2nbiMD EOrOVknzkskED3gzpG8WmnvRQEUnkuC0/NSVs9+N32hnFUAwclHiN66xTHBSxrZvnMdY zO8g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MbyRgM6y; 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 fv27-20020a05622a4a1b00b00439755df2d0si11792046qtb.620.2024.04.24.16.34.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:34:58 -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=MbyRgM6y; 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 1rzm5t-000626-RE; Wed, 24 Apr 2024 19:32:05 -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 1rzm5m-0005yN-MJ for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:58 -0400 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzm5l-0003jO-2L for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:58 -0400 Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-5f415fd71f8so323890a12.3 for ; Wed, 24 Apr 2024 16:31:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714001516; x=1714606316; 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=Ku4i14FBhF0AsxG1wJUIaWCeb9p5uUrtgrDPrlUkN+c=; b=MbyRgM6yRb0P7/h670jKAdxRcsrE11V1QKkYS8PWYVWvvdWgArRGoUpoolF610aqhK oEvL3fHEyo+cWQskY1YscK2s6WL0L2ZfZpjjiLJCXZ3SQCwwyNi0mvVIQXrRCXx6fuaf yPbhYgc3DquhA6dRtw9hFgJ+1SLvMpk+DD0FS4OhLt8OXlUzPpvz4EV3ZJ1eztQAoF32 xQZyRTrq/+DJetDZcfVETghqXF5CkHUc2rkOJtp560UepwBmEG52Q7c8Mnmx2kmzjlCM IGrZYGJzfaruFrDiru1gQ81A0TpZe78niaHL5oqYqA6TJgRqc6IIfzIdY/USLNslASM3 QD2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714001516; x=1714606316; 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=Ku4i14FBhF0AsxG1wJUIaWCeb9p5uUrtgrDPrlUkN+c=; b=h6RCHFKbVn9Q+MCaRwADWEEE5Bs6/jVA8pSsg7W4tGTI3KtYYD0VkvbRAkB2iWab6n zZVgcbm69el5n1wDjK12id1JUm2iS5JYI84unykeljTe45cV5e3r7MkR6Ht9Fweq3r9I Ie5j+XwwP+xcxbgLJdFcJn88YD3ry00KIj9wu/Uilq9GC7Yp1hBP2ZrUAbThnTuZnCmF Dpv6TiW0c+qWK4D/6e98ZaszMxmnRSGaS4nZshcA0dLmGKSed7SXOVgGm2b+OGapJ8fa TdxkcrPmtPOOLXXz5095V6jnnGJ7oVHBYBlIfSOe/ecp2rFD18hP9u69rPACD9rkB7sO SdDA== X-Gm-Message-State: AOJu0Yy+4zza1PoqtkGt18mNkaB6N/Fn1OAGashf80u1qgnvQ5EOIPhL h4n7sHRNYcKWOoQzi9TgI6HAYiNAGcFqQBbwR8UmHdDU6hSzdSFFLtBa79SVnB7BBCqkr8zRxSH l X-Received: by 2002:a17:90a:4884:b0:2ac:24ed:c930 with SMTP id b4-20020a17090a488400b002ac24edc930mr3940866pjh.35.1714001515782; Wed, 24 Apr 2024 16:31:55 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id z24-20020a17090abd9800b002a56b3931dfsm11737859pjr.49.2024.04.24.16.31.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:31:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 26/33] target/avr: Use translator_lduw Date: Wed, 24 Apr 2024 16:31:24 -0700 Message-Id: <20240424233131.988727-27-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::52d; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52d.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 Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/avr/translate.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/avr/translate.c b/target/avr/translate.c index 6df93d4c77..2d51892115 100644 --- a/target/avr/translate.c +++ b/target/avr/translate.c @@ -24,7 +24,6 @@ #include "cpu.h" #include "exec/exec-all.h" #include "tcg/tcg-op.h" -#include "exec/cpu_ldst.h" #include "exec/helper-proto.h" #include "exec/helper-gen.h" #include "exec/log.h" @@ -173,7 +172,7 @@ static int to_regs_00_30_by_two(DisasContext *ctx, int indx) static uint16_t next_word(DisasContext *ctx) { - return cpu_lduw_code(ctx->env, ctx->npc++ * 2); + return translator_lduw(ctx->env, &ctx->base, ctx->npc++ * 2); } static int append_16(DisasContext *ctx, int x) From patchwork Wed Apr 24 23:31:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791595 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1106749wrq; Wed, 24 Apr 2024 16:34:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXaN/cUNfVj8SQC8PnIFu99lVeaNg6jZG2YuvZ/YvwuTMUtjF8vv9O3LttSKjXqhqtLIz7FJNHdFJ6RBT3ag5p9 X-Google-Smtp-Source: AGHT+IHyx0uXuanRY4GXTopdYkuu05dbIoysXFQUtxGrBPOXZg4+bVEWtZ3aK1eBZaAMJwQUhmPM X-Received: by 2002:a05:6808:6146:b0:3c8:4303:9a7 with SMTP id dl6-20020a056808614600b003c8430309a7mr3468984oib.10.1714001656274; Wed, 24 Apr 2024 16:34:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714001656; cv=none; d=google.com; s=arc-20160816; b=bn0vvTef6myX6pm3uaeX4fenect53pEJotMhZQ/HuOtdAN7eve/DBjPsmMvtqAK5/V 2UphoqWGXFVg1ly4f3fPKhIBhm/JfLI5F7ZlfD1ZDIGFmrEvPnb6IJf6mT3WwB+EbvU2 iDFnrxBYaW/5hoh9QYy63myr3st8bv/NoQqjzK+kIDwpkH10/6mNasxVDbQWPnczWcea WuS6BldwSCXmYRXTb3ePfOJJoR3ZtxSfXkcVx549caCXlNGZjcC4r6XitjYXDAiXEOW+ 3B6N6v/td1gLonAn3sk/NAYo7SSEj8MUSoN0RQF1Xx9cP82r11J2bymWfdS0lyOH4RDu /SYA== 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=LFwVHeO0xdQZE4q/p0sWN9ZrSqg0kbbJP7VPGYxlODk=; fh=yIXiVAD5FpZIeFc+c4tpRY/5DBPhgcMqmQf6hSviIlk=; b=oWlo3xDNUf/OL+5sakO0hzDc1KmgHTv0+NzdkFzfRImVksAyzxfcEGqqHfO3B2Rf3e GtIgZyyGcww8qecvsVoUvKw18Di1XofiD9iR5AOAhGp3P1TaZNA58uDXNHone8IyEuJD GIFuC/6sONMARDeIGBKKZWN7W/I56rI/odL2KVEXmloyhcSDhd2XiiELnUg/mHyAnv5J EA2QKlirNlJe70xlRiXK2nBlpCifrlDa9345xj0HB02FXvprr4rnoGy9JFcYEssgPgUk 4+a2FL9N1rJKw6rsX0yzW44FKjK+0Yhb7doykSHrZdDy/AjAUTiFIix77/8Gkt+aSZCG Pruw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="aKN/BtH7"; 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 b14-20020a05620a0cce00b0078ec3e9ea8csi15356108qkj.513.2024.04.24.16.34.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:34:16 -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="aKN/BtH7"; 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 1rzm5v-00062I-Em; Wed, 24 Apr 2024 19:32:09 -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 1rzm5o-0005zG-4Y for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:32:00 -0400 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzm5m-0003kw-3Z for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:59 -0400 Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-5f80aa2d4a3so374670a12.0 for ; Wed, 24 Apr 2024 16:31:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714001516; x=1714606316; 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=LFwVHeO0xdQZE4q/p0sWN9ZrSqg0kbbJP7VPGYxlODk=; b=aKN/BtH7f0SwgqWPEu9bNYSFZ5duD4NI1gtb8SudsqpXHgT95y3IT73UdrcwLtVZd3 vLs/FHsGP5gu6eaZRPAgoHi+hgju/e2bU3/lcg/GbfgxkKljmkngcnmvsllHB9G5O7QK iEKT0iKu3qenQPZv9wEKGZxblxG03XiNRLjrelfJ6U9hBdP3q66TF7X0GU87/8rj9F/V XmjZN7CqHoHSYy6QNlp3kOGjhBN0+iDPvuQQFlXsINqq6hJQvlKz90GbhjeJHMa2U4of M9davGxNgSHmY3MQDT7I/tTFa1AwfGP6JSlXy8++cTfDVHh5e9tpELvQfC6sDZzFLIVH POAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714001516; x=1714606316; 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=LFwVHeO0xdQZE4q/p0sWN9ZrSqg0kbbJP7VPGYxlODk=; b=thqBm6cbKEepfo3EGdKOrWFwVJ0gsKSmICYJ8aiDv7sUWPTozLMhqaeu/dnDZ+MjYb FUE7F2ij4UsaGJvZKQLY2v0PSCPE4G0msDjxFkx7CfujTfksFN9NK3PJMO4IwanBBMmz 44N+mr73xtp+e2LKIcn/kL4ZRv7ML9BV/CapGMsUtQIeHSBarhfdHFrbWn4jLEA1d3bv 4gk8pw4kdoPwAGNEtmGxlC3j3hSQIXE0lv5lGWGEHFCHzjENoHlc+LyIctsvq/ug0Co2 hEwIfEyPT5PZGk0kPCenmHWVoMoxYIE/H37Vdc2B7JE8ONZnlRv28ypk4AaAQzcmkHhA 5xZQ== X-Gm-Message-State: AOJu0Yzqu5b+isNA3XjOJ8HsRzhPRHIiQjqdKvnwSsPSB4fRCNqKQxOX a/k3/Pib/XHEffYPBNVYOHmhHuiwwyDcQgaB7WvsMuHNbuVkMdJLL2B63MOmPielQAz8sEvKdkz g X-Received: by 2002:a05:6a21:880a:b0:1a3:65af:9baa with SMTP id ta10-20020a056a21880a00b001a365af9baamr3714878pzc.62.1714001516676; Wed, 24 Apr 2024 16:31:56 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id z24-20020a17090abd9800b002a56b3931dfsm11737859pjr.49.2024.04.24.16.31.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:31:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: "Edgar E . Iglesias" , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH v2 27/33] target/cris: Use translator_ld* in cris_fetch Date: Wed, 24 Apr 2024 16:31:25 -0700 Message-Id: <20240424233131.988727-28-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::52b; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52b.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 Reviewed-by: Edgar E. Iglesias Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/cris/translate.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/target/cris/translate.c b/target/cris/translate.c index b5410189d4..bb2d6612ba 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -222,37 +222,28 @@ static int sign_extend(unsigned int val, unsigned int width) } static int cris_fetch(CPUCRISState *env, DisasContext *dc, uint32_t addr, - unsigned int size, unsigned int sign) + unsigned int size, bool sign) { int r; switch (size) { case 4: - { - r = cpu_ldl_code(env, addr); + r = translator_ldl(env, &dc->base, addr); break; - } case 2: - { + r = translator_lduw(env, &dc->base, addr); if (sign) { - r = cpu_ldsw_code(env, addr); - } else { - r = cpu_lduw_code(env, addr); + r = (int16_t)r; } break; - } case 1: - { + r = translator_ldub(env, &dc->base, addr); if (sign) { - r = cpu_ldsb_code(env, addr); - } else { - r = cpu_ldub_code(env, addr); + r = (int8_t)r; } break; - } default: - cpu_abort(CPU(dc->cpu), "Invalid fetch size %d\n", size); - break; + g_assert_not_reached(); } return r; } @@ -2868,7 +2859,7 @@ static unsigned int crisv32_decoder(CPUCRISState *env, DisasContext *dc) int i; /* Load a halfword onto the instruction register. */ - dc->ir = cris_fetch(env, dc, dc->pc, 2, 0); + dc->ir = cris_fetch(env, dc, dc->pc, 2, 0); /* Now decode it. */ dc->opcode = EXTRACT_FIELD(dc->ir, 4, 11); From patchwork Wed Apr 24 23:31:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791589 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1106512wrq; Wed, 24 Apr 2024 16:33:38 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXxZ9nCE7K/R30rpO0JE/rjvoJt48E3wLJnVj7f1l85WFVsRsEAi+KUkykhdbEtjBw4z6g2odRdH7L75ymCum3X X-Google-Smtp-Source: AGHT+IHK5lCtBV+G2nd2xJRKwxwNhCnepnk6SKLB/YbgYuv5hLuRjLTjqGRYaF6vkQEPCqLTD2LN X-Received: by 2002:a05:620a:6207:b0:78a:86:529b with SMTP id ou7-20020a05620a620700b0078a0086529bmr3890445qkn.29.1714001618547; Wed, 24 Apr 2024 16:33:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714001618; cv=none; d=google.com; s=arc-20160816; b=FuTIhtS7pYvZXei7EaIUCieEn4+04pCBk6vPoiKkeKQPaKIXue14Xy/UItdSrLF82M BpW4JEVk5VOBp9fq8VsTB3SKZ7OGK61JK9diW2TRj6MdD34yPJgUFAulVg9AwjPcmG9Z jXLfW832I5OX1txA9MqEkoB+xwuht9YhTHxO0QjPk5Mjy3wcF8tAHSecQgUZex8oPg0D 2xPzl9q4LFT5Qd/NzOwcjd8krzxUZ6ti3DZATtpujEhj8hxxQAP0gBN1jJNoj8wFvC80 RgOe7rAa73E29ESH/wroswDgOba11pKt7PzxM8pI3+X0qIY7v9UWDY6magnvv78/93OP mR/Q== 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=eL11UZGpeVEq4VOMmX63mOyK3p1fvPoFDCh9Izq0OCE=; fh=yIXiVAD5FpZIeFc+c4tpRY/5DBPhgcMqmQf6hSviIlk=; b=nbDbS/T6MeisvdJ/GSFXjV/Cw5l2BXSAyhi6lzDit6Ltb+qYS+5osQIWeMR5vmtLkl +LhjOrE/RAKdu1ZIbpgK4rsNcSHUxOR/uvglO2MCWuDYBjc7c4W2dedmRfo+kDMdHxef NiApxACoQDgHHtfA2ZaYKb1DtwwkTKPG6MjGSCOmBRhgVRFAiJxS0R7BZ5kJcPMLKCOI YI6AgEmwExATv4eTrMb1QfNSLDelKBEOULEqX+HX8JqhnV7n7sfUhwYncXUA1+ImzPFN 6rJTsSvOgDlfN3HWUHcVrV2QEGiI/JlDb3kpVyFSPkHgogtuZsiTM+WYSbBr9F2z3EKn 8JUQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TahMWrxZ; 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 l14-20020a37f50e000000b0078d635c8189si2286269qkk.416.2024.04.24.16.33.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:33:38 -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=TahMWrxZ; 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 1rzm65-0006Do-FR; Wed, 24 Apr 2024 19:32:17 -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 1rzm5o-0005zw-SN for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:32:00 -0400 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzm5m-0003p8-UM for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:32:00 -0400 Received: by mail-pj1-x1034.google.com with SMTP id 98e67ed59e1d1-2a68a2b3747so337908a91.3 for ; Wed, 24 Apr 2024 16:31:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714001517; x=1714606317; 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=eL11UZGpeVEq4VOMmX63mOyK3p1fvPoFDCh9Izq0OCE=; b=TahMWrxZTdmUjekvsySttKQZaEzULFih/zlDcN8HZhnKEM9WxKzdACMP9vqDqivFsq dfh920Kg0D/GBF/KsxRkFdsdiJk72kpMc9slN3N5Z4SJDrVBSQFmhki9dNDQxV+wly3O xPd/Tiy08sqo86wevDG15U9xQoNTCefcER4Ziuqb2WxEYabjG6UUtLBEqpcAH/fS69U8 ByJP3lGMC+hVSim6o7k9DWxRBZbWqHaQ7zAEu59dFuCI5Gl64TSk1YNMvcDjWyh5yE5v wP6LywdxA0yzOYs9kdbU1PV8/1sh1O9S61kYBZYixT0HdaoFWp6j+P/AxV5qHYKqGr+Y IM5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714001517; x=1714606317; 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=eL11UZGpeVEq4VOMmX63mOyK3p1fvPoFDCh9Izq0OCE=; b=mQEE6gt2KUe+aajAYwsUcTs0GowMHpu71JCrQbQmO1lK8qvf5FHcVEzhs3x1FyNqqG bPo3gkzYoD9VqZqIVvZwORtdB+C9//ejmWdBKPYl+FpBIYcmAiEh2TVJT9nSR6pPZInw qSPaCO/dIY/JjKcU0qzIWhfJ8Gy8eRljtU8VNyqGsiceIsrKdrcV9DjaWwwwh6ZtSteX E8dtZKiql5GjAOYVdltkEmYQOFRoD2L19XOQ2mpwlvTtKcY2RRdhi07lXniMiUFhLCnD rcrvcwNMwHVAEr/5v6C3p5FqP6Ce/CStrsT0JQlPI0ZeYtRV2Duc1nDFt3PLfzbNQ45+ nYug== X-Gm-Message-State: AOJu0Yy7BCMj330dSZiDE03vtdejBXxsJetjUdXQPjAeaiM1ygd8m7Pk UsR+5B7yhv9aCPWMpvn+2BGuBNKXdhszpzNDYpmdJ/Yw0clDOz10hrhRSp9heUHfutmQO9/VTS7 / X-Received: by 2002:a17:90a:778b:b0:2ac:91d9:9fd5 with SMTP id v11-20020a17090a778b00b002ac91d99fd5mr3592005pjk.47.1714001517575; Wed, 24 Apr 2024 16:31:57 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id z24-20020a17090abd9800b002a56b3931dfsm11737859pjr.49.2024.04.24.16.31.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:31:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: "Edgar E . Iglesias" , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH v2 28/33] target/cris: Use cris_fetch in translate_v10.c.inc Date: Wed, 24 Apr 2024 16:31:26 -0700 Message-Id: <20240424233131.988727-29-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::1034; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1034.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 Reviewed-by: Edgar E. Iglesias Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/cris/translate.c | 1 - target/cris/translate_v10.c.inc | 30 +++++++++--------------------- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/target/cris/translate.c b/target/cris/translate.c index bb2d6612ba..a30c67eb07 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -29,7 +29,6 @@ #include "tcg/tcg-op.h" #include "exec/helper-proto.h" #include "mmu.h" -#include "exec/cpu_ldst.h" #include "exec/translator.h" #include "crisv32-decode.h" #include "qemu/qemu-print.h" diff --git a/target/cris/translate_v10.c.inc b/target/cris/translate_v10.c.inc index 73fc27c15d..c15ff47505 100644 --- a/target/cris/translate_v10.c.inc +++ b/target/cris/translate_v10.c.inc @@ -165,20 +165,7 @@ static int dec10_prep_move_m(CPUCRISState *env, DisasContext *dc, /* Load [$rs] onto T1. */ if (is_imm) { - if (memsize != 4) { - if (s_ext) { - if (memsize == 1) - imm = cpu_ldsb_code(env, dc->pc + 2); - else - imm = cpu_ldsw_code(env, dc->pc + 2); - } else { - if (memsize == 1) - imm = cpu_ldub_code(env, dc->pc + 2); - else - imm = cpu_lduw_code(env, dc->pc + 2); - } - } else - imm = cpu_ldl_code(env, dc->pc + 2); + imm = cris_fetch(env, dc, dc->pc + 2, memsize, s_ext); tcg_gen_movi_tl(dst, imm); @@ -929,10 +916,11 @@ static int dec10_dip(CPUCRISState *env, DisasContext *dc) LOG_DIS("dip pc=%x opcode=%d r%d r%d\n", dc->pc, dc->opcode, dc->src, dc->dst); if (dc->src == 15) { - imm = cpu_ldl_code(env, dc->pc + 2); + imm = cris_fetch(env, dc, dc->pc + 2, 4, 0); tcg_gen_movi_tl(cpu_PR[PR_PREFIX], imm); - if (dc->postinc) + if (dc->postinc) { insn_len += 4; + } tcg_gen_addi_tl(cpu_R[15], cpu_R[15], insn_len - 2); } else { gen_load(dc, cpu_PR[PR_PREFIX], cpu_R[dc->src], 4, 0); @@ -1095,10 +1083,10 @@ static unsigned int dec10_ind(CPUCRISState *env, DisasContext *dc) if (dc->src == 15) { LOG_DIS("jump.%d %d r%d r%d direct\n", size, dc->opcode, dc->src, dc->dst); - imm = cpu_ldl_code(env, dc->pc + 2); - if (dc->mode == CRISV10_MODE_AUTOINC) + imm = cris_fetch(env, dc, dc->pc + 2, size, 0); + if (dc->mode == CRISV10_MODE_AUTOINC) { insn_len += size; - + } c = tcg_constant_tl(dc->pc + insn_len); t_gen_mov_preg_TN(dc, dc->dst, c); dc->jmp_pc = imm; @@ -1164,7 +1152,7 @@ static unsigned int dec10_ind(CPUCRISState *env, DisasContext *dc) case CRISV10_IND_BCC_M: cris_cc_mask(dc, 0); - simm = cpu_ldsw_code(env, dc->pc + 2); + simm = cris_fetch(env, dc, dc->pc + 2, 2, 1); simm += 4; LOG_DIS("bcc_m: b%s %x\n", cc_name(dc->cond), dc->pc + simm); @@ -1185,7 +1173,7 @@ static unsigned int crisv10_decoder(CPUCRISState *env, DisasContext *dc) unsigned int insn_len = 2; /* Load a halfword onto the instruction register. */ - dc->ir = cpu_lduw_code(env, dc->pc); + dc->ir = cris_fetch(env, dc, dc->pc, 2, 0); /* Now decode it. */ dc->opcode = EXTRACT_FIELD(dc->ir, 6, 9); From patchwork Wed Apr 24 23:31:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791607 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1107526wrq; Wed, 24 Apr 2024 16:36:33 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV9U2IiQ/LuuMYrJ6VOl/o1ztyNgcJBnivnCKSId2A+BV6SQr19piM0qrXwhzBMW87sYbFXrj5ow7Se+MmDDx8A X-Google-Smtp-Source: AGHT+IFua9xRzAgxZKUenakqWKwZrcj6bgpUx9dIrKmrP+RmydDrKRTdRCYr74eH4L3uqv1U5uaY X-Received: by 2002:a05:620a:28d2:b0:790:9bd7:1a6b with SMTP id l18-20020a05620a28d200b007909bd71a6bmr173479qkp.6.1714001792958; Wed, 24 Apr 2024 16:36:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714001792; cv=none; d=google.com; s=arc-20160816; b=npFses8uhCpl3w84DlH+rcGy3TS5HtNB2LAGfMdcsE/20/ji0+MEYqjF4nKM2jXw+O sXgl1Fef21Hcq7qwj77ot628r5yy8RuKaj6GRvNpouf5GXDftLEUCb+HnXDslD1yRCfX 4KAIFIlAWzuVSzUMXiG3PgZ6I5ykeVPD9OE4FwrmCTlH8GGzZuSjWklbFvYLSERGHqNI OpfzAczpFnE17L6R611uHZXT7zOD9AAIeh7U0MDIIlYBEt/6rR5O0RVtIF0AiA+fuwzC gg+6b5X1XdsusYRYhG07t4ZTuQFtxIyfNKD4mcROlVLjSf469tGtKmjSH3NYlLBmafy0 aNog== 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:to:from :dkim-signature; bh=Vkb1QXWH8K0P/RdBZMhJSWyNsEh7cNmhz4uSK4oxloU=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=QJcY4R184Fm7XbSJp4MxOc8yCSmMpFbaP+ckV3CWOFETXqILYPvcDHhmmbisHFGWzO uNr3GFkGr7/eXiPcCeB0DHwTpnvDyE4eOxB7no37bNBLLqxpUteJ6HBqj0XJ8bs+14Ud iMzKm/Edn4dGRz9Xz6BMsrmIPt9RR3TSm3wxaVpSE9Z8GT0g11FeYwijFKotG8eqIzyt TpVJG1QnTHtPgfB0GA0w9CTGDh8njP1bU9rO2y4RRq+uXE45GafoWkzGWRw110GmJxPv ITmMbAyALyiIYjmt8uXzqoAmpLf2qMD6dvD0PK4IQ+hIbolKl4X7BstRbciooAcEeWrg HMlQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N1KX8GXZ; 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 u7-20020a05620a0c4700b007907319a9ffsi9954031qki.732.2024.04.24.16.36.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:36:32 -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=N1KX8GXZ; 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 1rzm61-00063D-5D; Wed, 24 Apr 2024 19:32:13 -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 1rzm5p-00060g-GW for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:32:01 -0400 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzm5n-0003pf-Pm for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:32:01 -0400 Received: by mail-pj1-x102d.google.com with SMTP id 98e67ed59e1d1-2a2d248a2e1so1154364a91.0 for ; Wed, 24 Apr 2024 16:31:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714001518; x=1714606318; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Vkb1QXWH8K0P/RdBZMhJSWyNsEh7cNmhz4uSK4oxloU=; b=N1KX8GXZcYsDWXX/p48uQ+T/wxBr5w0Vau1w1+emWoW/ZcUoYjwRgit0bW0DP0BHNL pzwp/1R9BH2aXpFg2JFLawMil3a6n+90TEgqzauMoCVarWupXm1Nx/M9QUcGea+I9A7o EXE1viX5jAZq7Y7MVy4BmJ9er4L2JW4/vZVTPz16tva9a0e9mFwyAdg9DQTX4Pbhb/XX q4qpIFPSRTt3ST0xUCdtEQ40Btjbw/FLfv+5NyAiOomqUt7sUVoRPy1TehjSkBgZT4Bb BCP9uPeBoX9Mjs8GATn93TLMJqCV85+S/vzQJFRqrFSB2Kbx8674SM45tN9w+OoMNMct 61CQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714001518; x=1714606318; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Vkb1QXWH8K0P/RdBZMhJSWyNsEh7cNmhz4uSK4oxloU=; b=c01iXSLiSl5g9mUraXkKqud4YHvWnTZCTdSC1Bkdl+Hh83cxnEcwrih3lGVlXuhrEa Zk0jMPB+E+KmUOPX5c6dgcWt49xby4G7B0Ik5Jppt/cRrPxckb7GXDKHyNLJvAuCpn/P rHamQGm1zmbCeDdZlUoENADDFtnYDw+gEyC710CGDnGprfrijRVROx/u2oI0l62QayWc TN2EPfEr6OYewgb/+wbdTQENER3bey97poYg3HCC+53nkBc9hTucrv0sVB6K5AiDwU3+ xpdiKuc/gAQnNRUgUZ8NH3M2dBHkH1xW7NKpZEGufyxIxTP6yCQz7QC8u7i/iuviLjYN tLnw== X-Gm-Message-State: AOJu0Yy3Rz04/YqKx6ynFV/r7Vemw94H6ZncCvQ1XZv3xLpu4KWx6IVh zKI5eoZhltXHFqg9Kb0ZVcuDdn2IYDlG39UPmtMVrhpo6ys4p3IPtvQdDJMeyB+6nlk6mcTCPfS S X-Received: by 2002:a17:90b:1d0d:b0:2aa:d88d:d706 with SMTP id on13-20020a17090b1d0d00b002aad88dd706mr1695037pjb.4.1714001518476; Wed, 24 Apr 2024 16:31:58 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id z24-20020a17090abd9800b002a56b3931dfsm11737859pjr.49.2024.04.24.16.31.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:31:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 29/33] target/riscv: Use translator_ld* for everything Date: Wed, 24 Apr 2024 16:31:27 -0700 Message-Id: <20240424233131.988727-30-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::102d; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102d.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 Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Alistair Francis --- target/riscv/translate.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/riscv/translate.c b/target/riscv/translate.c index c999e942e1..2c27fd4ce1 100644 --- a/target/riscv/translate.c +++ b/target/riscv/translate.c @@ -20,7 +20,6 @@ #include "qemu/log.h" #include "cpu.h" #include "tcg/tcg-op.h" -#include "exec/cpu_ldst.h" #include "exec/exec-all.h" #include "exec/helper-proto.h" #include "exec/helper-gen.h" @@ -1082,7 +1081,7 @@ static uint32_t opcode_at(DisasContextBase *dcbase, target_ulong pc) CPUState *cpu = ctx->cs; CPURISCVState *env = cpu_env(cpu); - return cpu_ldl_code(env, pc); + return translator_ldl(env, &ctx->base, pc); } /* Include insn module translation function */ @@ -1243,7 +1242,8 @@ static void riscv_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) unsigned page_ofs = ctx->base.pc_next & ~TARGET_PAGE_MASK; if (page_ofs > TARGET_PAGE_SIZE - MAX_INSN_LEN) { - uint16_t next_insn = cpu_lduw_code(env, ctx->base.pc_next); + uint16_t next_insn = + translator_lduw(env, &ctx->base, ctx->base.pc_next); int len = insn_len(next_insn); if (!is_same_page(&ctx->base, ctx->base.pc_next + len - 1)) { From patchwork Wed Apr 24 23:31:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791587 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1106366wrq; Wed, 24 Apr 2024 16:33:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUq3XOUv3u8wT0lih4TRWoMx50VQEcnFMzqHdPE1eHrfj4a7oCuNPj6R868JQk+VV/84OV+P+cmhjs+amJUgARH X-Google-Smtp-Source: AGHT+IFWXPfemV+XGCyNmXsadU0zbVG3YYYPT5vPLl51ZAms/TJ1i9KYz4s01EyJXRGV/yxTWLiv X-Received: by 2002:a05:622a:c2:b0:437:a0fc:8aaa with SMTP id p2-20020a05622a00c200b00437a0fc8aaamr2179206qtw.23.1714001595872; Wed, 24 Apr 2024 16:33:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714001595; cv=none; d=google.com; s=arc-20160816; b=GUBdaB1lCWGdGP+caus/yw8P6zjowDQG9A4B7qT4C8ToUazLPmdUk41doC/KF/lMv8 +7ehPjc3b5lM4bV+QSk30ef+6ZAAVRI3SlHRuMFuS9MK9CFeuPMx7tw/uwBchoUgdxSs Ss+VAhkgCfOhmzzRt4fVZ5Ubct/P3uTZ5ZB7BKtfMJYTrd+2brV7UZiItgQUITwuo+F6 prxvImMs7IwnBN2OQthJroXnpPyAPCVEh+XI7olWGvYArXxtby4e1eBjUY+7OzMuaMBJ mg16Wz4BYSt5DdHqzawprQj0t7BQ9qa5IUBZmL/NAzxhgGcyY36+jPEx84QAjKlxuJKF yKUg== 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=abuDTzJtuHQkleQ2JIJcQY+Wz/0ibhtmXe6lLhOCiLw=; fh=BCLN+t2ZqfLIJQawKoImfSYKBLl07s8FDPr8BfggRIo=; b=TjQPTq61J5GrirrTFuaKjxAmKroGPcnqkbswXYatUTTUVf/kcqkw3xzK2rrbNozW17 tWg524JMsFvNXFl2n2szqIL3RQzVyuk+WYBjqIIk8hHnEh9B97gHzuXE3H8C8EeV5L8a rEtZwFLz8OG5H0NQ6PSkZ5ue6yCPq9miO79TkrOsnABCVxYobzc3NsmPSapMwM10FxvA TOD0G3xcHohQ6yVpAH6Jvxbs4nenNUCCKRtuG+k76RNlW/L0shD2kq2vY2Si10QAaPXz gpP25oJYEZ5IK945Sv9AgOKkABubTrnkqeztBtmGBi0PjBKqXrpZUCz0nqZDdUe1qRuB kbvg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yVyMBiBM; 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 d21-20020ac85ad5000000b00434663eb379si16340720qtd.638.2024.04.24.16.33.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:33:15 -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=yVyMBiBM; 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 1rzm62-00064J-CM; Wed, 24 Apr 2024 19:32:14 -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 1rzm5q-00060x-Gm for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:32:02 -0400 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzm5o-0003u3-HT for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:32:02 -0400 Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-5c66b093b86so1176397a12.0 for ; Wed, 24 Apr 2024 16:32:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714001519; x=1714606319; 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=abuDTzJtuHQkleQ2JIJcQY+Wz/0ibhtmXe6lLhOCiLw=; b=yVyMBiBM0Zuq2mOa8apAYdprlW2l3d76enipPb+/VA3QDFxzSdxd38qGjWi3irYx7f VD/JYH2UlTueZDdHgxrwvPz+9JfOumkG6QjDzQ74Xpku878rVNtnEefOu9tH5fkVd91o p7xAnxKrESUDNk5rnCS9pZuN1QGBS8GXmCz/aPrbI0sbwc+BW3Pi0nJwP8Fl63BiIOn8 9HPVu3qLl2Cz0SGj54NKq/bYwfb7jXoopdGp/CAIkYB5lYl9rdl0MIr/a2CEGAoUWrkg F8XgVnONJ5bRLaEYfeAQLot2rD1GYL7D24ZshSm2Pa0M8/yELFMu8FTIX6tsYXW5tY7J 8OyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714001519; x=1714606319; 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=abuDTzJtuHQkleQ2JIJcQY+Wz/0ibhtmXe6lLhOCiLw=; b=CpbTDK8GRUmdlvtC1R6H/apzdNdSeh1Xux2DAoxIE+qEDETALor+kNfzU8jjvyKRRj eWWPiP8V350wtPkm36/hAdHsb6osj5CZthKEZwREZiUN+QN1O1CtekKLxI778/5bPkIv gtl141mT/eEgcqsEkdq5jGQucU8zFYccMbzL+jEVDc4wtArBEurrtcqMzd7KuLK7vgDL r76Ud6ipM8SqnPiSf3QpRrPNDGZP5PXb9wAmBmFlWO23oAc87fHof1wF9CxLzEjmzcW2 QMJOU1Sq6Z9yHkeW0vDA7pSOi06ELjbGJ0Fv/kh/wcdbe5y3yuTqdm4wEdzqnrlYit04 cYoA== X-Gm-Message-State: AOJu0YwMoNSl00p8BEwNNFhfL+7TteeAClxnJV4hKqOC2ROlK9Tmourn ooo278iNmc5KDBCR+4oHBs37Js5vS8yhutaOiwcYL8+L//pWwO9xIJsltGIpuUWmEuxnxqGS1pv v X-Received: by 2002:a17:90a:6d02:b0:2aa:90f3:a4b8 with SMTP id z2-20020a17090a6d0200b002aa90f3a4b8mr1486785pjj.24.1714001519370; Wed, 24 Apr 2024 16:31:59 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id z24-20020a17090abd9800b002a56b3931dfsm11737859pjr.49.2024.04.24.16.31.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:31:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Yoshinori Sato , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= Subject: [PATCH v2 30/33] target/rx: Use translator_ld* Date: Wed, 24 Apr 2024 16:31:28 -0700 Message-Id: <20240424233131.988727-31-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::52d; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52d.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 Reviewed-by: Yoshinori Sato Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/rx/translate.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/target/rx/translate.c b/target/rx/translate.c index 92fb2b43ad..9b81cf20b3 100644 --- a/target/rx/translate.c +++ b/target/rx/translate.c @@ -22,7 +22,6 @@ #include "cpu.h" #include "exec/exec-all.h" #include "tcg/tcg-op.h" -#include "exec/cpu_ldst.h" #include "exec/helper-proto.h" #include "exec/helper-gen.h" #include "exec/translator.h" @@ -75,10 +74,10 @@ static TCGv_i64 cpu_acc; /* decoder helper */ static uint32_t decode_load_bytes(DisasContext *ctx, uint32_t insn, - int i, int n) + int i, int n) { while (++i <= n) { - uint8_t b = cpu_ldub_code(ctx->env, ctx->base.pc_next++); + uint8_t b = translator_ldub(ctx->env, &ctx->base, ctx->base.pc_next++); insn |= b << (32 - i * 8); } return insn; @@ -90,22 +89,24 @@ static uint32_t li(DisasContext *ctx, int sz) CPURXState *env = ctx->env; addr = ctx->base.pc_next; - tcg_debug_assert(sz < 4); switch (sz) { case 1: ctx->base.pc_next += 1; - return cpu_ldsb_code(env, addr); + return (int8_t)translator_ldub(env, &ctx->base, addr); case 2: ctx->base.pc_next += 2; - return cpu_ldsw_code(env, addr); + return (int16_t)translator_lduw(env, &ctx->base, addr); case 3: ctx->base.pc_next += 3; - tmp = cpu_ldsb_code(env, addr + 2) << 16; - tmp |= cpu_lduw_code(env, addr) & 0xffff; + tmp = (int8_t)translator_ldub(env, &ctx->base, addr + 2); + tmp <<= 16; + tmp |= translator_lduw(env, &ctx->base, addr); return tmp; case 0: ctx->base.pc_next += 4; - return cpu_ldl_code(env, addr); + return translator_ldl(env, &ctx->base, addr); + default: + g_assert_not_reached(); } return 0; } @@ -190,22 +191,22 @@ static inline TCGv rx_index_addr(DisasContext *ctx, TCGv mem, { uint32_t dsp; - tcg_debug_assert(ld < 3); switch (ld) { case 0: return cpu_regs[reg]; case 1: - dsp = cpu_ldub_code(ctx->env, ctx->base.pc_next) << size; + dsp = translator_ldub(ctx->env, &ctx->base, ctx->base.pc_next) << size; tcg_gen_addi_i32(mem, cpu_regs[reg], dsp); ctx->base.pc_next += 1; return mem; case 2: - dsp = cpu_lduw_code(ctx->env, ctx->base.pc_next) << size; + dsp = translator_lduw(ctx->env, &ctx->base, ctx->base.pc_next) << size; tcg_gen_addi_i32(mem, cpu_regs[reg], dsp); ctx->base.pc_next += 2; return mem; + default: + g_assert_not_reached(); } - return NULL; } static inline MemOp mi_to_mop(unsigned mi) From patchwork Wed Apr 24 23:31:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791585 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1106282wrq; Wed, 24 Apr 2024 16:33:02 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVvjA69KTh6pkaBhbztNrV593NxbkxFXPQj0QCZs7SmaPuwPMYHfMbbrd0cFeK06WEU1OqkJrgM8FQ6KX90MwJ9 X-Google-Smtp-Source: AGHT+IF86JJ4XH5/zlbWZRYXZlE5MDDb+DfV9Q80VQD5ct64rJsro9lABL4k2ENGENJkQ1xHotef X-Received: by 2002:ac8:7e95:0:b0:437:45b1:a3b0 with SMTP id w21-20020ac87e95000000b0043745b1a3b0mr4863097qtj.66.1714001581964; Wed, 24 Apr 2024 16:33:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714001581; cv=none; d=google.com; s=arc-20160816; b=tNqLANX/LvPlZJ1vKs7pDvS/pSOksv4jKuI1bzBZn/AAE1EDxMJ8URRzluOKWgZ9Y+ knEiZN+0MIwzhyT8v9dxn4mU7iaYGuy4frQUbr5hat8vYCujlsybXrcLExo3pP2KON1I um9w37RS+nkMFSdKT5MY+NVrRG/OcOLoK5mGs1uonCfyElH6691lDxCuoR/YaEqHBtiD sVGlTW/tLiQXZLpRQ+m6v3X7KcabvHbySFbQjHWhxDmoQLJsN+AWEA5shKNcgCYXJwRP G3lhqF0rWiab0dD55+0vErEBSBbwdnx/noxeW1Q7vVOxXFtrjTcxy41Evh2ZM8KCIiGM 4wWA== 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=QiNkoAsgvTetR5YHMAeB2w6OV5e9o48b6mfaDP+sgJw=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=ldZwIC9Hb5gu6l66XHKCaUDDJT9dtbiA1QhxuBGIWGt7jh6AT6TnfDGF7Ps1kBYSBr 1ZspoIJ9fzuQU3uo9o+lbC3Ew3ThPp74h5WxG1ocAIaSQsZxHh7CS2dD/ebp2RA4kkT4 k4WrX+u3z1/bsv001eOLOvD6xaU0pahmWhvXU+9wvRKZ1n3Hj/QfxbvjpFlXbpiy1HQ6 yKeBL4ZzAqnOFq7iv24FlPtxhZSHWVWzVzl7Iq5Ip4yFCpXtea76tCVr4kdXmZ6lz8SU GtykL5f5yqn++BeuJwa0hphchNOuIlwWE4UKADyXpxlBSsQgC5J6Qu2Ta/oopAwL80/9 Xs/A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bUhXJ64Z; 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 bp17-20020a05622a1b9100b00439e8446d64si5940732qtb.706.2024.04.24.16.33.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:33:01 -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=bUhXJ64Z; 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 1rzm62-00064K-Sa; Wed, 24 Apr 2024 19:32:15 -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 1rzm5q-000615-Ub for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:32:03 -0400 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzm5p-0003xi-FO for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:32:02 -0400 Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-60275a82611so328453a12.1 for ; Wed, 24 Apr 2024 16:32:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714001520; x=1714606320; 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=QiNkoAsgvTetR5YHMAeB2w6OV5e9o48b6mfaDP+sgJw=; b=bUhXJ64ZORNYSgy8nLI3d6GS4kQtYURrUr4zCkJuZSf61KwtlP3aLISQJBi8nuC9UG MfkapkNlCAsDBJ8lY2ivQiEURbE6Qqbzj2cJHwSma4k1VbkZ5wPxQxI7P6WJ/jdYJGnf vkLqyXVohk7y4H9XE5G61R07V37/+YKL33BaOCgQqaa2g08X+Q0cZZUA2N5o0dvDPIui IgQT+/H0GwnRE/eMzRT1DmvqYruAQtvOd6YEPC1tzH9qzh8K5D5pPjY9k41lrX9dPJLy 5KYl0I7OTytHirTi3IE9gEPEJRHD27x95DwK0elwQ7gG5/jWNeibuUZ8F2XAXjY6dc5g ASww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714001520; x=1714606320; 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=QiNkoAsgvTetR5YHMAeB2w6OV5e9o48b6mfaDP+sgJw=; b=eXFq+G6kWwOrWKL60IdfPXocEFS+nEXD1/iIhYIi0iSuI2UtEeIDfcG2sDdJAXnku4 YisdTGAcQlrHj75Krei/YDv9nj3hIa1eFJILm97AgllDl1vmh2izUasEG+aM87A/QjxK 0Q/LmpNq9d8laXPYQOdwyNGx/8kojB/EsuLqZDjRMjavyCvdemM2GfDDI3K8nh6eIDKR jzVrdar5D7RwR7n+IGQ6UxeB6kFf1k2hOAM9Uh8Ds+WM0tVoUsjyCRrpGA1h/4C86LDX QLkbRZSyd8v1IrTVAz4EW7N05pF6wkL2F/KinEe7aOXNQ25ukBZ5HdfP6/daN+x6RIxP 3T5Q== X-Gm-Message-State: AOJu0YwaZnjIlTi8NvYa3/0fxvpMwKO9yusOSPg74C2gSlvQ72OgC4r5 TZR1hMnjNWhjg7JVAVxSZTEhfdHyiRTXZgJDs5uRUtSxktl5KkiaNS0GwyZe41q/Eeq12rdX0bG p X-Received: by 2002:a17:90a:7347:b0:2a2:4192:dfc1 with SMTP id j7-20020a17090a734700b002a24192dfc1mr3697782pjs.14.1714001520213; Wed, 24 Apr 2024 16:32:00 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id z24-20020a17090abd9800b002a56b3931dfsm11737859pjr.49.2024.04.24.16.31.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:31:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 31/33] target/xtensa: Use translator_ldub in xtensa_insn_len Date: Wed, 24 Apr 2024 16:31:29 -0700 Message-Id: <20240424233131.988727-32-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::52d; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52d.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 Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/xtensa/translate.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index 42109d33ad..75b7bfda4c 100644 --- a/target/xtensa/translate.c +++ b/target/xtensa/translate.c @@ -35,7 +35,6 @@ #include "tcg/tcg-op.h" #include "qemu/log.h" #include "qemu/qemu-print.h" -#include "exec/cpu_ldst.h" #include "semihosting/semihost.h" #include "exec/translator.h" @@ -1118,7 +1117,7 @@ static void disas_xtensa_insn(CPUXtensaState *env, DisasContext *dc) static inline unsigned xtensa_insn_len(CPUXtensaState *env, DisasContext *dc) { - uint8_t b0 = cpu_ldub_code(env, dc->pc); + uint8_t b0 = translator_ldub(env, &dc->base, dc->pc); return xtensa_op0_insn_len(dc, b0); } From patchwork Wed Apr 24 23:31:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791611 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1107581wrq; Wed, 24 Apr 2024 16:36:43 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV+G2T8x7E3cCvd+zScXF3x8t85JFzqi59OFHmObBPF13YNNbhJjT4FTr7brNkamEKU0aLTOYp7Mjbuo7bz4TiP X-Google-Smtp-Source: AGHT+IF5M50hUGpXZhSNVIJ6L/+xHrt7zsJmiHhSCGnl183/qHCUtyUSKZ6hlC6b9JKK1uwVG42e X-Received: by 2002:ad4:55e4:0:b0:699:45f8:dbf1 with SMTP id bu4-20020ad455e4000000b0069945f8dbf1mr3630360qvb.22.1714001802784; Wed, 24 Apr 2024 16:36:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714001802; cv=none; d=google.com; s=arc-20160816; b=WxMoPw1QxrKLc+WZylWpknNrqdk3A0LXUi+2lr9HVyDx1M5lX4l2vFLD+eAUNiAAnS 5Si/HyuoPplOyYU8WMGrT8evgLmoOwCGU2nyOofjO9RacIQGxCGM1OrqrIP2QhA+GmXd Q5J3xGgFReG+ALSAY8QHcoOlMZ5jhsTYjUsu3PZMw5t2v9/1HrCuSXFSBFSapE3hh5Vk k5e+dUjR5r1ipjg0dAep7foiPNn2iiFm3jmE4WNAWLUzDC7XjTgpiSgfxtaY+vLEWxp1 zbvXZKYsF8orNLLE44t9BOT3lkxnOiFsJxOKahf9uzPD8up1hxu0NQiQbvthNCl/+wtv oDDg== 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:to:from :dkim-signature; bh=cGd76eq3aObei5VuQZhwLC7u3w/qktBLjof4YnAY7+U=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=uZ/uAmZ/37KXkyYKN3NncbZRfdlE1hx+rIgZjagrUsLP38jTuRUseUgsLihxPC5Cjv KLecIYo5MMzY+hvmqk30qfWQGdUqWapUmPkoHCtiKYMUGifGZTmGXDbXR2ntEQHS/jxp RZkLLTELCmBrSrtSNJwnVMSsGf63TYfMxsOADImFvhU7udo0chglMUaAgYx/kKOG9CuA hDJV83QsVOsvYs1eut3gDzFR7oQOyRvY2gTQCj0tDem9BTm+UCdhhyP3ijkHJQQuzIx+ goNwpYzcKHtiG6Wj+YvnhEdGdNGcHrK/CBQ6Ccv2IYV50OI7Xn/0yFw7J/74E/d7loaX hdpQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HbyG0QN6; 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 i7-20020ad45c67000000b0069b5583fcb2si16719339qvh.225.2024.04.24.16.36.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:36:42 -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=HbyG0QN6; 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 1rzm66-0006He-Hn; Wed, 24 Apr 2024 19:32:18 -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 1rzm5r-00061O-Tp for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:32:04 -0400 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzm5q-0003zL-AQ for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:32:03 -0400 Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-2ab1ddfded1so439436a91.1 for ; Wed, 24 Apr 2024 16:32:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714001521; x=1714606321; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=cGd76eq3aObei5VuQZhwLC7u3w/qktBLjof4YnAY7+U=; b=HbyG0QN6WaJLgW4m7I398TQIHNKsFFsOzpyQhQAsEIY7ovn3AOiz2xay29SlKFWpFM 8KWS7nyHEN36Iac7MrotYlsMZougPtYBj4T85JU2Pr5dyfKqn3vrg6OJKl0nSlaIpRCr wr1YnIFeapD/dRG0hkARYYPsJZWQjD7bGAh5aGUPNzXROqux0Y7bMq9+RBUFCS9uGJyo A/bTK96owvpBoCn8+t1U9zFcs2zPx79v0J+T2QN40c0tnVMRXQ6cAloUehtcGDK3+7Bl ShqQD+bWdlBPFXhjmGzRq0bJPVMT8AEFpQY9wHovDK3UxKNfaTiER07+X5YvhgT/GXOA lECw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714001521; x=1714606321; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cGd76eq3aObei5VuQZhwLC7u3w/qktBLjof4YnAY7+U=; b=kIayh7BRt0ab02czwSuOKAx3O4mUdiOtIslifCM0934iv3lVd04CfUjPAsI5Dnexv4 h7/J+AOUJwMOcUA0lvBNgPPb1iZrWP/OYwtdihlD7fIEOyhzp2piUNQTq93yfIERnbnH ItBZw35F9iCc8J8N8dCJFjP6uFBn54Ofqh/Rnd6R0RU82JG554JU4a8TzDc0UdTv2jr8 eSH9t0hW6NUn+94UidmNd9vyXVG9xWotaSxKiHu+Uh1pxBWWSrh25QPuNgGQXWHQgx8p e3fqcKzpNEO0JwXeX0SvpXiYo2djVA7LvHGzzV++cep1ogAQRpC5l14mZkkl+OTd1hM8 bUgA== X-Gm-Message-State: AOJu0YzPyfhCYPoufu6lcxOEmmXa1hAQSy0bzMI+mnvwTrU+N621/0CB udLBDvbosmsrBv48yOVxr9DqM994hqqmAH/77Qpog3nIB8x1hMs+y/TtHEwfSjMXVjkBGJ9tAWt 4 X-Received: by 2002:a17:90a:4746:b0:2a4:892f:39b2 with SMTP id y6-20020a17090a474600b002a4892f39b2mr4285123pjg.11.1714001521044; Wed, 24 Apr 2024 16:32:01 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id z24-20020a17090abd9800b002a56b3931dfsm11737859pjr.49.2024.04.24.16.32.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:32:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 32/33] target/s390x: Use translator_lduw in get_next_pc Date: Wed, 24 Apr 2024 16:31:30 -0700 Message-Id: <20240424233131.988727-33-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::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.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 Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- target/s390x/tcg/translate.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index bac033c63c..ebd96abe6c 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -36,7 +36,6 @@ #include "tcg/tcg-op-gvec.h" #include "qemu/log.h" #include "qemu/host-utils.h" -#include "exec/cpu_ldst.h" #include "exec/helper-proto.h" #include "exec/helper-gen.h" @@ -6471,7 +6470,7 @@ static void s390x_tr_insn_start(DisasContextBase *dcbase, CPUState *cs) static target_ulong get_next_pc(CPUS390XState *env, DisasContext *s, uint64_t pc) { - uint64_t insn = cpu_lduw_code(env, pc); + uint64_t insn = translator_lduw(env, &s->base, pc); return pc + get_ilen((insn >> 8) & 0xff); } From patchwork Wed Apr 24 23:31:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791608 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1107550wrq; Wed, 24 Apr 2024 16:36:37 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVpxXkN8uPp8kGd+vYlmxGkXXfm/IqqtnL2hXtb8XQiUpTZL9CbH6if9w6pgRVhITn17GVKz15MI06GNQwT2jNh X-Google-Smtp-Source: AGHT+IEAzgZxtRzQ99OubDQo6QVbhXiziaTqYOld9iAx9U+pxV5SBd4m6AictZTCKogcOVgA9JeH X-Received: by 2002:a05:690c:6c91:b0:617:d864:7e0b with SMTP id is17-20020a05690c6c9100b00617d8647e0bmr4105480ywb.47.1714001796731; Wed, 24 Apr 2024 16:36:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714001796; cv=none; d=google.com; s=arc-20160816; b=p5152al27w7NH2mg8Xdyooc6lLKj6GT50W5OKBWZjMwQ/euP8Ox/mnywTCnV4lvNhw cSq1X6F4ZScH1S+5iTiHk3+su3W7k2g93iD0AoeXuEb7M5FO5YHB38z8N2SLF0SNa3zg wM8S/CtxGrhaZlWWxV9ye4sxhG48GzurMhd5WPNPqmOyKrlx9x6c8Plzo789Ux2qjL9L RP8iFGfw6H3AXtlzNqFvxbTNOb8RoJ8UGOZMJo+77NZKdeExX7Zjyb7/3w3CkFTj4g+/ BmxkwKppRHHwaOoXGg7fvYfPO2kp/G4kfajYc+ExtPSALD4uEYIbUXnS17EiL/5Tucx6 /Y0Q== 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=AWaHIgupDRubCdZ+Pwkx9z9dob2E973TsdkTQhijD54=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=XzY5syrD3tVOxXmMr0A5BYV71QWisI3c2fD8Lbs6jgMPiRwgSUfXou+xJuVskMbCpy hUQ2WmZKeF9Ok/8GVgUPPoiAXblP+OEDkjtA48qQ/JT1rv6PLNf+weSaA2BmVB958PG5 9j/H2Dg44ImuDA/6fkJzsMSS13Llwh6IbuzX70VHpM7fkL4dBaPx+NUrkpteqCWsCCkq iXhWcQmgxDZzvo1Y+iCx9plXVnq9/7bbgKGI0DT93xeevdh8I34W00WhKZkt2gMrw839 FtnCUFb+tpGw1czW/GBjNvN2O40Ny92dM75GPOmg0wNfA+cwAXNICWzyrUb24rlwzUfh iKYw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DaVogUA2; 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 z8-20020ac87f88000000b004346ffa8ee1si16645498qtj.122.2024.04.24.16.36.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:36:36 -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=DaVogUA2; 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 1rzm61-00063c-Nj; Wed, 24 Apr 2024 19:32:13 -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 1rzm5s-00061e-Jg for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:32:04 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzm5r-00042Y-2W for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:32:04 -0400 Received: by mail-pj1-x1032.google.com with SMTP id 98e67ed59e1d1-2ac9e8e4e3dso397521a91.1 for ; Wed, 24 Apr 2024 16:32:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714001522; x=1714606322; 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=AWaHIgupDRubCdZ+Pwkx9z9dob2E973TsdkTQhijD54=; b=DaVogUA251nlbszpDbc+At25B2SHHQUJlnsEqWXvchHtUE4eZx2az5AtzoOssFi8j8 tCXpj71e0LOgCQ6DKPzJ8Xg9O674EAzrQIJl/drRiL3Cod8vKM32+mCTndfKuc/yt5jV qAhwNv6MXolKP8Z+Ez9bEZM/OmryRmOkeKkfR58B2UTkbvhv3M4eD0uoxund86HZgAbL aTiJ9WG1WLzajz0j6UdGOOMPHY0jcnFy80A3TUGjDIhm/+0rkXtNNzvx2hS1f1twfEDk t6knBo7N1cUqCitaJMl+3+8lJZnrRNWSOcvX2fTiXzXa4c8Ash25TEZJlkvQc19bWPF6 3TtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714001522; x=1714606322; 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=AWaHIgupDRubCdZ+Pwkx9z9dob2E973TsdkTQhijD54=; b=ao+15Q4Qwp7jXqWeQTN5UQuyToWT0juEjQ3gaArdQPu/4YugdqA0AI8YY59fs/S9CA ibpYPrS9BwkIXmURSjOzhVOPCRUbbsDi4m0ZDalJTRc/2AnBKNoXQtQCA07e3AX5BqrC MEWlIeG5EoIFNAJECGLbWBZQFGyGEY7KSue5rAqJE4JJl79TmIYTQxvRmOX21p2rj73W UtNLejMxpsbh8qD/P5Y6krowICDfXtwHkg5i07i3jxqG2ieyu7nj95w/eYWuN8RtThWo kpMJPBX3KWJubT2xdcH4X0ehQHDJBaZxV35QVZ19ieFQu8sSykbD3AtMfkdxqSnR76Yo yPuw== X-Gm-Message-State: AOJu0YwCOxMKBFHj+ZHsx/2ENjgl6cAIhr8MsPpbXghpCy0Z6cVGij7p MQM7i0kB3ISo7P9ddh6pFOyl3wEF7YkKJ/o8sOCiVfUmKjW5CPZeG96IKhNSDUwVwTzR9BWe2Pd o X-Received: by 2002:a17:90b:120e:b0:2a4:b831:5017 with SMTP id gl14-20020a17090b120e00b002a4b8315017mr2145820pjb.48.1714001521874; Wed, 24 Apr 2024 16:32:01 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id z24-20020a17090abd9800b002a56b3931dfsm11737859pjr.49.2024.04.24.16.32.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:32:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 33/33] accel/tcg: Remove cpu_ldsb_code / cpu_ldsw_code Date: Wed, 24 Apr 2024 16:31:31 -0700 Message-Id: <20240424233131.988727-34-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::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.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 From: Philippe Mathieu-Daudé Previous commits replaced them by translator_ld* calls. Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20240405131532.40913-1-philmd@linaro.org> Signed-off-by: Richard Henderson --- include/exec/cpu_ldst.h | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h index eb8f3f0595..85ca104dc9 100644 --- a/include/exec/cpu_ldst.h +++ b/include/exec/cpu_ldst.h @@ -438,16 +438,6 @@ uint32_t cpu_lduw_code(CPUArchState *env, abi_ptr addr); uint32_t cpu_ldl_code(CPUArchState *env, abi_ptr addr); uint64_t cpu_ldq_code(CPUArchState *env, abi_ptr addr); -static inline int cpu_ldsb_code(CPUArchState *env, abi_ptr addr) -{ - return (int8_t)cpu_ldub_code(env, addr); -} - -static inline int cpu_ldsw_code(CPUArchState *env, abi_ptr addr) -{ - return (int16_t)cpu_lduw_code(env, addr); -} - /** * tlb_vaddr_to_host: * @env: CPUArchState