From patchwork Fri Apr 5 10:24: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: 786211 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp92628wrw; Fri, 5 Apr 2024 03:25:53 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVsY+jBKV1IwX93ixiQ3t3CP1eLvd6hm+pMDt7lD7osE8ZP2Iuo7XK7YvgJ6jJHcOlp9Gc/xiT974UBDgqYfMmP X-Google-Smtp-Source: AGHT+IGElWcYGNRXnmXEWEitZhYZIrYLaJkvX6fYhLKshpkPpnH7/gphO2TBSN1alr5zCns3AeqW X-Received: by 2002:a05:620a:90f:b0:78d:3cc7:eea2 with SMTP id v15-20020a05620a090f00b0078d3cc7eea2mr731296qkv.53.1712312753613; Fri, 05 Apr 2024 03:25:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712312753; cv=none; d=google.com; s=arc-20160816; b=u/pW52WDrXOSr40dRATTcDddDsx+CEsokWdrcdxPK8R1/7Tcv5a8Rom4hesBuofHXf OT7i8FlV26S7YmJAUUYkA6U7K5pK5JWd3rvRjmma218qTu9GTdiZNAAKt7RgiV5Q3p4Z y7Ab+t3pkf+Lkdl6mU7kJHZU3XFxl25NsMyZuB0eXajgQQ8Da4p55eZ9tNkf2ZKH7OCI ac1GHaR0fFpfYy2ElLP1yQjk0BGu69pDJ1GTLHk40KqcdNBnmaDnII+CamFUSPdNt/iF bYaHt91AwjL3ymTlV8X9kp8ISESyQOuCfSk6TJAqHiO7ruKOLKWGXwLYIGVVk4VTandE Im3Q== 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=5/CiOSfkjWjMtqqZEcZpCs+EVmjBtCRTaDzPf8PAx+4=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=i1GHuTGvrDewFfUeflnhwdts8e//oKqZ+FPoSvxAOB31pcGV9bUKBv1L9OFIBe+RAm MpgK9EA13MSXCKmOZVqP3/NCu2RyGh7npTeDC7hjGGGTv8gsToizhVEcDDH/evXiMPif tps2jq8eoopbIsJfYXvZKYWzz7uIZl948GZb42WWDjsOP1zlLiV9PkYIDSWf+ox/s8wb 4ilwxh+fMPWQ96LaEI/rNf/992lk5YADU2g8Zti+vnK+S48Ot6S1FzRaKcLu78NiLk5C 2xQg5orH0w71yMAIHo4nYU1chCjE3bGkZBz3DKAFmRYUy5ehIcWtyAtDm7tlRg5jYGMV Ph7Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lKCaUAuc; 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 x3-20020a05620a098300b0078d46f2fdcdsi1431981qkx.193.2024.04.05.03.25.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Apr 2024 03:25:53 -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=lKCaUAuc; 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 1rsgl6-0005z6-Nr; Fri, 05 Apr 2024 06:25:20 -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 1rsgl4-0005xk-NJ for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:18 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rsgkr-0004NN-PQ for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:16 -0400 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-6eced1dab1fso1462824b3a.1 for ; Fri, 05 Apr 2024 03:25:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712312703; x=1712917503; 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=5/CiOSfkjWjMtqqZEcZpCs+EVmjBtCRTaDzPf8PAx+4=; b=lKCaUAuctf+nHu7378RzPh/1SAlRwvQMXUV0od/H2oSoeNuFgFeTIVW/NIHIO6ZYAw 5oiKhjyldyI1NYePL6HvHIy8CFGcie15TGDZ9XjNeOorMTHtYUr2pKBiV+rTAcT1CLdX YGz27eesv9ZOtk/FreWTkajtUPHgsTCa1lzTUofXOvpmRhsQY+2oql6oaAZlH5eSRMhw LZOVAP2P/JAtsl1MctJ9IH1qaszKVCoLC0L+LoFNLEc/dzHWgaoypwmp6Stf8GAHiUaB CIZAQKSt48yqUkZgHmjBUey5NgXt1xqipGYTvdcOw7eTvhuIog4VUnBEtUIba1WoORSj 3SAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712312703; x=1712917503; 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=5/CiOSfkjWjMtqqZEcZpCs+EVmjBtCRTaDzPf8PAx+4=; b=c2lvMC8jpY5U4DxPpwNIdTzoRM2vJnf8Abq7M67OieDI3Sv87gaF0B/vc9hg7rIRLy R4BjYHMn66So/RuDELJU+W3yJOpZFnMigJMiXrcdEScdiMIVin1SrwFMzouUrcT6SDve 0B5eKtbK53k7qJyS7XHR0VXcQxS1Y3tr+srCee6UMDbB67k/ngFuIjyE1mScDM187aZG PqeIy1H30u795ZQnV1tGkDx6dSIcwSyKtCozocT31HN6Q4g3Q5z7bS6qqgIeTeP/GV7d TP4H/7UT/taDXGMbImQfzCc/95RFK5RDqStsicXz2bwkW5Y4f9TImPjVIszBvGUzWP/k dK9Q== X-Gm-Message-State: AOJu0YzvhJlE5XnEj4I3GsR2Tjlxd4LsXVW9uoXkMc0rdcDqZwvOl/iN zD8FOgVlremw7LS+9i5B2ivs7c6WDCjV7qAClsdnGWzQhStrTlc52qWbB/q/9wk69QrP08Bde4R Q X-Received: by 2002:aa7:88d3:0:b0:6e6:970f:a809 with SMTP id k19-20020aa788d3000000b006e6970fa809mr1149843pff.20.1712312703150; Fri, 05 Apr 2024 03:25:03 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id h10-20020a63f90a000000b005e438fe702dsm1104304pgi.65.2024.04.05.03.25.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 03:25:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 01/32] accel/tcg: Use vaddr in translator_ld* Date: Fri, 5 Apr 2024 00:24:28 -1000 Message-Id: <20240405102459.462551-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240405102459.462551-1-richard.henderson@linaro.org> References: <20240405102459.462551-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x433.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, T_SPF_TEMPERROR=0.01 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 | 18 +++++++++--------- accel/tcg/translator.c | 15 ++++++++------- target/hexagon/translate.c | 1 + target/microblaze/translate.c | 1 + target/nios2/translate.c | 1 + 5 files changed, 20 insertions(+), 16 deletions(-) diff --git a/include/exec/translator.h b/include/exec/translator.h index 51624feb10..29804de92e 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 @@ -180,14 +180,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) { @@ -198,7 +198,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) { @@ -209,7 +209,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) { @@ -228,7 +228,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 38c34009a5..9ac0f52b47 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" @@ -290,11 +291,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; @@ -311,7 +312,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)); @@ -325,7 +326,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)); @@ -340,7 +341,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)); @@ -355,7 +356,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)); @@ -370,7 +371,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 4e52ef32db..916afd4dec 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" diff --git a/target/nios2/translate.c b/target/nios2/translate.c index 7ddc6ac1a2..9c3958a0ba 100644 --- a/target/nios2/translate.c +++ b/target/nios2/translate.c @@ -32,6 +32,7 @@ #include "exec/translator.h" #include "qemu/qemu-print.h" #include "semihosting/semihost.h" +#include "exec/cpu_ldst.h" #define HELPER_H "helper.h" #include "exec/helper-info.c.inc" From patchwork Fri Apr 5 10:24: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: 786220 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp92999wrw; Fri, 5 Apr 2024 03:27:02 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWLTJ9Z/lrkAWor1bLYDubXgHuwwN+uEZcTf1CKRcW6J9nj6iB/YlRt9Zo7OnVF4d1OZWKqH49TIZcZ8h4L/fFH X-Google-Smtp-Source: AGHT+IF2aYzdX4pzZ+X8Vzc9Sbd6X2KIxcAihO/EErHsrhx+Vy7OVVjvHT+6TAzqOir2KC+nbnRG X-Received: by 2002:a05:620a:10ba:b0:78d:3649:7053 with SMTP id h26-20020a05620a10ba00b0078d36497053mr920275qkk.69.1712312822664; Fri, 05 Apr 2024 03:27:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712312822; cv=none; d=google.com; s=arc-20160816; b=Pq/UzzqBsrOAgq061YVDvBrSfpiAsJlrDo8sZXfhaVTTyz2Cb/ZLze0OrK1pJNUBTk guGTgTt9ZeAg7rtwmPq85kI6UpE4Ptl+HDkdlRHuFCIvOfZ70+LA6YtcU0F48DQ7cI7Y CRMMLKzgwvMg1bjlqnzcvGmk+X9DhdQQDbjCuHVNOYYZ8payQ3ymTw4rHiWXsmgGMDSN oaQf0XGPw/eIkdGfLT8kQzvLSpDWc6np4uy2X6xWOXDpoEH5cwI6rEHW+TuFowPnOmh4 IwPW8DMx8GtoNBTV8i8wgLZjrxeXjcO1zIBMvz/h6GHn9TaJZH3jvoicJ09Rg63J450b 4rUQ== 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=NdQqZjJgz9uVc1nB4iFIKIUfcykhgew+A5q2j0I98dY=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=U/DW84wHpVeD+tyDTK694F4lIwii+WqY5END5yfhJ32A/dNp31cgd4SzirhA1xVAmE Ik9oGuTOitiNQ8aAWh0oOtMkb2jfIXsGSQ/ImcgBM8sWSmbrpfQTtmMZZsJdQXsVxM3b D/fJ0qsJ4UXS1gm9j9d32U6QICVPlKTO+KvKLqXIq9jSSng4L77oeUdnYPjYUPHenvCA 8Zmj//U5z9lydlu19de749/CfWc1fSL7gFrCNNME0lCnHKwYCR3q68vdd7B83+iZlDpD PUanmyymiVdSzR6KfXylIHcDEPLMoQ+T0LuJFnB3UU4ohP9WwCi1hJwTnPNUV9y4zvJY kZGQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bAoeXL4g; 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 v2-20020a05620a0f0200b0078d496c674asi1371535qkl.331.2024.04.05.03.27.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Apr 2024 03:27:02 -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=bAoeXL4g; 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 1rsgl1-0005xA-KP; Fri, 05 Apr 2024 06:25: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 1rsgkz-0005wS-Rs for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:13 -0400 Received: from mail-il1-x135.google.com ([2607:f8b0:4864:20::135]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rsgku-0004VM-M3 for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:13 -0400 Received: by mail-il1-x135.google.com with SMTP id e9e14a558f8ab-369eafe262fso10131785ab.1 for ; Fri, 05 Apr 2024 03:25:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712312704; x=1712917504; 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=NdQqZjJgz9uVc1nB4iFIKIUfcykhgew+A5q2j0I98dY=; b=bAoeXL4g6rWRI5sEnmBfmxYg2XalXWL6KxA3ZpCkvatuNKJy4xZZsQ6aDD+AWdd8QB EuF9BYMeTi7TJgRINvX73PyXmfIx8yjsjL0527ZHCqyHigsBd4F1I5yzBjmkNXFChBNe IUkZQude4BsUZ/DN8tFBtTHbXFFXNXrrC/onWecrReee+g3uCgUd7kAf7qiDp4iEZvVY uvaSCUITXGWPvDrQkZ0nc/DD+dF0IVesKACMlmrGRStUvXDf8N2r7VmqN09nPiLKFKyF q7XgBKOoNJNuqFQAw1K/9/FI//nlWYwx9p/yYOTR3Vj4JfJsfr26Rj5Fj5jZP8dt4a0E BfCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712312704; x=1712917504; 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=NdQqZjJgz9uVc1nB4iFIKIUfcykhgew+A5q2j0I98dY=; b=Y53FaqYwdABmAKVnabssI5PEADs71KrTHDy4IEuhby9PLH+Q1bIgXFTYT5dtexd/L5 04OPr2uvFoz1DFwkzXSXCnVRu1rbV8B6tUAN5KRdvgAuieB6sWSQ9+cwQ1tHdVrtSGY/ akyeaz2FvQAGGYFa6IKlGEs4PMWl9jP07n/zvgA6/RSXEApUCGY8Bqx3Sd2RXLJ8NsjU 2r6B/wWfBULyXHTP4Bi3vw8zvNneO86CujPACS4KjJRK9a7eCcaWUWVznQQNLVplHoax DJaOZg2PZFuMEbCXuHBG2M2iHozaUm1HSKRHUse9yPj234BF4UoQd52S0PT63KZsgYjo AJJw== X-Gm-Message-State: AOJu0Yz9t/NZZCwDVKLrWcMPGyKYms0FSauZ00COV7ATGuZcQus9ryGJ 9BuCYRdze1r3nqAGw3YYSFGWp5R+ntlzQorohLJAtqAIxbrfx5q2bjlBRMbsCYxS65RxptPwmNa S X-Received: by 2002:a05:6e02:1a66:b0:366:9674:7084 with SMTP id w6-20020a056e021a6600b0036696747084mr1053057ilv.12.1712312704361; Fri, 05 Apr 2024 03:25:04 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id h10-20020a63f90a000000b005e438fe702dsm1104304pgi.65.2024.04.05.03.25.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 03:25:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 02/32] accel/tcg: Hide in_same_page outside of a target-specific context Date: Fri, 5 Apr 2024 00:24:29 -1000 Message-Id: <20240405102459.462551-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240405102459.462551-1-richard.henderson@linaro.org> References: <20240405102459.462551-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::135; envelope-from=richard.henderson@linaro.org; helo=mail-il1-x135.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. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- include/exec/translator.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/exec/translator.h b/include/exec/translator.h index 29804de92e..185ab5c374 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -230,6 +230,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 @@ -239,5 +240,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 Fri Apr 5 10:24: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: 786214 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp92880wrw; Fri, 5 Apr 2024 03:26:38 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXuh8HE3xU80lqvlofBOapsE4yQ3W2T7+hlOzR2jZskDz736fT6OSurvgJABiEVaTt6tVqOkTbLntzKoAB09ju9 X-Google-Smtp-Source: AGHT+IF7JSJdbPa3ZVYJgMW+zK8rZa7alGhxal1CUUcA8XHeRjz/11YQcY9ccbs6ocPfkwB88am+ X-Received: by 2002:ad4:5ce3:0:b0:696:7567:ef74 with SMTP id iv3-20020ad45ce3000000b006967567ef74mr1336851qvb.27.1712312798425; Fri, 05 Apr 2024 03:26:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712312798; cv=none; d=google.com; s=arc-20160816; b=OXAnXsjEiTxfEenEPYh52irda6qvp2TSUK/5MpMPTVKpmgMAHkJemi2XwM9k3+jaHi oKIR5YXyQgGN5LfvuL9LIfgDdt7G/QrLLcyIHfkQpQBMz+V6bqlgy7Io7+/dLapn28Tj rkNZFkI5C9PzwHRSdk8a1Y8t14g2HcfACZ8dPu78oAb0RSQYdSVyIKyQAQbI3jY90Ucm NFIR7fhyl3DHYHbaZrc+G/gwzvTT9zni4NaOs6fj2cMKPH5lLB282PdGBlhqO0tIO2Qh KaC2b3R5vF0Di5HCdniFBcmg7y6NL7aczN9IyHFveSy2h63ztqTLcA2xEfM3cIHglhOP q5hA== 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=F7a3sqe7T7/4TgllKlNheahf88h9/zMntHlNSh3e9Z4=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=0TWc29yZsJdxRZxYAr0aKGbLIdgMW4nIEcRv5NM4Wj6an3gFL+pRuwG3vO4cwnK8c9 5WyKsExRwyrxcgYgMmOt7s2gJenyxi9ReGcixCHsjIdZHW5MrxUzDHtMhC6sHfk0ahUG c8HBS33SpsZWbjDcTBBEjCpVcz8IFXCFVLqNYC0OE98irTQ+l/4oJN2fkocbHhuE2usS s7U5y+nIl6HvRbpRfPMwS4xh03ZgQDct4MA1fbDQeHTz8gzDesKgnx5XM6UjSVtpVykw xX9I6VlwzUMhlegWgiSJPLAS0FA/RS2ZOMd+7Y3Lpk1KSr+qRnMs0VuyvgMQiKqFdJVo /0Kw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=awc6rhn6; 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 b4-20020a0cc984000000b006994451ad86si275290qvk.434.2024.04.05.03.26.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Apr 2024 03:26: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=awc6rhn6; 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 1rsgl9-0005zb-IS; Fri, 05 Apr 2024 06:25:23 -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 1rsgl1-0005x9-Gc for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:15 -0400 Received: from mail-oa1-x2b.google.com ([2001:4860:4864:20::2b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rsgkw-0004Y3-Dl for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:15 -0400 Received: by mail-oa1-x2b.google.com with SMTP id 586e51a60fabf-22a1e72f683so1049302fac.0 for ; Fri, 05 Apr 2024 03:25:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712312705; x=1712917505; 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=F7a3sqe7T7/4TgllKlNheahf88h9/zMntHlNSh3e9Z4=; b=awc6rhn6WZxOFYvcmrgFgjRMw3veSI1HLtDxm1uddPlxfKDItTFlT+GHTxjtJWTrD1 ewIe3sBsY/EUl3vymh5al/Pzw3leiAC04x95ZphUBSQpi+VariYNzD/YCBClbRlF6IZb i2ktPkumIgV3Q19YxE2mCjydY/W3TAqg7qAxDYAdAVIi/WdEJoa6rLBJizUIW+UZqmTa ow3WazLQK9fetBFu4DvueImFc8lDy4Z/puP1K/tDVzGrfGAgBeiIvqBySY8eaAvS7Ozh zJ/1WSkQfBPDOrqpl+4m9WZAty/iLYnaFGoxgN6GVCRtPaQLE1mcoTJ6LHPLJhTNwxsA LpxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712312705; x=1712917505; 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=F7a3sqe7T7/4TgllKlNheahf88h9/zMntHlNSh3e9Z4=; b=IpHXDOPQAWqMqXo0lh17OcPGNm+a7jG4kN3WHE9Q7oCC43K8b3nQ/35UX1Bw3/4cM6 a42m8KunSHUrj/6V6IpBcMW5aRT4tSBxU03d9b3ChgxIgW4WmxX5TmFrhiQ2EGPq44D0 521dCBYkkQbbUXxBTQNbjqAOuU7PhidBG8bRUx77+U4ODn6/CMmkGxwhDA5r+IQceeY8 yVHFgqRsC2x7JbCHoq9e+iuYQXo5h5M6iNc88ry8GSkNw4hytY5L/ZUf5hrRGzwCK2lw tCI12KUwHvAtXWyLg6pZgTDo9N5O0/w2pQtq4vp9QCmoFc8kQjYYOdcblVjaDfU+Vtde GtKw== X-Gm-Message-State: AOJu0YzfXNB42TSs/Htq03AEA+v25M9GkubbK+jXAHRb47YCNRRCzg32 Egs7HXCsukk27ZRMKLXnQCgu8T8AlaaEA5IBgEma9VLvVq1qfUtHcNuzvF3b2mJwR1xvLesYN8a k X-Received: by 2002:a05:6870:9726:b0:22e:be32:9e6 with SMTP id n38-20020a056870972600b0022ebe3209e6mr1266169oaq.14.1712312705626; Fri, 05 Apr 2024 03:25:05 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id h10-20020a63f90a000000b005e438fe702dsm1104304pgi.65.2024.04.05.03.25.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 03:25:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 03/32] accel/tcg: Pass DisasContextBase to translator_fake_ldb Date: Fri, 5 Apr 2024 00:24:30 -1000 Message-Id: <20240405102459.462551-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240405102459.462551-1-richard.henderson@linaro.org> References: <20240405102459.462551-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::2b; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x2b.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 | 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 185ab5c374..65d0c6489a 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -220,15 +220,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 9ac0f52b47..64cfa4e003 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -371,7 +371,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 57b7db1ee9..8282936559 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -6204,7 +6204,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 Fri Apr 5 10:24:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786237 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp93880wrw; Fri, 5 Apr 2024 03:29:57 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVeIIKYgawC/Z9TkRu7Mq+3EI88FpuVYFfzTIFJJBrtOXFRoXqKEg19qS1Iar+MsqV83bJhM6uWWGAyjWkgQ/7b X-Google-Smtp-Source: AGHT+IGU3uEGqqjEXbg4+3/yMrE7fIBxYsIlNcz0iHlaHP69clbWS6XxcbA/MLAtxyRSkFFpb06W X-Received: by 2002:a05:622a:5b04:b0:431:7c36:7fa5 with SMTP id ea4-20020a05622a5b0400b004317c367fa5mr3987727qtb.10.1712312997671; Fri, 05 Apr 2024 03:29:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712312997; cv=none; d=google.com; s=arc-20160816; b=vB0hO40DjfN9WWwSusSFbn0lroCc1FVihN2ilnqDegG21InbKFfXHMVYH7bzowXgq0 e5QlNWu5+2T9QNBm53WW5t04QGaJ+ERa5Pv+XtTPH5gS2f0dNorEDGa9TMNmLwbuvxRv lpa9TZFyTSJQUNS3U9X3czg1yVwuShXPkjIX8r0bXGeNrJlM9gdeYLns5tioxV1uekA8 77tCTfjUoudS3NT+2aikWw5YaAxiS2d8e1cMIbSP7TrFfXw84aj4817GHlNra1YDJ+hj FQnsTlgp4ZqLLoHjOnL4cqWHeeU53IJbQhpviJMlNZPY+UDQh+2qGotIdAr4yfNIwinA uoZg== 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=5ibAm5kxv+pEhpJp4At58jRSN3sWMTqwF+92dVbLS0I=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=A7NaU1+G3ZbskQ3mu/3rM1Hd6h4Rw2iBwutLaQcUsgI8SUe0ZJkz+GgSCHrHkYAYqd 4h+hgN3dSjR+zE80w1iX0de4v/W9r9+lHNa2NZ/8S+FfIh5+JLp4StdkdFgj8qSAACKX 1yMW0BMcpgMWTGf4oSJCOKQOT4yuKkXpxMh6fgYSpb15q9UL9myxjSloiWh9+mOIQqtH NLMUMpaf51MEMIFZyTm/be+s66sFuCln3Je3k4v4U14i2B60KqG3r+mmP+kfggDzl+Zn LoIfrbOxzNjK7gt1M0SYGcw6TQyBwHahhrgDXcHL2cQqLjnnXWC+Y97WdGLMLZdnhrl8 O9vA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=g1DnHM3P; 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 w14-20020ac87e8e000000b00432e2bc8828si1474985qtj.34.2024.04.05.03.29.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Apr 2024 03:29:57 -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=g1DnHM3P; 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 1rsgl5-0005xn-C3; Fri, 05 Apr 2024 06:25:19 -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 1rsgl1-0005xB-Kt for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:15 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rsgkw-0004YW-Dk for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:15 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-6e6b22af648so2323833b3a.0 for ; Fri, 05 Apr 2024 03:25:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712312707; x=1712917507; 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=5ibAm5kxv+pEhpJp4At58jRSN3sWMTqwF+92dVbLS0I=; b=g1DnHM3P7VNGayCl/ZXw91UmCVD9Wliexr5u7AsbFqdfBMdZTFqIOjZFGgGWazftDz GFbrnx6YBGFbMJX6Knq887HT2M4a9oGuKYEtjnUpXJfcNKBVBcNYIDnMMqMplKpdVQ4a v+VPsJn45FvaftOdwKiqGrbkSOHMKTmuccJ4TbwtZsGe94x4Kgv0XgQNMc5O4ATnD6aN 0qunkJ8gAVFV0WWqYGVPGiBmZohOz4VWY+rIl+CEQceoSe5+HsQDrXiVzRUtIwcrwksI jyPco06FCviRmz2FTWrpTykVW4/XjivLPvyvxksDEFr6L1mOfGDgVpUgiJ+as+efalWV T/5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712312707; x=1712917507; 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=5ibAm5kxv+pEhpJp4At58jRSN3sWMTqwF+92dVbLS0I=; b=nJZp3qiLo6U7c6jP1Gcppb5+G4PcE18BsuVzGnmV/GuG08TyBkLiNSnrpXx7exAGhX FCB7vZBSpOfVEWlcAVoAI7Z+bE7uKGV19hDhYwmYMZi/F2g4ZDqHlK1liXu3Z6E1UT5f JGCmU8F6asJ5A2ZQBMdUAEMRuxSBOP+nj9l0NyEUxRF3CnRGOP583woXZXd/Go4NCaOw d/U597MDJHuDxD165zzjyK419VMDdyPxtxYFC/w0cEZWxCaQkJTcVuS2TdGJgTiNaJ/x bRnQDSEK4UIyB1AEVvM2LkP/vo0Rqt3TYZkMwWuP34cB90kPihe1RqRAodta+lqLMQKD HXKQ== X-Gm-Message-State: AOJu0YygkMidW+vq1NsA4gOIHl3B3QxbLrPdCtI29HwxhKw94EYF3D/E kQjAG0BNNYIxYiz/glWf9I8iuBznyOS8TpB6ysDjejhCoYgs6aahhVY+AytnRAHN0I1Tf1GrIF5 g X-Received: by 2002:a05:6a20:2585:b0:1a5:6a94:7641 with SMTP id k5-20020a056a20258500b001a56a947641mr2877957pzd.7.1712312706896; Fri, 05 Apr 2024 03:25:06 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id h10-20020a63f90a000000b005e438fe702dsm1104304pgi.65.2024.04.05.03.25.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 03:25:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 04/32] accel/tcg: Reorg translator_ld* Date: Fri, 5 Apr 2024 00:24:31 -1000 Message-Id: <20240405102459.462551-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240405102459.462551-1-richard.henderson@linaro.org> References: <20240405102459.462551-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.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 --- 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 64cfa4e003..42beb1c9b7 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -226,69 +226,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) @@ -314,61 +333,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 Fri Apr 5 10:24:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786240 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp94121wrw; Fri, 5 Apr 2024 03:30:34 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUBUlUu6/n/hQtZusy+ojbUudtyE7Lz8GDShIvyvkZ28qAg/62JcdQhIrvDlR2xttze30EW4aG72qAOzArxYtoV X-Google-Smtp-Source: AGHT+IGo7aEbzBmgwBm8Y8Ja6zDgF3QkouDDhWbo84Do8/s+TFeqYSf0z0JJd9RBhB+x1LYGyKtI X-Received: by 2002:a05:622a:14c7:b0:434:5894:768f with SMTP id u7-20020a05622a14c700b004345894768fmr3427806qtx.31.1712313034099; Fri, 05 Apr 2024 03:30:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712313034; cv=none; d=google.com; s=arc-20160816; b=U48QDkiTn+9zEOqf5WOr2TEO7JmSZfA9dSOGaOYbDWCwv7CdXTLscGBzbeqrSGiH6T wx7WLIdstSG3H9YJVosyGF86T/HMC5C8FuaXMFL54Y8YqZ/snsqvBfXDAp2gNHvvyP0d GHwgo79jGqVFyM2nhLhnOJFL359jOzk7DlKiMLrQI65P5kmrWn+6XbX8g32khDRu+lg8 Qp+q7Myz974K7aTzAjnTD/YN7ug69wD5fp8x7sXhusIzObSCxh+eIZJo0/B/R9DUV5qJ 9Mx8+4fMm8Pz/uVBUDqMX83JZ9tbUlmpFMzlsgVSwPgLubd9Vq576rzlvZQz5DuD68L7 kLpw== 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=aA46PcSFh0E670CdL7fmcUflkfJ8vHcNPNbv93pOSl8=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=YPY9jxvoPhK0SX7UlO7igmLSgaPk1FMOaLXiX2ixiOrsEaOeRvyosh3mVw4BDYACr7 J9jHYIdXWdpDgm6N11hF3Bl1pQsp3MSeK5+xpG/4pBM6Iye6wY2/WNMKuUjGZicQRNo6 yMxQRvZXyFuGVSUI2pwXlfRkGKXvMoZDVBaWmfsGiRORiVX7xbup8/dsx6Hi+mY1r6HY d9qyk65CQYkw365e5QvZ0ysoSKVwD7FUpz5FWtzXqGiSud8DYc3XwnhJSeYCdbg4RUOR xlGOwEFay08Qge61c88kmTWIYL0xMFlZPSdGeSm9OdEwWoUBa6KEumBt+esgNr2gsBGh RC/A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=M6F8QNT9; 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 v34-20020a05622a18a200b00431618d6b83si1405402qtc.633.2024.04.05.03.30.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Apr 2024 03:30:34 -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=M6F8QNT9; 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 1rsgl5-0005y3-Ea; Fri, 05 Apr 2024 06:25:19 -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 1rsgl2-0005xU-BE for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:16 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rsgkx-0004Yq-88 for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:16 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6ecf8ebff50so832996b3a.1 for ; Fri, 05 Apr 2024 03:25:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712312708; x=1712917508; 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=aA46PcSFh0E670CdL7fmcUflkfJ8vHcNPNbv93pOSl8=; b=M6F8QNT91bgsjpx8/H9g2aOoXr/88c4MU0myPftqFQaNVu0LyvVxXz2R+59x7GvFbN w8PQjY5jlB5t4Yxd8wnoM20PtHFi2p8/lB0IxrFoKEOz2eUJuz4YopBqHpL371eGSUvz UPB56xi/AUPTNm0VN9TLlGlag51uPfPbM9hQCdyl80A3Ke8wQJ6SX0E+yT5fWYvAarDq 7btqcWLwt7vAU9I/6HerKzTzQu2u3WpZeB9Uk6mOC3ccSzxM7mRO3zyeuTQcupLR6s/6 YOSLZ4Rm7Op6kd5/U3FeS58WiVnnYspEraGK2UgylcMGmOO615CWuMZAo34aAXmsnnBQ b16A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712312708; x=1712917508; 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=aA46PcSFh0E670CdL7fmcUflkfJ8vHcNPNbv93pOSl8=; b=N0pJD3ll2+9qY2oMDip7li7QWFCeu5HSPoFq5jzG+zOmVqEAx2881/Slk+yLgveXlx A5nhousTyUmSsqLUsIHR3UneUJryEToWVNNJrk4TD33KqbpmDA31D/JdiRPm1G0ad1gX /9hjFO+9/fP5OeqYO6jR7Y21rVesuKwqtLuG9Okt8c4obIJxCDRXAJBzAc80GVp+OK2T CZ18tkEGd3hVr+rBEEBELvRpaqbnEPWtgvsoinWv1xkifqx7FSTfOe/DRProeA2SYBxI d2CMDuSDu+sIYR4ROGC55JhbTLv9gn3iZRBuzEGD4FnUNv9jdyYNoZ8TC8ViwmDUPwUg 6EuA== X-Gm-Message-State: AOJu0YxBqA9/l2ZURfLXFiwrdDlPkO8qifaHti/NJJDamcxOeMAhnbMI MZv/uRYb1w0ySTj00xdW24ZQ/76lN9/1fCb9dnhPl0KwTlaEoQIGHRfaS7bPLQEtECjxTGrlJRA x X-Received: by 2002:a05:6a21:99a1:b0:1a7:3b62:4e98 with SMTP id ve33-20020a056a2199a100b001a73b624e98mr1767483pzb.12.1712312708580; Fri, 05 Apr 2024 03:25:08 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id h10-20020a63f90a000000b005e438fe702dsm1104304pgi.65.2024.04.05.03.25.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 03:25:08 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 05/32] accel/tcg: Cap the translation block when we encounter mmio Date: Fri, 5 Apr 2024 00:24:32 -1000 Message-Id: <20240405102459.462551-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240405102459.462551-1-richard.henderson@linaro.org> References: <20240405102459.462551-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.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. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- accel/tcg/translator.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 42beb1c9b7..438b6d4cba 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -236,6 +236,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; } @@ -284,6 +286,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 Fri Apr 5 10:24:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786230 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp93499wrw; Fri, 5 Apr 2024 03:28:39 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWxXKVrFJselG5f+9yTqAFXqk/pAtY3aGLd2ml8hQIBHEvJVJ4cBFUizm6Mv17STrYcOvDbHZJFfiiLbU16zo34 X-Google-Smtp-Source: AGHT+IFZ3jd4MxpOt4SYUWSQnQd6/9dmVoEXoPIMfk5KYj5ADtrJssGdX8HDGKQckPaS+P4SOxkI X-Received: by 2002:a05:6214:c8d:b0:699:2c6f:4aa2 with SMTP id r13-20020a0562140c8d00b006992c6f4aa2mr903477qvr.5.1712312919336; Fri, 05 Apr 2024 03:28:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712312919; cv=none; d=google.com; s=arc-20160816; b=IjUYCZU2yhSC2k1a8AYA3BesB8oy/4AcvhY0jvGJ6xD5i5ivZ5Prhna20Hbt4rAC+y /foAIoMYGuYvPYXMmAytNtGi+vTTOPO9vz00WThRl47l/rwbOcssZbfgRo7hGTq6lZ9c q4rT1MoLTjmxq1cBPN5/gx9ybX1blxZlVQK7XrFYr1+SYprXRuPSnNQxJGlgOTvKA2W6 5kxVSscSV/7rpCpy/moY2kbtMWigL2E5p+57/27LKrrNskFLyrFxyyCWIfpGFv48LAbK d6RN7z1jI8IW+UTXYZ4XmtGbJ/vMp+Q6e59VB3Kn9pUsjTUi4mmXNDU8oren8kpBSE53 w+Pw== 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=u5+pVSAg9tQ0fLP/+FG5I9U0zGo5SwpUOOXoI7YuppI=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=kQRfg9BeyIp4JLmiBB+8Q2ZaYbkSUoHJGr2Bb/NQH93Kv5L5jRUavZNEWqkeAnxJrr kUOm0ULIU/p/kJ/xyVvLchTkpzzRPNa0EyOt+ibXAQjaf4mvAYaCfBGNBxn4mlgbB//+ qyen6xWrr+Din/p/YD5jRWIL9FViv0jEkookOdTAVLtW3cJYvqqhe3+nkdklAy+HDN30 i4r5sFnR96j0p5UsxbfSoaZi6dpNwBE4q6kfECfE8hYiXsLfIYkdZqvy6eNR01+nl8JV jE9OJageQNkTfg9tDsL1toyfe4wMeJGlevFhgEhaN0ntX5FoXuVTDIqQNPu1aiVq7kDm bJhg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CxrjXb8f; 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 t19-20020a056214119300b006991b467c00si1450008qvv.111.2024.04.05.03.28.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Apr 2024 03:28: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=CxrjXb8f; 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 1rsglB-000604-9n; Fri, 05 Apr 2024 06:25:25 -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 1rsgl4-0005xj-GD for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:18 -0400 Received: from mail-oo1-xc2a.google.com ([2607:f8b0:4864:20::c2a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rsgkx-0004bK-Ej for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:16 -0400 Received: by mail-oo1-xc2a.google.com with SMTP id 006d021491bc7-5a4f608432bso1257874eaf.2 for ; Fri, 05 Apr 2024 03:25:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712312710; x=1712917510; 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=u5+pVSAg9tQ0fLP/+FG5I9U0zGo5SwpUOOXoI7YuppI=; b=CxrjXb8fwVzB6wQyBfRIB1gxiqlN/sPjvFY3QnrmnOpC+aAQd+kMjGR/92K8eFRV5D JmVamEBwlAQGVwi2tYJJz83dV7t2mn9CAm0FWw+HqJZBFURGWDJ3DyasHBQ33fllK1JW KX8tsqSc4tvfTOFcyRd/wzicXL/nRoUIlfvszMAdoul5k6g+OIafpl5SlSIArV2EqkIX xp291+4QtpSU1mvGfSnlhYNy/2Da9/vrz3PcAK7OB11Nb3Syw/0krpktCtvV3OpSMJqc vcgGLNFkmnvsMZm3bH87XpOzQM9cU5ySRSDYfIk5kE+b7mnTfOuSK/VaZijfro5xWdtX jT8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712312710; x=1712917510; 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=u5+pVSAg9tQ0fLP/+FG5I9U0zGo5SwpUOOXoI7YuppI=; b=mw+dfFXjqw05of2LqXUevwbXi6uifSdKjnJhiOg+nwTBZkkFfiBeNkjALx6ur2mQSH 35jpIWAyjOgzxaS22meoNg/xJlZ2xq9t7NQYfYWVtvPCbYOnGJg/MxY7XeBHoUMxOMEM XW/CX/1f3lck26VtPzN3bNcpQJN1uQn9wMKxpqmTPfwqdRplDuW+04ix4DW0zdJxfGSW CQaauPeUbhpzuP9HYcXXE1TvoZVbBCIVLVmZD6k2xZSg4HUbNb0Hwofzrl+DqTKNpnoO YnzhT7uZMB/6A+irHOSoaVugvMlGkrSM5QcctuODUNUdNTAH8EOIOCEdc7xgegq/HwSJ zo9w== X-Gm-Message-State: AOJu0Ywu+EdkQqoWzHwcuD5yU6ArwNA4LRpoxwUIGIQa2WJTJM9QjF90 lRFETAHl+62ywSPg2Y+635WhOgfHnu+OlcaDV7LSBEyclW9j3HMNtT1ykNJBNwQT+jvZ9w+dxti K X-Received: by 2002:a05:6358:c8e:b0:183:cfe0:8da8 with SMTP id o14-20020a0563580c8e00b00183cfe08da8mr1058912rwj.23.1712312709912; Fri, 05 Apr 2024 03:25:09 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id h10-20020a63f90a000000b005e438fe702dsm1104304pgi.65.2024.04.05.03.25.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 03:25:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 06/32] accel/tcg: Record mmio bytes during translation Date: Fri, 5 Apr 2024 00:24:33 -1000 Message-Id: <20240405102459.462551-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240405102459.462551-1-richard.henderson@linaro.org> References: <20240405102459.462551-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c2a; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc2a.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 --- 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 65d0c6489a..b341dfbf02 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -88,6 +88,18 @@ typedef struct DisasContextBase { int8_t saved_can_do_io; bool plugin_enabled; 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 438b6d4cba..401c0ca30c 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -143,6 +143,8 @@ void translator_loop(CPUState *cpu, TranslationBlock *tb, int *max_insns, db->saved_can_do_io = -1; 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 */ @@ -314,6 +316,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 @@ -341,6 +376,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; @@ -355,6 +391,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; @@ -369,6 +406,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; @@ -383,6 +421,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; @@ -390,5 +429,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 Fri Apr 5 10:24:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786212 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp92634wrw; Fri, 5 Apr 2024 03:25:54 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXbqU3xvgbn+1WnMEGY9GUgHV8vcV6UMjnX4vQJh/090jkbWWP6qeCRZBoUAxG6zS1yDRZx87P4sLOibku6EGhV X-Google-Smtp-Source: AGHT+IHcgoGyDeuPBAM7CUopDmBsh0Ypgn/ATvnVpBFRjZNLLUb9YJAVf6RiZlLIIbTLlhrQPkAn X-Received: by 2002:a05:622a:4e04:b0:434:61bc:9cb6 with SMTP id dh4-20020a05622a4e0400b0043461bc9cb6mr793702qtb.19.1712312754617; Fri, 05 Apr 2024 03:25:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712312754; cv=none; d=google.com; s=arc-20160816; b=MI9yGqv5LQPQcRuxnVrTpEs4Zo6YDC8AQdTsy+NwyuygeTw6oM6ygTPb2r8wKDNyQ0 A1xE7bSiXBEd/CmOZ1rSI73tHieoOJc1KAUkQMVceMT+dRloNposuFppKrZfRvwewVlH eEXte0IX3jIUbuJTxCrSvmDN4CqIzsPktIRMgXd1qPUcp88uLe0zSD7UQ6+SRo+ev2la fCcdGZ18y+Xx6sGFh+TdOwnAdLNSMRWWHoLPCOrNduyWOIIBYvo/nurwoqraKY1HTYjs mlRSwsTw/QTQnrDe466W8a9TVHOzXH3PaGC+mijx4Ay+f6LZ386HMd4tW1wF+79shNeK z+cg== 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=lHKXiNca9oh0uRGWThBshA56THsn/2RKbVVfZBx6X0o=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=AW8w4k/j68tYzLa5SMiwIc7+3sRkMP1D+xUST7kX4+m0zT1pXW8WLQBD8Wsb6EhZ98 poHeZhU65FQH8gsYfWGEdTxn5F189a2lsTEPoUTrDvIVCdi/WD0/DLsZMIDzE1vsIZJe oA7RcFea8/LwlcKvQiKBtAK079Arb3wSK62el5Qw8oP/Wpyabzt/SzfwEsoYl2+fc53A iNcgpy4fQIkUPPKx2a+wdVcJ2x/027cQVtTYLusu1vJ3FBgxBMFb5GnqUAeUFSmhCz84 ri5NaPk5xGr4j4X+3XhYPa7TRM89D/KaSk6hQMJ5eFm9LBqQ6Ja3ciwQ8C0BIB9Jnysl 13zA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pFMDqKKl; 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 k7-20020ac85fc7000000b00431487e1b86si1490765qta.113.2024.04.05.03.25.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Apr 2024 03:25: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=pFMDqKKl; 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 1rsgl9-0005zV-AK; Fri, 05 Apr 2024 06:25:23 -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 1rsgl2-0005xb-W2 for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:17 -0400 Received: from mail-il1-x12d.google.com ([2607:f8b0:4864:20::12d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rsgky-0004cr-Bc for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:16 -0400 Received: by mail-il1-x12d.google.com with SMTP id e9e14a558f8ab-369ec1fbadfso8275825ab.2 for ; Fri, 05 Apr 2024 03:25:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712312711; x=1712917511; 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=lHKXiNca9oh0uRGWThBshA56THsn/2RKbVVfZBx6X0o=; b=pFMDqKKlhGoRJqbGL+gOlltjb9scPN3rF8RYsL9xUWjnP9wXuBZsYDYpDSCVnBwgi5 Vjdy2gAyxe2kCI91CwMreBcpt88p7QJQrmhN7lgcDqSGMsoZ79HvR+1fWS13jsjpN3T5 zQIbtXWo6eAsQCFLHcBkVIS96CRHRqig+nXphi2aw+3ClErpcSLO88L2t6y/AIVezoIA KGht5/d1HGQBs+tUrnEeuuTPptLprj84mlUJrew0+nfS6sfND9awvtOq9XkeobEoEhXC NqrI18zCKiAXxb1p2ryl9TdybdZmiAG7DbQRBZGB9xjNXM45aVpRnz5Jxpe2Y7d84M7V kwsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712312711; x=1712917511; 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=lHKXiNca9oh0uRGWThBshA56THsn/2RKbVVfZBx6X0o=; b=p4ti2jQ1O0gUStkxKd4MOPpHFzFngexjhL7zUimgFH2E0iyNamcbUIL1ExU6tHIKYE 0ZcOt73Lc0UfLUsctOYdjlIBVX8VBOOw3+WGj4NHCNeFtGt7WQl0KUFxTzq+W7c9g6WH WnTfDTkRcHse7N98mzP4xBbZPFS/9x45EEYGNVAa3Gwwlg2lvyjO3Ov3FfF+Tg0MF/T+ 28NehEMw0210Ec41DnYQ44Sq75ApV3mHO2VHNxzgLQFiShIpW/Dp2Zqr3M/N9y4chtTr SaEwAvxR2rI65ro4qCOTjHZ6u7fqyBH1zqyyuLEIA27jmqloThximaosyDe71+hkiKWn VCxw== X-Gm-Message-State: AOJu0YymJyeBjZcobfs7QluG2P9VIbpJ/zW57BYi4sDs6dmtlijibXcl gWHXV/AXSauiAwAlZu/SqwULlM5xMok2cqQdmpLYugdltDGqpRup5EoPSgNQNnlSK9tYHZKxfj4 G X-Received: by 2002:a05:6e02:1fe1:b0:368:953a:1735 with SMTP id dt1-20020a056e021fe100b00368953a1735mr906180ilb.9.1712312711063; Fri, 05 Apr 2024 03:25:11 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id h10-20020a63f90a000000b005e438fe702dsm1104304pgi.65.2024.04.05.03.25.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 03:25:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 07/32] accel/tcg: Record when translator_fake_ldb is used Date: Fri, 5 Apr 2024 00:24:34 -1000 Message-Id: <20240405102459.462551-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240405102459.462551-1-richard.henderson@linaro.org> References: <20240405102459.462551-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::12d; envelope-from=richard.henderson@linaro.org; helo=mail-il1-x12d.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 --- include/exec/translator.h | 2 ++ accel/tcg/translator.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/include/exec/translator.h b/include/exec/translator.h index b341dfbf02..2d42a4e7ed 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -74,6 +74,7 @@ typedef enum DisasJumpType { * @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. * * Architecture-agnostic disassembly context. */ @@ -87,6 +88,7 @@ typedef struct DisasContextBase { bool singlestep_enabled; int8_t saved_can_do_io; bool plugin_enabled; + bool fake_insn; void *host_addr[2]; /* diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 401c0ca30c..4a1c98cb63 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -141,6 +141,7 @@ void translator_loop(CPUState *cpu, TranslationBlock *tb, int *max_insns, db->max_insns = *max_insns; db->singlestep_enabled = cflags & CF_SINGLE_STEP; db->saved_can_do_io = -1; + db->fake_insn = false; db->host_addr[0] = host_pc; db->host_addr[1] = NULL; db->record_start = 0; @@ -430,6 +431,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 Fri Apr 5 10:24:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786242 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp94465wrw; Fri, 5 Apr 2024 03:31:26 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX80qrSirlUmQ7pZGqGuAruhVvMQWtUfkZt3ABDViFXBnVw/uwbego0fQc5bpobB/qYQb/FjwI3mztwbZNSOTi6 X-Google-Smtp-Source: AGHT+IFdkVgVL+5RrXFs2XrXAfln+NnwV3kNMLBw3ncNMcEPmTpAef0VRvTtJx9/J0jvxIPmuwCZ X-Received: by 2002:a05:6808:353:b0:3c3:eed1:adde with SMTP id j19-20020a056808035300b003c3eed1addemr1063166oie.14.1712313086458; Fri, 05 Apr 2024 03:31:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712313086; cv=none; d=google.com; s=arc-20160816; b=rZPTMylANlG7UH0zaovYaZhtqODs5zmkS6rsA1wLh1LvvuhjwmP1zkVKJa0NnsaSKw NyH91jbIY+B3Jiv7xhWdo8b1QO3bwxMAh203roh9rQl0FhJn9Vt2xfF16rCFqZ1KKkm2 lAj3axzJb+mnPPpH4nC0Y8i7oxtwnmRcWdoipdqz+6xouJGHeLtqCHsKq21L1Q6Kv7hp OldBPdRlEcg5qn864g1ke5Y20iDOJr9chXJhXHe2ZgDYUMvdmtyDhavX03jdJs1geOwj NVkaJgAl1MlF+b2mdadgCwWLIp61Q/XAq/w6YMkL3daHP3ebOZ0qFAZ3Xdb5McL1N5UD 5WnA== 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=FD9HNAvXef+drUIzSjVgSmgQ6Jzen9yW6mcs4+fRq5o8UEDP5mGSxyAEWl9BPEaa6w rf2YB28ztj2PVKsiMN0CHiQ4EuK/9JiLOtCGPYN8UzCY5QDfyzisxyPvMVdPw2grxmKI IoBsygFI13T9wH7825kstIQulNQiKrxK7Tzrzi5U0PoWQGSo2dqRH9X6umZyBpxWkHYF +7+Tvqrs7G+NPUrbk6DNq6OAjOslhl96p3Nhg25SoUmpPZxbT0YlEziN5qqb2zBB+hkh Um/ekgSyD4/o83lw7a7UKjmEHIuNEdAgpJUdjoPP3lDR+ctbYGy3f7Aa6wNDjbppGSEN Lz0A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a0auxoAH; 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 c12-20020ac85a8c000000b00432d3a7d73esi1393224qtc.469.2024.04.05.03.31.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Apr 2024 03:31:26 -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=a0auxoAH; 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 1rsglA-0005zp-LO; Fri, 05 Apr 2024 06:25:24 -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 1rsgl4-0005xl-IS for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:18 -0400 Received: from mail-oo1-xc30.google.com ([2607:f8b0:4864:20::c30]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rsgl0-0004ej-Ea for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:17 -0400 Received: by mail-oo1-xc30.google.com with SMTP id 006d021491bc7-5a5272035d3so1030156eaf.1 for ; Fri, 05 Apr 2024 03:25:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712312712; x=1712917512; 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=a0auxoAHpw4KdJUE7mZ2KV4LnrV12c4Xw02M3iC4dw/IbhdrONCpP1so038k8xj/Bw +6iS5lezCN7ltm32GMcrc7RLdHgkoZ5ucq0RjlV+RjSDtTym/8afLuO/I6jFsBx2MflL mvLps+C7rkbxoFVLYJgTwGTjLAxg+8kmUqJbzrDp1HgYZUrfvAd9wa5czj+t6xVvY1VJ udobKnqcmd8SNjNOVZZ4w0FwAblmfOLfTzdfbu9rluw7uiGOSV7HuLjSJCLpa1Z1bwLH 4BNS8bB/D7mTyTynVSpUeMEkTRe5sMCkEZwFW6FIkrt1fY7yDAUkXbipEaGCT6oE4+ti 1djA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712312712; x=1712917512; 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=mFX8gErBsyqF2Pl6yLj80T+VefZ/2iLsbN/bZP9fHiuvoguGaAjtC7sTwpoQ+TscbO hdC/qxTrQIeCATC/Av/CChKR+qSfmqonp0UtujmDBjcQriuWXUSJL6jYawkHzQlH/v1I D/4uJxUuV1UHSUFfTV4jbfsaONrcH6Z5psgFTOp1POZHXYhLLQPfdE4XSjBxy96tqFuv 0f3Xqf4OjNK1d4V7+Wi28duExomcP641/B5VucPgdt5fy7bA2PaCe0Lx8EAiYYmINQbV WTmpqMGFgz/BuDet+O9stArDtpAAylGfSVYIBPq9/R0b+FV9sDi+VJ+IQy/7ijkP7huA DTYQ== X-Gm-Message-State: AOJu0Yw0vGNK/zNNPgy9z47YZul+edR5fflwo6JZq16zLP+EscSCptgo 9xlHPlFCEfK+tQ4hXKE8aw6WxKqu9oC74no6FIUP5qah11MsLpclMSTf4zV1U2KYh5iINaXfKR1 w X-Received: by 2002:a05:6359:a214:b0:17f:59c7:436e with SMTP id ko20-20020a056359a21400b0017f59c7436emr1494053rwc.29.1712312712231; Fri, 05 Apr 2024 03:25:12 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id h10-20020a63f90a000000b005e438fe702dsm1104304pgi.65.2024.04.05.03.25.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 03:25:11 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 08/32] accel/tcg: Record DisasContextBase in tcg_ctx for plugins Date: Fri, 5 Apr 2024 00:24:35 -1000 Message-Id: <20240405102459.462551-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240405102459.462551-1-richard.henderson@linaro.org> References: <20240405102459.462551-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c30; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc30.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 --- 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 Fri Apr 5 10:24:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786213 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp92780wrw; Fri, 5 Apr 2024 03:26:22 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU1GXSGaYHN9F0nFq3F/YrP8JfOq+KU8u6UCF/NDoJQ1NtKv7N8ac0wbdhRBeCMesKu//XVl/9kIBCLb2damyqh X-Google-Smtp-Source: AGHT+IEmzTNWvYLwjPqSmcHtVTJw+zyNQfDeahYWzuuoEMaD2d+xsmMsgEwIm91WC9qKErrbt3ik X-Received: by 2002:a05:620a:89c:b0:788:2845:878b with SMTP id b28-20020a05620a089c00b007882845878bmr877175qka.70.1712312782156; Fri, 05 Apr 2024 03:26:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712312782; cv=none; d=google.com; s=arc-20160816; b=ZOL6oiAUezhonfmRyQeN7Ivic0833u0aK3bKVru5F6Uk7kQPjrtGC8qVEi0gxUmjKl 7YqGp9JMxRX/ZqWulzbF/WyalNR0WvTDnZhHCfhv5B5dxkpPOQ0rz/LaHhexWlOtPFjt bJ7RBXMuOP/j09aphPZO32OMYlu2D12DXfTwlBM4sKGf0dh9K5hA3fjL9pvkTVYYyHuq yvKdIs+A0MTK67vvaEMxYUG7kLT0lj7Hj52Sd3O+nahHrLwjg3Gl/NeBhYIe0KI+j68a tr4PHnZGEc9DMA+vc8euib3s28CfgLlf5A03u+h6qtliZXjhpno6WWgI59OGoMgIWxEF 4aaA== 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=gMWovfToSuJYvAbDdiQ1p1zP9H+RLTC9+egci/evGdlVrQTFHWP+7sv5fQt27i4EA/ CpeA0K7iBWBFLttn2PN8oYa7HwxhfAnJx7XR+kwsnvqY9q3rwpXrQ2Z4mR8RupVGO3o7 qb484a24lvXvYqdakNr6pHyQX5HUsiWXc4amlJJMXe4vZb9UyaQzExkYm2Ed1eUx8q97 eSA/yfDD8t5cpkj+Doy2LRHgIR1/cPF/YLvASN/dYOh0OLZA9WqmpYHJDle+x+NO+kjI 9Pthy9gCONlEYpB+THySEMRi72sog0V/4pWRh71QAHR+PnsGXSDJYOnnRZDHsIuAFEDa BHmA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dDKMe5PX; 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 f16-20020a05620a20d000b0078be9db9602si1449477qka.228.2024.04.05.03.26.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Apr 2024 03:26: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=dDKMe5PX; 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 1rsgl9-0005zO-0v; Fri, 05 Apr 2024 06:25:23 -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 1rsgl4-0005xo-Iw for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:18 -0400 Received: from mail-oi1-x22c.google.com ([2607:f8b0:4864:20::22c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rsgl0-0004gj-Ke for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:18 -0400 Received: by mail-oi1-x22c.google.com with SMTP id 5614622812f47-3c5d940525fso985213b6e.0 for ; Fri, 05 Apr 2024 03:25:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712312713; x=1712917513; 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=dDKMe5PX+SCI1hyDq766XnWgLng6q+1UpnHE5WAbIOv8znedrMn2DN/4EcMzqcN6Kz PbKGsmZJP8jRM+aN4afLbO6JMgxpDCxA06/wmoBrmyvCCCG1t2BzMZtUJN0tRgUSAnMg XrIxKMzCGLKX2CXOFHPCh2RAtb/aP0dq2FuKW4fQ+ljkZS/kxYK+4/2SQnHp0Q43HgIz dwyTqIFpvfgP7PTS/NPoN6EbyA9V+dVEWKg4cFOM3Ry15XZ3XIelbvG8hZS9Y/jkAQBj cCwXReudAo03yJ+G3Gl8Oc1Rvij/C2Nm/PT0iu5FVJXH7QFD0SNxQgzrfCEFSgs081Z1 hbkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712312713; x=1712917513; 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=AfGDb3LxCpSt3Xk2GgPeg3TElIyPmDkQgNvDr0kSAZdg545SRNAHlt22IOJcWdpVvC 70I7UT35n8Aj4wZT3furTZVC9gXGf8zUndLlzQsq3umIuNpGx88sOxBZxbc0X7mBk4ly 73+spqED0yFEPXRmw8PfRhyRuVw6ZcmNVA9SgVFfYoyfdpgqyejoccxhu2aJ+meRBEBk ib/KhM/xhqPam5uxIW2+hQBUVAM55St78PlJrHTb0x/+XgnPYf57m5Uq5zjSuE/Nbi3T BbPEL0wBSA+M9e2f3vleUIJEs0uQrbFXlnzlAH4Dkhee6iFN/eMo7w7GRP9uMwyfw4c4 xnpg== X-Gm-Message-State: AOJu0YxSlgh9p3ojEsMNzp3Mcvblz2Ve5cc4ww8Y/9SZW2luSZeGMULx CaVrZsn9FRMOOnRxcgUWEpZl0u+VCJv9Cvjs4pFkKJ2TOwIx8NkNeaGDDCiF8OtgdoEbbb+Zwnu 2 X-Received: by 2002:a05:6870:829f:b0:22e:aa18:bdd5 with SMTP id q31-20020a056870829f00b0022eaa18bdd5mr1241356oae.12.1712312713376; Fri, 05 Apr 2024 03:25:13 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id h10-20020a63f90a000000b005e438fe702dsm1104304pgi.65.2024.04.05.03.25.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 03:25:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 09/32] plugins: Copy memory in qemu_plugin_insn_data Date: Fri, 5 Apr 2024 00:24:36 -1000 Message-Id: <20240405102459.462551-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240405102459.462551-1-richard.henderson@linaro.org> References: <20240405102459.462551-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::22c; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x22c.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 --- 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 Fri Apr 5 10:24:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786235 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp93827wrw; Fri, 5 Apr 2024 03:29:50 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXuRqDvDnRWyDOhE1dYGtJwkRC+G7FzDxpI60AYMva5n/3X3gb4POqKPGygPG+MbP2D514WThz3uvAFy2ipFN7P X-Google-Smtp-Source: AGHT+IGn4uSd12owfjrhtifXyOWQOFD7fYEbNQkGZwHwMdC2Lah5Pxrd2z1xK/G7MmLV6YplUlyh X-Received: by 2002:a05:6808:1a8e:b0:3c3:a892:3852 with SMTP id bm14-20020a0568081a8e00b003c3a8923852mr878746oib.16.1712312989926; Fri, 05 Apr 2024 03:29:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712312989; cv=none; d=google.com; s=arc-20160816; b=srB7wa/nIrwzt3TCJufC/Ilo8q1OYycy6ROv19puBKkKX8VQ1c/IdI2OU4BFC2Gf3b e6JJirrv1CAublnoiwNXbTpAdvTItzed5Rhs6FGBHo8uFdAB9+17FFhyrnObaZdNkv4B DpbGZYOoWCGbQLgSO9LbkdTLQg7OYjjSuYre8EZkToT9UT05A5f+jb4sUkHVtCWhLDVX UXghHEoYgd66LTZa/0y6KkeFXyDxLFSOn/i/q3pvj0Sv3iuNRiGxb7J1JKrwrSazXTEW hR9eTuA00Z7ZzwuyQOaRDOl79RRpJIimsJswwoKlkPVDBNnnanCKVBw3zA0W6fXgcBpJ Y5qg== 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=KviirDjHb5dnSu9MfRISBG6Gixu/OE0N1lnN0IvuL2c=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=nWJcv239NSJT0OpJTII+dq0UEJv07Kps9nx5sPGvQIeupz2GfNI2LNqT+8iMALdMy0 LGvZXHAbZlwNQYUUVNfx9PhwCXEU+lG2ouQSynj+04il4hhXOZ2d5d+wP6JAcAkL5Akj WqpdCwdCoa8UGUO7svZgHMT+u1NKzYMiTQcf+VsxKd0Db/ynXlGZCXxVnwA0rVm6jk5Z SDlBrm3bZbp65UlYYykHqFBP5VXszYjHg5mUVR7WUDsBj9S6k4LMpBEvoVQSMs0741tW 5KRLut0HUHgcqpqchc9iBoXXFZtU9zo/jctssQ8gMnIrQ4PltAyt3WNrwazewIZj+fZ+ dhYQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=S9fyKbXH; 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 o11-20020a05622a138b00b00430a6018435si1478916qtk.738.2024.04.05.03.29.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Apr 2024 03:29:49 -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=S9fyKbXH; 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 1rsglC-000609-4a; Fri, 05 Apr 2024 06:25:26 -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 1rsgl4-0005xm-I2 for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:18 -0400 Received: from mail-oo1-xc30.google.com ([2607:f8b0:4864:20::c30]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rsgl2-0004hX-3D for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:18 -0400 Received: by mail-oo1-xc30.google.com with SMTP id 006d021491bc7-5a9f6b0ea90so202955eaf.1 for ; Fri, 05 Apr 2024 03:25:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712312715; x=1712917515; 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=KviirDjHb5dnSu9MfRISBG6Gixu/OE0N1lnN0IvuL2c=; b=S9fyKbXH00dnERwd3wEV96x7eKnWaeK6C6Nndw6aCDoO5RKIu02K5/tdCQO950EzKt Z+ySbbWHJeV4juET3chI1aw33prsNtIBAqBboMw8X4nbec+EvG5dP2Ft/ebR/o1Nxgaz 8jps5++sacAF6TocKLkVYeZ7O2wWgDAZ9lHJ7rI6HElwaMf7yqNrjxOgUwGbINt/VAu7 afQHR99F6Q3dN5XrYCu1Nv9641EW/vzpFaJtZOhLZN3lJH1p9v5TTRx/oSI7ToLQzbUg uBknnv+L7m6OTn4xdbZBFfqm1HydRXpshfPNvvnmviJ1HaXg9oqhPQUHkMyJh+1E5RQy KVqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712312715; x=1712917515; 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=KviirDjHb5dnSu9MfRISBG6Gixu/OE0N1lnN0IvuL2c=; b=Bsm7VS7Jyymwssd3eeG7hNYUKzFLBzc275aMjvGOuWneL+9/kHa+mzMBzrC4ATu+CK bHrLjFUxBIb5Y6Nmhr7n5Mxiiyj9Ao502J6/rD0Gg63ADiw4m0/+RbmjYfLo9Z0SzEhz 654BKJX10RDUJ1fqk7Vyz4bnZCXA2VQP8ZWG1vIQzWV5yNid7HOlxVhjvtRZ/Hsdbivd HmRNQu4p0Qx5+MsYZSrPEFaWN/sTTr/DqF0cB7/0evh5QS3UCmI6GtXZq04WXOVZaifi q+D+O8dE4I1aRLG9ePBPaHqTyN/R7HjwbaHucK+SuesOP1FCTYL7QI6eCpfzGZSAdexk yGWg== X-Gm-Message-State: AOJu0YyADKpLunTEbL0jdQTdDN6G5IPdimPkTK/K4QvjJciNt1v60dx8 wE58ODhg4UWFmVNND6zEabaqTSj/Ra9ebiDw5GX0G6ypjjtzr1kal/5IdbN5n5Q6KPqtXuHddbA V X-Received: by 2002:a05:6358:98f:b0:183:645b:cfa5 with SMTP id t15-20020a056358098f00b00183645bcfa5mr966128rwi.15.1712312714763; Fri, 05 Apr 2024 03:25:14 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id h10-20020a63f90a000000b005e438fe702dsm1104304pgi.65.2024.04.05.03.25.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 03:25:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 10/32] accel/tcg: Implement translator_st Date: Fri, 5 Apr 2024 00:24:37 -1000 Message-Id: <20240405102459.462551-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240405102459.462551-1-richard.henderson@linaro.org> References: <20240405102459.462551-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c30; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc30.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 --- 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 2d42a4e7ed..97cdb7439e 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -245,6 +245,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 4a1c98cb63..3421469a31 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -350,6 +350,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 Fri Apr 5 10:24:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786224 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp93174wrw; Fri, 5 Apr 2024 03:27:39 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVK2JPOeySKjNTmbGVi0CQm+9VBxvnGqYFPg/k3Aby629yqlm0gYSVc6uyaiCIRu6rNPvqUf9kM5HE1Ejh9p8Ew X-Google-Smtp-Source: AGHT+IEdy2Y5Hix7h5Vs2tJCJ4dHSAdzPjTnD0EVmVfd0+ZMMz+ZMfpl5YWtpCdr4G21w9F1Bmik X-Received: by 2002:a05:6870:d10a:b0:22e:a3b0:34fd with SMTP id e10-20020a056870d10a00b0022ea3b034fdmr1156894oac.21.1712312859706; Fri, 05 Apr 2024 03:27:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712312859; cv=none; d=google.com; s=arc-20160816; b=k8gw5bocM1tzMImdEnU6oLuUXMh7fv+f49oDsJrwhUnfaOmE1kIxSdSTXuuyF919oC xmKalopvCq+6he5M0cs4Sd9XqrEJUUrj1AdohiXLdD2q17OKHlocKZHzU1+/pBlJvUuO oDJmtgqeeLbQ4jUTcTugi3pxxr8U0mxBjJfcCHVvFq1tQNHWHLidufst+Kb/5AoZdj+q QX6S5EoLF/q5LRagSpemsNnL3C5FySoBJKQe6FlJ8r9hOLBBnB9oFY60BMZ+mAVUiAR0 m+cUrLqLEx6vJEN5nxxZ+07+SFSVbufotzDEdAOriGlmPFA+q5T/TaB5TF2oiA+IwdTN xZKA== 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=sXJp68IxXRRxWP6mAKqccZKI80JRQyGpOUIyXQjxXn0=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=yM1LOrJGfVe4DfFOz9aWPGdhOKjTd2ZSVOw6mhrO7ep4SN73aK1OUYNiL7nvfjpORf uVFtxam+Xzw1EjfAT1hw+1W/GOhR7J6PoIN2/jjlahBviXkZeFmkjWedskY8Q9UoFdsw 3/fbYDI384l69CEfz+HONCyZu/gBDrrLPysnIFJWvjLKcrI0Ksz+UJfrKg6PU+NKFhO9 7Wut9opj1wZ4JPDOmZ+bu4DvX5nMNkv3iFVer7tM3FXvh1jHuE80dxXRk/FG9ZPWDHao 0oMI9otCjbJHBaYViLFv/rZuWzbFKmBIVaI3HHsC6Mj7jE5RnyrXA2yxmOml45FfZmHH 4D1Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SfFOrpX4; 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 v21-20020a05620a123500b0078bbea0b71bsi1420730qkj.447.2024.04.05.03.27.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Apr 2024 03:27: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=SfFOrpX4; 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 1rsglD-00060x-JZ; Fri, 05 Apr 2024 06:25:27 -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 1rsgl6-0005z5-A0 for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:20 -0400 Received: from mail-ot1-x32e.google.com ([2607:f8b0:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rsgl4-0004iK-71 for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:19 -0400 Received: by mail-ot1-x32e.google.com with SMTP id 46e09a7af769-6e9eccfc4b7so895321a34.0 for ; Fri, 05 Apr 2024 03:25:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712312716; x=1712917516; 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=sXJp68IxXRRxWP6mAKqccZKI80JRQyGpOUIyXQjxXn0=; b=SfFOrpX4nIQ8D7xk/5Wny/Te5hyr4MW1yMtxy3wugV4QVLNniO5eFKUTJbFWrPsz1T A5pfiAEhRgMHjpN1vGR9SPaO8M8Zw7HhjD+6hC74qd8h+zJ1gaRgjrde/Y1KRaHdbYgC 7w95yCNvhnHJskcPu8Uhn67udmh6gn28bU3RNB/t2M5XapNX4UW3io5d1kCFrSotxRU4 +a+me4y8Upv+SFRpAfOlXrOHNaxlq0kXZPVj+xtQ63gnvwe91ol+ioGIeqDzIl/L3ADP VZ/eRylEjfIy/jRjMVyDSyXYpWiufqPqqPOpluT0C3lEkeCZFVHnt29UJwS5i0HNi7VL VFYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712312716; x=1712917516; 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=sXJp68IxXRRxWP6mAKqccZKI80JRQyGpOUIyXQjxXn0=; b=bGpgLWXQHnnN89MbAO8WE9FZlubIgnppQ7ZXtbNADAPr+Oh5A7I1mOZRhPLldXruDj GfXWaP1yBl3OcGY2ZDvIQwIOSjErwFfb3ExWcAABtVVD12stAYR45DVFamT8IOy6DGIP 4hBe+qiDxFo8WnQizB/QR1hZTx+Potr56dhQ5ldxrdIflLQQIdt/vk7PsZibjsvE+tzf CVi+SPFhzCnnyhwADMaCn7IjDPV/vlp3r8Awpg/KvFLjbPimAQbF3jetTBseaMX1ryPr sCu/2Alb3Pq7P1gzJOEl2Hz4gaqwdpZECvY8dKJaMw1/DeJm+uNAq5/lA7a+dCGO8+C3 Jkiw== X-Gm-Message-State: AOJu0YzlXdnbNC5YnNl++HAQiKSGL56tE55JVQ2Ac12NNs1TA/fWKy0o 18XM1Xp2Dmqfy/jXwIyZ9WYeA5p7VqTGWotetCNv5z2YLLbjC3dkEvIQThAx9li4woS53gAl6rL j X-Received: by 2002:a05:6870:3753:b0:22e:b952:6d2a with SMTP id a19-20020a056870375300b0022eb9526d2amr1200806oak.34.1712312715966; Fri, 05 Apr 2024 03:25:15 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id h10-20020a63f90a000000b005e438fe702dsm1104304pgi.65.2024.04.05.03.25.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 03:25:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 11/32] plugins: Use translator_st for qemu_plugin_insn_data Date: Fri, 5 Apr 2024 00:24:38 -1000 Message-Id: <20240405102459.462551-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240405102459.462551-1-richard.henderson@linaro.org> References: <20240405102459.462551-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32e; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32e.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 --- 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 3421469a31..0a1d26b2e8 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -405,27 +405,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; @@ -434,7 +413,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; } @@ -449,7 +427,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; } @@ -464,7 +441,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; } @@ -479,7 +455,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; } @@ -488,5 +463,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 Fri Apr 5 10:24:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786215 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp92896wrw; Fri, 5 Apr 2024 03:26:41 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU+pBCXzKjh2EsqDtbc06AbPs8V9x3Y7tfIv4K2j3JuV8BTG86EUARJaADUv7L2s/KcPHQl5VbCCJDmOSSTBFwc X-Google-Smtp-Source: AGHT+IEg6zJnahvTVzagZWpFrKxjld7x1DdBHqETX441GIuwWHhcB5yaKWh4ZrYFOmu4fh6/DHsy X-Received: by 2002:a9d:4f0d:0:b0:6e6:96d2:acbe with SMTP id d13-20020a9d4f0d000000b006e696d2acbemr1012919otl.26.1712312801630; Fri, 05 Apr 2024 03:26:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712312801; cv=none; d=google.com; s=arc-20160816; b=IH0vyKJKwmj8CaOTm52Cd8sQvsKSw0k1hWlXWurL7881w6nykEVpnNTeZm1mVYdgyh pTlvfcKq1/PQne1Ifa0x5zdboHCCxje0gV6MmjxXdEFTvanh7mhULKlKJ6mbcuGVIfon WTvktDqk0tENwzsQ+2ZozQC3dP+UotOG/IkWKDOdWE9FGQUQ0GnIV+asa36WwkEy0H/D fO7ZqtOrKuyj14YRPbAbKO8YwuECpVt2jECy87LsD5fCwpPQhEYZ96tNp0A790yv9O3L E6jd/SfsbZS1ZyW6n/Kw9ioWEI0GUnY6CUJK63agOrj1bcaJJNnri0XtHX7hOgdJKChn Hc4Q== 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=pVczXwSwmGbu0M1qoWfxeDZ+kVcxLdctaqwAQ3Kgz2g=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=bTccSlnT3+6QkVSXyJtc8eXHbOcdlDFhpopfsWB9fJitIyqhnfONLunkgE6/oQNgWS l2nkrztLS5XB3s5VV1n7tOREo/UcJw0Y+3eFsxcw5k5UwrNIfB7wXzq5MguIRvRPefTr Ypm/c+OgfrX0GqqjN0uCDpVfu1D8Ka2twUasEcGJG5VErHtEIx0tj4xQmLAj0/klBc7g piH2hUvwsVIhB7IUApimySy+Xm9swLdEjGMhIm4hwKytY2AX7OeuqNxm0J6/GkeRU8JP u3TfFHcl/DXVn/iF2iAuXRehWJDY+wyIbGLqSCnWrdR0mJpjD3ISJz50/YihXYupyxLO ZQgg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SGddtqgX; 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 c28-20020a05620a11bc00b00789e614ce90si1433656qkk.767.2024.04.05.03.26.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Apr 2024 03:26: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=SGddtqgX; 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 1rsglE-000629-Ek; Fri, 05 Apr 2024 06:25:28 -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 1rsgl7-0005zH-4L for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:21 -0400 Received: from mail-oa1-x2d.google.com ([2001:4860:4864:20::2d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rsgl4-0004ig-Si for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:20 -0400 Received: by mail-oa1-x2d.google.com with SMTP id 586e51a60fabf-22edbef3b4eso58244fac.3 for ; Fri, 05 Apr 2024 03:25:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712312717; x=1712917517; 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=pVczXwSwmGbu0M1qoWfxeDZ+kVcxLdctaqwAQ3Kgz2g=; b=SGddtqgXnHN/lWAyj0B2O8crA2vIl+3kZ/jDjF2LD56oUNUptcgQWNVHQjpEaY/YiK WtAGBd3BpnYm+1C3EH9hW6uum8155UnGKptUknH5tj21W5moelaTh0gXOYVzACQlERLh OIMDbH/c5d5OzhHdf4FBTQzOVw4yz5y36RbQBZ6bTrQJRPYOh/kQTzD9PbHazbJ77muO EcFnnj/3dS+PhmdzoxGWNR3n9tq0zV5CyWAnEEnN2cYRJ7ZuarieMhFXB0E5mVlSAkid AYs+ihxp/ioQshEAfx9n9szLB2pdxmACVMcNi5RAl48Pnfn0usLI56NEYpeB4bNv1mtZ BOHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712312717; x=1712917517; 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=pVczXwSwmGbu0M1qoWfxeDZ+kVcxLdctaqwAQ3Kgz2g=; b=eewbJp4ysEg3FUlUmodmdnwNbgZRyhJi0El+buKledGVAk1EPPXC57E78O7vdZ6fA9 f6UshJt3GkjvSgCiziw0ryikV4Zu/sCKVHM8IAxUfiqSEcUL7hUdpNahNJ9Ef7023tR4 4yjztRszNzckboHmZiym2jRr1PHLdfBIjst2gpuUuG2HjmU72cTxItg9bHfEjQQ1Nhvn 5lII4PR/MK1o29A/yzkAIC/tBER3qE0wtgfoytmkS8Sb8Pbdy+Vi+qcADJ9ajZ7UCT2Z mwT1/0CSIyMxh7PIL3k9KMSZvesasSeNEb3qx7G2n52qgE27Jkacdi5dLZz0UI601Cfc GF2Q== X-Gm-Message-State: AOJu0Yx3++804BdWeOb7KsETHs5rlGfQBUoHV4tYxqpHZO3WzMKZMsLk htA7B3Mq4W82vJKL/u8YhCO1nbI2N0IGAQMh0eWkwa8j3cFVOmb8HNNqZ7A1JRHPUGNXaClRzk3 0 X-Received: by 2002:a05:6870:1a8f:b0:229:7f3f:bb6a with SMTP id ef15-20020a0568701a8f00b002297f3fbb6amr776807oab.32.1712312717203; Fri, 05 Apr 2024 03:25:17 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id h10-20020a63f90a000000b005e438fe702dsm1104304pgi.65.2024.04.05.03.25.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 03:25:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 12/32] plugins: Read mem_only directly from TB cflags Date: Fri, 5 Apr 2024 00:24:39 -1000 Message-Id: <20240405102459.462551-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240405102459.462551-1-richard.henderson@linaro.org> References: <20240405102459.462551-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::2d; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x2d.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 --- 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 0a1d26b2e8..46483414d2 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -155,7 +155,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 Fri Apr 5 10:24:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786226 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp93191wrw; Fri, 5 Apr 2024 03:27:42 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVO2yjQsrCLe/FXOM6+SvX8O1PBW0dbGsIpH5r2lyjmcCnMXb5zN13RYJym6pMgzZAbnHuBW43FZ/C4DXNccYi+ X-Google-Smtp-Source: AGHT+IG/LB427X32DqxlKzOBdkNc2lW+pknDW6wUl6aEJ9MlXW+GiUybTtsasFi8Twl3TKmdWmd+ X-Received: by 2002:a05:6902:2602:b0:dcd:b034:b504 with SMTP id dw2-20020a056902260200b00dcdb034b504mr967507ybb.27.1712312862471; Fri, 05 Apr 2024 03:27:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712312862; cv=none; d=google.com; s=arc-20160816; b=gtY20TNL2cPkzI4MiGVaDwY7j7s0Gy6O30czQRn3w4IJlFNztgwFa3Lycn2sYjHw8B SFx+eGrzL6oojBQJgVBOIJA0B6ry2IYOQ0AHStuLoYLRLB85piXEo6ICibkI+VAroZcW kz5fypME19LBDihFQ7xSxTEAc5jSjYB7N5bLaIZWRRx5HCFb230B7NT+HuVPi76fmttP YaReXcggPgnOf6/Ih8Iij9hFqgaNrXFjH39sAZ5tmeOeCfhqunOclMjXVFXpHFdNutsH otx6d1fPTsWJ8wOhdVxSWUYqy6Ki1vnanin4F4hRIHb/C7+K9VC49j0XmgPghCRMmBn9 b1/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:to:from :dkim-signature; bh=Wv67pMXMsVcEOwYDni8f26C2u4kTVwgef8xc6CDT8l8=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=BRPceb1nwnaHRcYJh7HwzfnPi6HtresMLJypmlCp2civNvDA5/sxkDxvLHHDEt4ep4 sJXQ4aw40o9S6t+WiP031HCMqhchhusOSI5OzXZi3556Ynupm8kA4VXeL9XczC/GECwM 1eAMJVDTscv1d5O3vcWu6POnxh1lYWcyXV6aDeMT9Wkl4zq7pjox//DbEJhxl08utlSH doRNKnpae2PERuJaSYb9UtuN5zC6svL/F7pWfYeGYfMKC2aYDzwE5XjD5t8cjALYRfj5 tYZpQBl17swGkZxBFa3UgoJfjsPubnVONrM4yAdOz0fzXDEVrqcc0K1/iE522NT2VM9M FECg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Czz6dgmM; 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 t17-20020ac85891000000b00434611894easi670238qta.466.2024.04.05.03.27.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Apr 2024 03:27: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=Czz6dgmM; 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 1rsglB-000602-8H; Fri, 05 Apr 2024 06:25:25 -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 1rsgl8-0005zQ-9U for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:22 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rsgl6-0004jW-67 for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:21 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-6ecf3943040so1009219b3a.0 for ; Fri, 05 Apr 2024 03:25:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712312718; x=1712917518; 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=Czz6dgmM+hIGNAkIotrzPIGZjSxxFrN/Krfv7i9ZMt/AmTHDbdgxu4VvArvYFDYe7r 6zUXxwsZ34yeAyiakUyKne8BBmRytGMYEeJKdrCYZLIuwwIqmwwX/Rr/f8rIF857IBfC k3jScSZBO5TkixQDwWvxKTelcFZtoaUFYisOhyiKtrOKW5KUjEfrVIzypYPYn9iNXHh+ vdeTJmocWHpKvJmw0PofUvhLxV9G/dnQSv8qhEVlMwHupaufhEts2dzctmpyPyZHJqeo noVxisOWhxDVMzVOI+Mh60KIQ0yVMfULk1Obyr/gdyeY4rhYQZ4yNoYrYFVr6LpEPHdC 658g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712312718; x=1712917518; 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=FlTXmzdEc1ocPa24fFDRlC9VLuJk5bDHerC8SBB9q3zjCcN3u10QOE5Op5By7uOAz6 OAR9gzUZfViPIprZ30E87KlmVk5ZnV8Ljws0cAieRjhfxnhelc2Eob062cHFyChLGCq3 HoU051nniopj5VIjGHW6HIt6t0AgFrt9LxxWhYKGxXMqCtbsC9vzjxdLo4VP35OE53Q5 jd+59yIcVa2AkbTDCHoK8hi2iJ+LL466mMOi4xxQ9d6GqDQzj4EjOPUezoKQfN/p36uS epm37d84tBcv69/Up/tEy7rfdY0XHdsBvtdkSaW6i+qBNSlkiBpFr6Vcet6PY9E1KJQp BH6w== X-Gm-Message-State: AOJu0YwGTERjYFB8qjTtWRboWD5KtKmfh5qXYPf67qE63hj9lDk9eh0N RhyR6A7rA+Dt2YrBfdOzy09pH7bHrCLEmNx6An2NgAl/asoa3a8oi7TVnYdmT6rBrd2KRlLPqlh J X-Received: by 2002:a05:6a00:928e:b0:6ea:b7b1:ef26 with SMTP id jw14-20020a056a00928e00b006eab7b1ef26mr1131842pfb.26.1712312718530; Fri, 05 Apr 2024 03:25:18 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id h10-20020a63f90a000000b005e438fe702dsm1104304pgi.65.2024.04.05.03.25.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 03:25:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 13/32] plugins: Use DisasContextBase for qemu_plugin_insn_haddr Date: Fri, 5 Apr 2024 00:24:40 -1000 Message-Id: <20240405102459.462551-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240405102459.462551-1-richard.henderson@linaro.org> References: <20240405102459.462551-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x431.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 --- 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 Fri Apr 5 10:24:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786219 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp92946wrw; Fri, 5 Apr 2024 03:26:52 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV0nYNkiJZ6fSSEbtWMaIr1IryeV9HmMPQm8GBH0eOZ5JEmC1PssYZscugAmlZRH0IwJQu3+EmYwtsfwe5dVuCe X-Google-Smtp-Source: AGHT+IH0hF+LUsTJuOT6CG8vK9AycWfVI5aL2qMjm2OlhPNVIH78guVcls6iUU6HRh/TVhUGDsn4 X-Received: by 2002:a0d:df4e:0:b0:615:119c:b590 with SMTP id i75-20020a0ddf4e000000b00615119cb590mr761787ywe.1.1712312812205; Fri, 05 Apr 2024 03:26:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712312812; cv=none; d=google.com; s=arc-20160816; b=crkU0I3h8GRwnWxYJjzOn8GcgkrUiOqwNob8sCQTKtBl128H4sWxdIh1xngyd6Cykb yKSSLUY7NoTXHzeUY9rtR1gBs5c2GIo2+JSOg6THI9ICxVD+tmex1V/97iWLgTrJ2Q14 vlOlxI8WoB5TFB4RCPKEDYxxHY7tNTjy3cK2/ifTo7FuLuQo++4p5KKWwFYQru/QQX8T tdj6sHGQ2gKscmeOXjnr3UnBfaVtWGVbiDdhuoGImzhLA2UIGtKYYFdPNhxjgDtZQ7rY KY945pWbvUocf0FZQVNsocRCNgXkCti51443bs2fftreX72eOEdRUEKqQg5BXo4UjEuD T+qA== 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=bO7B6oUNG3jW/PSuoPnzK0oY+ojFYCsg6W4mPRZ3c4k=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=n3llkB/W3xA3TQp0VlionBKS4zSeOuWxioA54qFDzqbjEhZqOxd9dsXQb9jX4Xvggz 0T7JjG2ClZnGTHlhBIz8JRvlrNFo+YG6jjffMQmVgpMbwY1GwD+QcbHTCzt5K7BIu5R+ gFBEO48JKjz/fTChoYFSy5yH20g+xAwp0yhE3ketbnBxYjtcG0uDBhzK+g+NkSHeIr// VGA/1wKGRehnA5awmbK4TSZZA5X7I44jhmW12CSWMb9kuDUks6aH/enQ8ljkL/PWCPWF zYhXhCkAK25yNq1emyQKac+7Bc0KbQyJlLpk4H+mVFhFjR+kjhGKvxDwA/q0ARkEP7eL cvGw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Q7V1F0+J; 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 s4-20020ac85cc4000000b0043461799ea7si663149qta.742.2024.04.05.03.26.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Apr 2024 03:26: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=Q7V1F0+J; 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 1rsglB-000608-Qk; Fri, 05 Apr 2024 06:25:25 -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 1rsgl9-0005zc-B9 for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:23 -0400 Received: from mail-oa1-x2d.google.com ([2001:4860:4864:20::2d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rsgl7-0004k8-4r for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:22 -0400 Received: by mail-oa1-x2d.google.com with SMTP id 586e51a60fabf-22edec341c2so90064fac.0 for ; Fri, 05 Apr 2024 03:25:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712312720; x=1712917520; 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=bO7B6oUNG3jW/PSuoPnzK0oY+ojFYCsg6W4mPRZ3c4k=; b=Q7V1F0+JGJD+pR/8/qfqzKpVF1C9sZmbWp6eMtJ+Y9buIo7/vL3XbNvWSm9Jb3Ic2w O2mteVmNKfLfb5FYDUj8H8kuy4zCRiTzgDy6dViYeRYgdz6ZC4jjlVm3OBPNobJOIhWN d85yyVazuIcvqCwDDbGW3xTILhiuhrUS5HP3C9tKN0IhOiLussUdqMCf5hqj42IEFRS+ XGPPf1lpN6L3l/hLmP+5lpZ/JXHHp/FmXlPvAqZ4zPq5Nh4f6sWlRhTvnqulZgsQICx/ t7Q+pEStV5TlFt7HQ9H5ji/UUu4+rYQKTTg/elz8ey5wsI7DGz/O472b327mj/Ipo8a3 4x7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712312720; x=1712917520; 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=bO7B6oUNG3jW/PSuoPnzK0oY+ojFYCsg6W4mPRZ3c4k=; b=FJs7VYQ67PHA3hF4eg9BLThoDkjbZeVMVFTRkGF8ZNCWkZeXXdXXq4Zl7Emh/VjLtl st+NYOWCo1VKSoz71AiZunjQF2+GfT4SueHHilBtsC7XTJcQqQ5WbojZ5SbnS+dFKuji dl7zmN9Yep28o8O1V+txyqu407XJq/7oI9tH0J9kajvwjfG+I3h1dR/uhSZUpyeHkI6x XYUCTZnA8d4NXA61+B0aeOUTQYwHZZu8OoshOkPIOPe1d2sOYA/El8x/YcdtnbI55jhl liMDzEkNAWJikAB3TFQ3g7wJExS6F2Dz/hmLJrH4ZtyM2Cnr2USqNQfUIzP7gDP4/X08 vJTg== X-Gm-Message-State: AOJu0Yzy3Wt5WFp3m/Ewe5ZTN0ZZzsSx6ATS9vkyZ2IIZ3EzYAjvA/98 9ZiWa13kgOqMWqNsptoy2TlUZ7XEqd6qpJnEWny5K+iF8bzP0VSXF3TifhC+KvM6ZYJBbij1swN u X-Received: by 2002:a05:6870:4d0a:b0:22e:a0f7:8c36 with SMTP id pn10-20020a0568704d0a00b0022ea0f78c36mr976278oab.16.1712312719818; Fri, 05 Apr 2024 03:25:19 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id h10-20020a63f90a000000b005e438fe702dsm1104304pgi.65.2024.04.05.03.25.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 03:25:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 14/32] plugins: Use DisasContextBase for qemu_plugin_tb_vaddr Date: Fri, 5 Apr 2024 00:24:41 -1000 Message-Id: <20240405102459.462551-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240405102459.462551-1-richard.henderson@linaro.org> References: <20240405102459.462551-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::2d; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x2d.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. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- 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 Fri Apr 5 10:24:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786233 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp93699wrw; Fri, 5 Apr 2024 03:29:20 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXfpRwXJT/s0CF/cqIx20BjvYlKOiZVCaNryTf9DMkfwsCsNMQ7tKZKzpXCW7jRV37CsTFOHvmyZV152Maj4wz4 X-Google-Smtp-Source: AGHT+IFEMD9OQcWhFntYSNbJhkxeQioSAeyyCm5dlWjzn6/7upmYpzAA3nbIf8iM7DulTd+uY46I X-Received: by 2002:a05:622a:4b0b:b0:432:e7ad:bfc4 with SMTP id et11-20020a05622a4b0b00b00432e7adbfc4mr3062014qtb.13.1712312960391; Fri, 05 Apr 2024 03:29:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712312960; cv=none; d=google.com; s=arc-20160816; b=qjbRJ4CYA9N/jfP7G7+YnclG7gIAnmFhjCzeiz/DGC0n2CZsxsd35TmDfLR2tCXPt6 7wQ67OP4lbDhR5hpVsUAaL8tZAIZ68QYMKUCGZ/ENZUeS9bjHUZGiifKbGh9tfiPV1+V BEqk8Qj+zwlmU6spr/nuAWNOlgn+BR8HaZv+tQ1PCy/oMsQ8xoj/Rjx7OmprLQ05GsPy vzbZYDnTRimAIthvcn5wfvyo5JEY3PZyKyXS33sNJWyMwYQsk2gYCcCLBYMjSs4I/xS6 AjIaD70ZbqL8tHG7OJkMsxMCX1nK1StqVFQbtZv8pj6ISVTC8zNrIaz/SuAUvQvx79I1 GL7w== 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=HkzAdgjoTj648uD7uEcrHuxtjb/uqI5YzQMN+PJgrf3GbMKoZIfdZGida7OxuO3oi5 tTFXqQ4GAS23Ew443/qA/0pRv8tv4AfK5BKxSBlHviFYqqJ7lJySS5Z480tn7xFsfcer BTPxzTaveIzyQYPzhws7poijlAlamytLBwBrS4dyN2ojIo5qltU1MEoDmIxIcV75nTWF P8WfW4hwsZgVQQZbeCnFQ2dIkUTOrVXxTu15zF95YEzo975gGXo3HKz/RDtm8Pxpeabn nblIx51Pj2qmt1VpM+yP4CluK6yL6G/K2j/t245s9mVnH4nnASWbOnPUgnICOCdQ0SMu wXTQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Mz4R7dWh; 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 p2-20020a05622a00c200b004315f07d619si1453255qtw.393.2024.04.05.03.29.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Apr 2024 03:29:20 -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=Mz4R7dWh; 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 1rsglC-00060A-4m; Fri, 05 Apr 2024 06:25:26 -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 1rsglA-0005zo-IP for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:24 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rsgl8-0004kf-7N for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:24 -0400 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-6e6b22af648so2323932b3a.0 for ; Fri, 05 Apr 2024 03:25:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712312721; x=1712917521; 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=Mz4R7dWh6vnP+F3zkl0Ub75STRTodaSho6kQ2OIAdIMA+KrSgaADONEt+k/MXhaKGl hXYH8CCJDAHCVo9TnCSZU1mn+Jpim4v5bJtoz+Rh22qBq+KPuKY2huQUrz5SbcdHoZYy iVErrJOx7LGd58Bc/eDbbKLtUnbiRDPvaP/XlGy7BJCozc6fgWjGSKhpqlm4dm805Bnf 6t4RcjxfkzAjnsLfVS1SjL9mMKP/Ik9u7iMhdAPkDQPjWDQUGHLh+b1SFan1ljqPGoC+ 0VlWkyBQmwMaknqZPXJlm70fQhSfTKAUCt5p3xVtvr6HPEMB296ROI25CWYKEdWcK+DO u/dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712312721; x=1712917521; 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=Jlg+jO93FfPS5LpOzRgJcfWNPSjuNRqqtCCEiB/mfnnTtqfUPX0REPI66DTMh/Xx+l OIeAfG3PAX5g8Olhh6ay5LUUVxl8vHuofHPt7rjIwz9xlce5xjrUJByXuC8Opa9A/5T/ pHe1a/RAeZ/nimcnuFWekjna8oTsLvzTFjkfYJ1hclJmWqYt1t36I/JIcvbgqLH811Ft YLrwAxajnmH07juPC1tSonkYMJM7s4+fqFZMNd3rU2MIaILRxVva3PWPhQL0ZzYriO2o ROQwfrcfUNYJBDKGZ+XTLJF1RYPzTZ6rczMuF3QOyE+RXQxfirCv/jgAFc+/c0+Q5y4e VD0Q== X-Gm-Message-State: AOJu0Yw87VEnH+ScSBWmehK6tdN7liPcDyk7VI0RqojsNjlVQQSuiDTt MSWeEOenlLBdXtlTjw/aGnKXt5I0eAIcRwkUEEPU6Olplyl9IX0DPl6RCS68i9vSLmU4Rfg7WsK w X-Received: by 2002:a05:6a21:9994:b0:1a7:398d:6709 with SMTP id ve20-20020a056a21999400b001a7398d6709mr2745855pzb.21.1712312720905; Fri, 05 Apr 2024 03:25:20 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id h10-20020a63f90a000000b005e438fe702dsm1104304pgi.65.2024.04.05.03.25.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 03:25:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 15/32] plugins: Merge alloc_tcg_plugin_context into plugin_gen_tb_start Date: Fri, 5 Apr 2024 00:24:42 -1000 Message-Id: <20240405102459.462551-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240405102459.462551-1-richard.henderson@linaro.org> References: <20240405102459.462551-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x433.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 --- 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 Fri Apr 5 10:24:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786218 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp92942wrw; Fri, 5 Apr 2024 03:26:50 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWdd7o/Ft/zRLpMg8zvyRxErwOsmI9hAEYw/abQ0KjWw3OhplQqUNpe6uMeYcMXEBDu2DAvq5HQdAxWWftuqw5k X-Google-Smtp-Source: AGHT+IGmEtmQVkzhOZNUpqgpGdfLiJZfLUDqWYRKEOvgLCGf6W8u8T44I8VAFVGGpmj3Z6fRIoqe X-Received: by 2002:a05:6102:cc8:b0:479:dc72:94ea with SMTP id g8-20020a0561020cc800b00479dc7294eamr1141320vst.8.1712312810662; Fri, 05 Apr 2024 03:26:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712312810; cv=none; d=google.com; s=arc-20160816; b=bfcd6yLOWRoq/zBSizsef7HKbv2CGfJ0GIEER9HABL53j6s6jKS+7O+SS4uU3OmXuH brivqAIKdZCC80Enzv7qMpWmYyXFPDWXAtGnMJoszWP+hAXOMx3K7H55orI/AbGHFi3d K3sKqUuy5JA2HbY4rXQt8qkkDYRjc+fmoPOXxPFpGka8lpbVqYkRRGyIFak8hHHj3FmN UyZfzPMITPsjcozfbxySsjNez/5EkBncYsJkwiySuima0hObBs5Til6lK/Y3ggo9c/53 vS4NgTzVtFh5RNXFrrADXhdHDLWl/QmhegObAiaaiShb5i9bcJKkj2eUoH/6sw7TGrQA m+Ng== 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=xNyC/7w5lA4PawgdSfIi4uhxiZqg6pbt9Zx3p79WqLc=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=c01boHqj3w6x1BE/ufXwG5H8ylfbpeua3w2drjVFW64Px+UOmNlAkAMtkN3aFwb1e4 mFAYWpirr8VmlYPgtrgkusePw2+RlYpMsrOWAbXE13by6At5uWVbYIjJdXp846gEfkRM 6CWakPs+psMAMLaRGsGWu4WkSGqnILC3GHg1JpIASeYPqWNOGk7mLb/wEVm4Y2b8qxze +wp141oxtbJ5U8rA+aqJgkM+X8MHRFPO02sYybrl/xKjeKs8StxXWgWQLEvHza+eM4dL gDWSiAENRufnwA7/RrSYQAQR1xY0pvyZDdylThQVqsUygFH21rc4WZ8sqt3m1in2j82I yrvA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XxfhnjyM; 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 mu4-20020a056214328400b00699421157ccsi671241qvb.115.2024.04.05.03.26.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Apr 2024 03:26: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=XxfhnjyM; 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 1rsglJ-00065J-Mq; Fri, 05 Apr 2024 06:25:33 -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 1rsglD-00060t-5B for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:27 -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 1rsgl9-0004l2-Rw for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:26 -0400 Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-53fa455cd94so1667565a12.2 for ; Fri, 05 Apr 2024 03:25:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712312722; x=1712917522; 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=xNyC/7w5lA4PawgdSfIi4uhxiZqg6pbt9Zx3p79WqLc=; b=XxfhnjyMDKXSk5QWzWuyPdmEdqGtLv0FpIRnBwjXp8AJtij6Bn8iKSIxHmdyJUAmCw /hUUoSy4rt6uvnsn+Y62qCjaZZZhIsP2RvUFrK988bvhSK8DSwK4aMO1a2yje/3FtONc m3HcJucXvklkjNEA/Dfyl9UtgnJ9IbNK+yVMQ26glFni8KobK9x7QxFga0YVMXErS2yf sZAiKbO+BtNCU1FPs/eZOccBas6W2aDr0gaO50R58MFll//WGwIVIy6n3JlK7pB5OsKu YjbZ97SM4aadOcbbf32znZurlxrhw45OfJ9XCGyJkSaC3sO68X8bcGz6o3HT4jvZ9Hjz 0QVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712312722; x=1712917522; 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=xNyC/7w5lA4PawgdSfIi4uhxiZqg6pbt9Zx3p79WqLc=; b=WlYgnVSg6bMOJqj6jOmUdGA+v00+EnOZKwcXC9KBexEnNLgARqLKD6UtgOmmPX9Tx2 KsgW5MRIDvHikYcvN8bKhmVQnvW8f+/hlFuhs6IaWKBVB8EXZQLzNynOB96SbdXrGmg6 SPLA0uSDEjpaszBVfISk1uBfDtlruMs03CIco59kTiGAgOEXmCLWt9qbRl13jq75KB/D amw97ZxdLKZKC0K8VfZXsvt3QOunykn6/uJCXI1ertuCCdPiRCE5teC53TTW680bvmAy krWcovspPw1sfQcvQiEk6h8TPE/EMEn6TJwCa4/JKtF3hIayc4+UPf8IHPd3Zq0egCZZ P9WQ== X-Gm-Message-State: AOJu0YwIzoV7mEfnkgIQuvJXINc7Tq5/zBSdXH60eLmvCzQ/0+nkS569 9r7ewjwMKG8CVN74t4MxVsKn5U10rNJuQ/JJOxDKDDyCvunWJ8iCda2HIht544U61nk1Raa89lo R X-Received: by 2002:a05:6a20:3951:b0:1a7:3b7c:3126 with SMTP id r17-20020a056a20395100b001a73b7c3126mr1089795pzg.5.1712312722230; Fri, 05 Apr 2024 03:25:22 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id h10-20020a63f90a000000b005e438fe702dsm1104304pgi.65.2024.04.05.03.25.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 03:25:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 16/32] accel/tcg: Provide default implementation of disas_log Date: Fri, 5 Apr 2024 00:24:43 -1000 Message-Id: <20240405102459.462551-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240405102459.462551-1-richard.henderson@linaro.org> References: <20240405102459.462551-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 Almost all of the disas_log implementations are identical. Unify them within translator_loop. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- 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/nios2/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 --------- 22 files changed, 12 insertions(+), 200 deletions(-) diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 46483414d2..2a69916b9a 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) { @@ -222,7 +223,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 340265beb0..1b627c9660 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 69585e6003..c8e1827b07 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 8a1a8bc3aa..7470795578 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 07f642dc9e..796180f085 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" @@ -7069,22 +7068,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 6ae3df43bc..8af3e6bac0 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 916afd4dec..be3ff76f78 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" @@ -1775,20 +1774,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/nios2/translate.c b/target/nios2/translate.c index 9c3958a0ba..07a9f83c6a 100644 --- a/target/nios2/translate.c +++ b/target/nios2/translate.c @@ -25,7 +25,6 @@ #include "cpu.h" #include "tcg/tcg-op.h" #include "exec/exec-all.h" -#include "disas/disas.h" #include "exec/helper-proto.h" #include "exec/helper-gen.h" #include "exec/log.h" @@ -1019,20 +1018,12 @@ static void nios2_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) } } -static void nios2_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 nios2_tr_ops = { .init_disas_context = nios2_tr_init_disas_context, .tb_start = nios2_tr_tb_start, .insn_start = nios2_tr_insn_start, .translate_insn = nios2_tr_translate_insn, .tb_stop = nios2_tr_tb_stop, - .disas_log = nios2_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 9d57089fcc..9fd1ac1d60 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" @@ -1271,29 +1270,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 a9b1bc7524..b062d1b1d6 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" @@ -2298,20 +2297,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 319934d9bd..b128cc366f 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" @@ -4998,20 +4997,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 Fri Apr 5 10:24:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786221 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp93000wrw; Fri, 5 Apr 2024 03:27:03 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVzVUJ9x29puaxX3c1wlOQGXyl17P49MhMNJB9ExrVLTDos4387UClPcKEM+qwP0Q7QCZ2iJbZFF561An7+z3ag X-Google-Smtp-Source: AGHT+IHx7ZEizTs6cpL5XxOtQUP9l9z4pNC1L/lY3oNPthg30pqEP9guAZ0t4OznSMIe7H3gMjad X-Received: by 2002:a05:620a:f8c:b0:789:da81:8f2f with SMTP id b12-20020a05620a0f8c00b00789da818f2fmr807265qkn.26.1712312822812; Fri, 05 Apr 2024 03:27:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712312822; cv=none; d=google.com; s=arc-20160816; b=SBeA5kY9u25Uf0kv7cKBAhk2O/bGOOHWeP9qTA4QzXYWSFLurKv4LNEmF+6/cp7+qE kCuIdacxi9WfOCAW31Jw6bHZuNP2YOlZ1+Dma63XS74nMUfWigKY3DyiNKM8GXXv12Oz KaQnAoN+3feDZLqpzmb/FeLLWxKKWT409BUL6V31t0JG45IoRqjjMgXPuLg+ywBdRfYJ 0soDcdR3zwboV4Ck0jHmQvCAJEvOuTha4bqJ6gNK/+er5EXHtUCtIO7Q4uvQcfSHei+G 9Mbzke61kxl8ixLbPzFQSuERUVhBejrWqJt7eeVZ3Clt/VcOWHZ0EamzzKEj4YL5IyGp wKzg== 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=rExV436qASDL7Fg2YdiVxvwbh1gcXXC/kcp8pAfAu2E=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=M0p/ykBn+n6kzSz1GVhCzGt/aIbyePsFyC2XyfbmYvmR+JmZnwTEGw0rXUKo6fmEHl huKmELjIfb6498r3bXfipAn2NnAg05NpWnCgFI3fYfChw65CR4gIcdOBabHXutO5y8hY 5SbFI5hsncxhRycOSI76QAVJhfn9q52kfv6WglLHy6fcN7ayDNHZrFH3tFdnq6QS2u6b o7t88e6wQ/dcx4YfrFqtwiwqIV+3ZC8/pMrQp/edaFXq3U+1QRGn9mTQ5hs0qUK/8dnU aHoDzlLu8+evtz606RWT5ByegJxr0eDi7M2E/ZTQYWFUGl3OWc21/vYz01FEOiezifnR mo3w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kOFE5F0P; 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 y11-20020a37e30b000000b007882e4d4076si1420914qki.578.2024.04.05.03.27.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Apr 2024 03:27:02 -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=kOFE5F0P; 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 1rsglJ-00065K-UI; Fri, 05 Apr 2024 06:25:33 -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 1rsglC-00060C-Cn for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:26 -0400 Received: from mail-ot1-x32f.google.com ([2607:f8b0:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rsglA-0004m2-N6 for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:26 -0400 Received: by mail-ot1-x32f.google.com with SMTP id 46e09a7af769-6e69a9c0eaeso1285945a34.3 for ; Fri, 05 Apr 2024 03:25:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712312723; x=1712917523; 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=rExV436qASDL7Fg2YdiVxvwbh1gcXXC/kcp8pAfAu2E=; b=kOFE5F0PSHQdUmtDU4G6G7OmSGJgcR1a5YoFavYVBu0u2/JOyYahOyAZQJATAqyEHM NYfMcKyC4OCW7ZYoy3DSHWIUMqK0nJNKSQQSmt6baqXk39wcG8sYbeiy+A3cCcHc3Mbu zcjX573L56CWVRvh2FfgOc8g2RJ4SrcquSxllIUWn8pljeADvDmM3YNHaRxT9FxJoXjb ForoKA1+v/phTHhMQ6/9bJd7XrAc+hMXQUAx3iw9gHj1lf8LWjzPJC+w/lpZS7MDyHB9 QYU+qEEDDOn4+TxHEysAVq8V8qev2aKGYn9vI18tater+oBjDzyx6r5d1wBTeSLlJK87 bb0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712312723; x=1712917523; 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=rExV436qASDL7Fg2YdiVxvwbh1gcXXC/kcp8pAfAu2E=; b=P5AqyztKByzMVSgYQOC0zv/9kij/L0CsV4DLbgN/IliOK9BNxUdSTZRR3yZ0W1Xh7C 4rgXFb3Hj4U1giGSHDz8fjVTb+pzBXDx2nDPf8Gt5em8YxyBeNFsFsgEpujc95/up1nq E1/uLfPzI3EvxIsdSGeO/65r/jq67tLtenJp+Ew3MGbjRIgypzNo/URpoeAUWooRuVJl IYtS4QonfT0WLx6RUy2w2/UpqCr4p+Ttux+w2Zv+RRhAzMg7eroFtWthsnN70betpf5a tO6LPXV+CdABRfphsL/dTBGQ8pP7iKmAzTZwshGj9xCCBH116DRHtxfToYmKUKLjaMoF vvNA== X-Gm-Message-State: AOJu0YzZF3uB64cG3D5+qXln9+M+kAghzvyyORFcTLxxFSCpdMG2p1XS nxZsDfn0S02rOAzrbEpZyR+qiC4AtgKZ3yw9XR9BOihdM43jfk2QTjeCcCWFiX2ogBWqNQuor9a r X-Received: by 2002:a05:6870:f286:b0:22a:a40c:4bf2 with SMTP id u6-20020a056870f28600b0022aa40c4bf2mr1137462oap.14.1712312723440; Fri, 05 Apr 2024 03:25:23 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id h10-20020a63f90a000000b005e438fe702dsm1104304pgi.65.2024.04.05.03.25.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 03:25:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 17/32] accel/tcg: Return bool from TranslatorOps.disas_log Date: Fri, 5 Apr 2024 00:24:44 -1000 Message-Id: <20240405102459.462551-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240405102459.462551-1-richard.henderson@linaro.org> References: <20240405102459.462551-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32f; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32f.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. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- 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 97cdb7439e..6ebe69d25c 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -134,7 +134,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 2a69916b9a..712e0d5c7e 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -224,9 +224,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 7470795578..b1d3d6d415 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 8282936559..d8c1ad042d 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" @@ -6522,7 +6521,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); @@ -6530,10 +6529,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 Fri Apr 5 10:24:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786225 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp93181wrw; Fri, 5 Apr 2024 03:27:41 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUdKQMtFhi+ZcSLaFi4HFkYe5LhF5S5xi2/Z4Ex9/AJ8nbGVJbUR9zKs64H69FpHgc3dnfVaX/iRhoJivedcu3F X-Google-Smtp-Source: AGHT+IEx1BJh62sSFFGmZ0s34z8XEqZQD4CKAKmccNZd9NwkQLSTgJze9qVLnT9OCBGqFf6nW/qk X-Received: by 2002:a05:6808:212a:b0:3c4:eeca:6c5 with SMTP id r42-20020a056808212a00b003c4eeca06c5mr1079565oiw.53.1712312861167; Fri, 05 Apr 2024 03:27:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712312861; cv=none; d=google.com; s=arc-20160816; b=0b6I9KGCGW8Q4421AKah6vOpiV5zdOF1AccLEbnZ7l52hPKWn3aV9E7DV5RlSOjBhv zBa4srSNoXoXHr0/A5orsIwU23/FO4J65CUsgFr/xyUFnLJaL+haYiPyU6urgF4r1Ths Dus1m34EhRcF/fQsQiehGeYGl2M1v40ihDMFLnhBGAxlDPfwNdQeGf1hxUcDjY3m+DZS VrH2lNKAajcrrAOWzEc+IHdt7PaxgB2x56tQ730s/tjM235A92wp0nXEbU5HLP3DilJ3 m1tYgQE6l/L48uxUHWNqwJPOOJBmbrKvGUMJsgLWwpB4GllodPc1hAskBiLSHnr58EMj QniA== 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=inJ/uYIDPkENBCkuYIXKH9p42SH8b6qc8WbJMLdldEk=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=CDvQte6FuTPmP2ZW2rQH2/dMk/0k8jLaUUdyDh67scyFx7oeHDlGASTezCHrO0A6ks m0HZDox36BAIC8l4mFZS7n+Pmh6jmnMmfX85N+s/ygb1sWG/MerP2kYWJZeLmNQ0Uv4B 1XEhrAGvK8QrxjUJHWS88Crp7CzLbjP69dVOnrh63AVgDbV90QZIawAnYrk+al4ghBO6 gEfk3RbY5sknQEher83gvursy53t7DgxJzmhh1w0OKrQMS1re+AWd1eV3eQCYQBOcDfM e4pZQcaNLXZc45yGkkkX14WBlG3LwopcNCAMLEJiDDPJyZ6rruhXMoAvt8FT0OkvfpBx 753Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aICu6pSX; 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 xx9-20020a05620a5d8900b00788625b47c4si1424866qkn.765.2024.04.05.03.27.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Apr 2024 03:27: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=aICu6pSX; 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 1rsglL-00066W-HB; Fri, 05 Apr 2024 06:25:35 -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 1rsglI-00064u-Rd for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:32 -0400 Received: from mail-oo1-xc33.google.com ([2607:f8b0:4864:20::c33]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rsglC-0004mF-He for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:32 -0400 Received: by mail-oo1-xc33.google.com with SMTP id 006d021491bc7-5a496fde460so1104549eaf.1 for ; Fri, 05 Apr 2024 03:25:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712312725; x=1712917525; 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=inJ/uYIDPkENBCkuYIXKH9p42SH8b6qc8WbJMLdldEk=; b=aICu6pSXpUOasprVWpiwJjb1iym4kzHWgsltUN1Nv26q66H00/ifLvP7V1NHsGCM6a h8pHGZ4/pmGgkueb2chgKioJC4qukPxmqGCBKda7xNk3xoYxTroZZAyS3Oe1BPgbbR67 3a8w6zc7xvyB7My9k8e9NwlIk420tNs6FpgTDKWEr7xHg9DhGJsQ2ao907iYuKlN3miE 3+iM2axdolDv2xNFqI0GsXEzGKzE2tbrUKahIKlmAXn/IE0RP0TnAyBEvKJWU07n13pV /zST4wPUR7eUyffuBI/20k3mG8ynBQXbYEw3PQhk3yqo46jOtkqbGTv6NjGXDS7cgHpH 1odQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712312725; x=1712917525; 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=inJ/uYIDPkENBCkuYIXKH9p42SH8b6qc8WbJMLdldEk=; b=xASEWMZvxjVzSkRbF9aBTpbqpncOwf08GBBIl3RRCZVP6gUCyLtyGhoIG04c9kKMDz VXgPFnuxLoFQy7tOaJGmtu7NKhgpX6GOl61zfFX9/BZTGw/K8HdK7J3dBuaTG89m7nHv MqrpWbNRX3BPkE5dSu/G6Evz3+fUiqaBLkynNHeiz5bdRsz/+JpgsDzHbdahSEiq7Gmm EW/ZUHInguiHy99tq2TLGSKExBzyZn5TU74uDX660DqxQ+41kMGsgwGVzMB3A1iMnksL wj6HLQJS4nbkf/q8j6fSFegduOvN7q0zUEnw7fK1XwDLAHvpKWdVeTOIzMIR/ps6eZ1N UT1w== X-Gm-Message-State: AOJu0Yxduv+AM9ypZrJCGEK2uUrSLwBmA+KBDVtLRq6yCei9hw4LQNJ7 aPjjeM64Eyy3f9QEz3LpdCJjKSMduq7gfagC/hSouKiL0618Pd5AZ7UAPxRyCTfbe5+iBqSn3vl Y X-Received: by 2002:a05:6358:793:b0:184:fdc:2594 with SMTP id n19-20020a056358079300b001840fdc2594mr1272192rwj.12.1712312724927; Fri, 05 Apr 2024 03:25:24 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id h10-20020a63f90a000000b005e438fe702dsm1104304pgi.65.2024.04.05.03.25.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 03:25:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 18/32] disas: Split disas.c Date: Fri, 5 Apr 2024 00:24:45 -1000 Message-Id: <20240405102459.462551-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240405102459.462551-1-richard.henderson@linaro.org> References: <20240405102459.462551-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c33; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc33.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, T_SPF_TEMPERROR=0.01 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 --- 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 815523ab85..3f710dd543 100644 --- a/disas/meson.build +++ b/disas/meson.build @@ -15,7 +15,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 Fri Apr 5 10:24:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786236 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp93837wrw; Fri, 5 Apr 2024 03:29:51 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWmssvsYE3C/zYJ6qVnMWhH000BUYQYRjK5NNyZrFFTo9fC28Ve3RUDiI46n+zNrXKb29cFzSV3ap32ZtfTGbtP X-Google-Smtp-Source: AGHT+IGLWz+MHrpgNRvohuZUbcnDOoz1SbVNX/0LabaYAj0jFzyBJnt9T/Hk3izReO3I40KpMdPm X-Received: by 2002:a05:620a:3953:b0:78b:de20:932a with SMTP id qs19-20020a05620a395300b0078bde20932amr1830434qkn.13.1712312991079; Fri, 05 Apr 2024 03:29:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712312991; cv=none; d=google.com; s=arc-20160816; b=ttLUVaDn9YekuSMkOy6PKMadM/H88XDMpN01IeMaQvkxBbhCxIUYqVthE1jhxBcI+Z cxKUYmeXGS+lYJemhq/moIvUeaJZbJhs/szXPNZRYt9IiNCzhvOvFCJ/0CWzbYKihRBU 6S1VT4WYxZ45c5uq/IUplgfcoaM7cyiq/W3GGLqJ3hnjHW2LCs4xWreChE4XR0wzkG8I 1BYJ1+v5VGWu85O6jozsyLfDer9G9yrVvAU9VTRMC1QzslNzPuINFPP6AlZnXneG6mKi i/PF3NBiSDt9kftZ6TbOTl9kva0OZLr/kVwQnlQs6wawCXLq7B+2bvrZ+UXxZDhm0YFT ymZA== 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=BSWmY5g0BLOjDo6Xjv7CB1e+gl5EQ0oR0a5drHt964Q=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=FNYpAwun62+zr6BRHIfNuph0kZpbq9jMDfezx1+X/Sm3jZsAIpl8kCKAdwSTxTBYO8 dun20/Y+msbxaEZAsmFRbXW7JvhMBdVHa4TbGZeb3Y3TmxKzrrePZv9Ho6u4Y0FaMXEr nTrBkdRlXV/hQVBQRcgEKC2ajASvPJXZSJMsS2iJGbGyqQ9cVE2XiWCxaTqAyDLAQkbZ uPZT67+N6EfNNcsjaIVDnOl/wxvb+dHzLAVSnaiyXpG2egTBmE+jaJyF0XCYhpIhJftR K+6ukmhpyFo8/MLybzP762nW66J/g6ths/yXz1/7Xg17nVsoSQ6Y66d5KmKU3K4YsClD MUYA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GifGIhqn; 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 j6-20020a05620a146600b00789d7cd3815si1400240qkl.471.2024.04.05.03.29.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Apr 2024 03:29:51 -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=GifGIhqn; 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 1rsglH-00064b-Qg; Fri, 05 Apr 2024 06:25:31 -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 1rsglF-00062o-Bv for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:29 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rsglD-0004mT-FK for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:29 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6ecf9898408so794574b3a.1 for ; Fri, 05 Apr 2024 03:25:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712312726; x=1712917526; 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=BSWmY5g0BLOjDo6Xjv7CB1e+gl5EQ0oR0a5drHt964Q=; b=GifGIhqnx9Nx8glcn0CrFMCXiKfr9hTJyJRtRzguVbq2/rtL3lO7WM/dCI3Tv/lMPH 3Hw0ehkvqUrTaqDf9lPz7T2IIoXIJaAR+ZtdtQqq02x6aD7H/x1jbHhTCGwOV4KeMzhP XfN6xI8vTkQUcZa/8yVN0XJU9vgII05hYB4mUkUjwYljeFATrq4Sww6oyHQhgPWiCYLB d026ySu3zLfD8n6CEm02xI5RrG2UPf7Vl+JreUDr5MVN+Myjsy6ZN9Kisp0WuZgmuMdv 2YlIcxO9oBO/z6/Mrxi8LnMj6Tb7H+ym4KtwPaAD5a07ViQ2yhwup9NyC8ffn/0t0HUo 6Yyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712312726; x=1712917526; 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=BSWmY5g0BLOjDo6Xjv7CB1e+gl5EQ0oR0a5drHt964Q=; b=s4vUM79Ng9hB6fYMT0ICa6G4+hw7O4aI2GdTKsyaxrNwUzntdb7+UtFXmqClLTCscK AweUC6ldoEZr5TEplBgD0IEdIggzoG39Up/VOS7R0luqZspgbIwzefc1tTEAZ8p9Z9hU B4aljDUrIr573vnGYuPc9b5VJwZxsjf5XkqYvIngbWQZsfmzGMZl6uALflHPwt2WU43S 5Q9MFgk3tj2W1IFGalAVR+K2am1AVoMjTzsPNoafMu0rBIHFQygYQcJzo3HAgftVVd/c tu/ast6oLtpEyqMHoboVZZS/lbi48CFCsyxm1aq/Upa8xCk4tIR8NuDeD4DutQ+KiXeQ 8+WQ== X-Gm-Message-State: AOJu0YywoKu0rt9N2f5MhXMtdlsDrDBgBXdnH34CpF2NnTA+hkxch9y1 ///u9OVAbz3MtE4rqD1+5mg36JN2NbblJmvhZ/3cmdC3Snd327yUsldeRAOoDkuQm3xWjbNJZNt t X-Received: by 2002:a05:6a20:7488:b0:1a5:69db:d92b with SMTP id p8-20020a056a20748800b001a569dbd92bmr2980850pzd.14.1712312726136; Fri, 05 Apr 2024 03:25:26 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id h10-20020a63f90a000000b005e438fe702dsm1104304pgi.65.2024.04.05.03.25.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 03:25:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 19/32] disas: Use translator_st to get disassembly data Date: Fri, 5 Apr 2024 00:24:46 -1000 Message-Id: <20240405102459.462551-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240405102459.462551-1-richard.henderson@linaro.org> References: <20240405102459.462551-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x436.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 --- 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 6ebe69d25c..777dee0ce2 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -78,7 +78,7 @@ typedef enum DisasJumpType { * * Architecture-agnostic disassembly context. */ -typedef struct DisasContextBase { +struct DisasContextBase { TranslationBlock *tb; vaddr pc_first; vaddr pc_next; @@ -102,7 +102,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 712e0d5c7e..4c1dc57890 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -227,7 +227,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 Fri Apr 5 10:24:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786231 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp93677wrw; Fri, 5 Apr 2024 03:29:17 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVK6r1fy1e2yogpOhX2K5HJNRGh3YYYInAd2ul8pJNHAAaQoBhhDvU4o5G8iqWeIEL0zU0QJkIF5OKEMJ/lT1fH X-Google-Smtp-Source: AGHT+IH8Wieazl6vIUv5hFFEXIqQpSb4jrleE0qY1tKfyiBx0jIKjmvc7whQYt6HtMx1ejA4xki+ X-Received: by 2002:a05:6214:2d0f:b0:699:4572:3836 with SMTP id mz15-20020a0562142d0f00b0069945723836mr157040qvb.2.1712312957149; Fri, 05 Apr 2024 03:29:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712312957; cv=none; d=google.com; s=arc-20160816; b=ODzHTc0gL9C7NnvOoBXMfk606OINDKV8+74zRgnpToFdoEZAhaYyKJUd6sHajfxbb7 U3hTy+P/uOnX9SSNSwsiFzRQi8mwegXOVMH5QqpR/Kucxc8sPKdnxDF5TqTB1ugclXZG MDg3KSaRIc3YIMxAeFPbBcn2+VmN97G1X8MG3Zwa9GOO2OiMbnEsTzqq1yrjViGqyC0m W97ifEn15fweLcHo0k0SoaOvHq3JeV3dj9eYYhUkSX47afsqMssrW+8lEYBIavVPM48n R0xlAlefXX14wA8GqGpRMj1MFMLMsiI8Yegv7OHLqrNmk+IAltfZaO4y/GA8BoqzTOl5 hQQQ== 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=a6JV8BkI+h/EIgitTojmjopF07wjZarQ8yr8avazSrs=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=wvcp5VRplYF5I8A0PhNSmKUg+WJGuEVDrKCXZCWJjX4CTxBkrLfZ8pEVKtebWTXtgF eoq49ifJIxXbOstg42ZF+AEMfRjDG/ywFvpYRbENWJyS0fMPCR4HgrBSQQTftuh+qwna Brymok/W6FNW88/kMV9NDEpjPfZ0aWcqT+HO6Pymp9XjHVEgbOGIEfSsGT449pqH8fDD /ohEM/H+AHVHh98pZak7N1NJJBW/yza41p65C99T45sBMHZDvktluj2uWvkOwY804xTc oTk69tR0y+Nchs95CqZn5S8FCPI+iZnAuyqyHgW1GBQGPEWVQeliPSBUnREV3w3hhwH6 DFtQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=g1+66IjN; 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 pr6-20020a056214140600b006993d828d7fsi1436549qvb.259.2024.04.05.03.29.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Apr 2024 03:29:17 -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=g1+66IjN; 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 1rsglI-00064y-Uf; Fri, 05 Apr 2024 06:25:32 -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 1rsglG-00064D-KY for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:30 -0400 Received: from mail-oo1-xc30.google.com ([2607:f8b0:4864:20::c30]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rsglE-0004mf-U1 for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:30 -0400 Received: by mail-oo1-xc30.google.com with SMTP id 006d021491bc7-5a51c063f99so1082841eaf.0 for ; Fri, 05 Apr 2024 03:25:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712312727; x=1712917527; 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=a6JV8BkI+h/EIgitTojmjopF07wjZarQ8yr8avazSrs=; b=g1+66IjN+oahK8dk/uHyOIRdETq2ZR617o8JxOLo9/rorsJwxEu2V7z6Vrg8q9vCjX Qx73O5YJDq+DTdH3mEYuQDcS6spkeuN/Re9iBOZJrDae2dSa7fBte1Idl2/ZO2EPTbCO rCvb+k6uiHAB9pr7Fsr0PjB3yuCb/mogaMgFXmHpLvMekmoaLtmEFWKEchW6UrQF0sbh Cfy66DnJCCeqD7hvosgD61PpA9Zni2ZIILyNTBDYpd/sDjQcOsiChmqPd0QG11DqtM5j rgE37Aw4d2aznDorzCa7VDY8c/aBv1AdV1cONT9Tc7XH5xufc+o0x1Bnd+te91GS5qca 29Pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712312727; x=1712917527; 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=a6JV8BkI+h/EIgitTojmjopF07wjZarQ8yr8avazSrs=; b=Dt8tklpjyvnHE29IrnXNcKhGLBlhfVrd+EGgkwn09Tg+t3Yn1s4eM9eIF+XHm2hksC VUxpWipg4uU0LHdMkf7y1Bof2SwdjvJzfJLjA/0HqFqqTQTdMg1Vj6bZaHw3p2akj2bg RltI/R38WmRETMeUdWTCd+G7KbkBTcr+BV4SyvEwzyYnJOkiLvSGxg7514tKbPzbZKMq uqRr5x93QTtpmJCId1ECQLSqIFnmI63hOJfo3O40Wh9dCku3O7v48YTtmc41eWtfiqv5 cqrGyz0KlJB1T1QPV4khwpol6A55gXulSY6t3w3m2W9mbGZgejLdpBUToh281Hj6Ost7 PG8g== X-Gm-Message-State: AOJu0YxqjVs7B2ihgeeqOTZNrhWe3hkykLsBxbcsjHpKzdS01a8Thp1o SU2aBdpB75Fq0Th9epfRZO97M1/42DBQc1d9nm2w90OMyMpOXx3KkzcpaipOo+NqyMDcIUDc51r 6 X-Received: by 2002:a05:6358:d383:b0:183:66a7:b23e with SMTP id mp3-20020a056358d38300b0018366a7b23emr1142438rwb.28.1712312727628; Fri, 05 Apr 2024 03:25:27 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id h10-20020a63f90a000000b005e438fe702dsm1104304pgi.65.2024.04.05.03.25.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 03:25:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 20/32] accel/tcg: Introduce translator_fake_ld Date: Fri, 5 Apr 2024 00:24:47 -1000 Message-Id: <20240405102459.462551-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240405102459.462551-1-richard.henderson@linaro.org> References: <20240405102459.462551-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c30; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc30.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. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- 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 777dee0ce2..79c2724e96 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -233,17 +233,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 4c1dc57890..e84d41b770 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -464,9 +464,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 d8c1ad042d..4d308860f3 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -6192,6 +6192,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)); @@ -6201,10 +6203,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 Fri Apr 5 10:24:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786223 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp93173wrw; Fri, 5 Apr 2024 03:27:39 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV1Gu0kno4J4OuhlXWXDF7BNAPkrapK3VFB5DjGu04wUbZE7835VbTLE4owOxq3WWRw3MQZuuOM0CPwfYDqngeW X-Google-Smtp-Source: AGHT+IFYx7jT1k9a3uBOEr234aDvJ6TX4Cm+ipjy5YwfocM9ipi4floc/41XHRTM7ykHYFycaEIb X-Received: by 2002:a81:6086:0:b0:615:31a9:83c4 with SMTP id u128-20020a816086000000b0061531a983c4mr889924ywb.6.1712312859298; Fri, 05 Apr 2024 03:27:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712312859; cv=none; d=google.com; s=arc-20160816; b=FStT+PdmGk9GrXqTq2Q5W8D8xpm0Iaj29Pu41IUSgFCmA8dj2Wjg2kN0EWVHELUAPT 0qFFdPfG70s5I12bjspDhtQJRCM5MzDfR6bNqOfMwfJ6TE1sOoXA5pmO1RIGm0YI1uJ4 cp93MWnrVE0jwBQ9cdPft12DCmebmQvOlK/CLDLmcBejamOadYvNOAfI6H2QeGg8tGx0 pzeWuZQkmvRH9IDh7SGEnFxbdtbiImuwX5CBsaHIdc9DxM76mPE9emvXyZVImrUJsrJT 4tSnT+2UcJtxhWOgAyjA+AE1gVUWxvcDPdaCPXlQnnVCxBtR3kOwLeP69lgDHiDT3Ryt jWfA== 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=9vJCsZ3aWtZ3vLFuGCUAHvoUuLKPBCuN/+TiCfXdCNQ=; fh=dBGltRZCelj4V8aBoG+OSD7H6rZxxBGgTNXT/erTiSU=; b=unas30XIycwS+H3jd2fZzDBWqdb/xugQA4Fhf1ABBKhzu3dZ2i2XPki2dvwB5Ic0b8 W2XoI/lyMPnutA1KYo1XC+fw9QiebpjtIwXdA+b1yZ18KceEl4u843a1IcYrmFHNNcpu 97UAiN+CrlVqM3zj3bMD3ZpAQV5hGtkqbPqyB8n71LkRl233KysKxpnga7wKrAlw4Jt3 pQ/XFELbKBAz9itkdoQ6iJSD6E14Crg/JAxgjmLYZT3V6oyj2yQBPPSeizoDW8qN0Ch2 fWddfkP7ieMYY3/K0g1luXuJnEHp1u/8+NBhS/uB1VnYQfnrgXwIPQ+fLNahjZ12bTY6 jWBw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QjLPCtns; 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 l17-20020a05622a051100b0043182e66e78si1458984qtx.756.2024.04.05.03.27.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Apr 2024 03:27: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=QjLPCtns; 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 1rsglN-000681-Ja; Fri, 05 Apr 2024 06:25:37 -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 1rsglI-00064o-JK for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:32 -0400 Received: from mail-oi1-x22c.google.com ([2607:f8b0:4864:20::22c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rsglG-0004mz-3j for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:31 -0400 Received: by mail-oi1-x22c.google.com with SMTP id 5614622812f47-3c3aeef1385so1372912b6e.3 for ; Fri, 05 Apr 2024 03:25:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712312729; x=1712917529; 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=9vJCsZ3aWtZ3vLFuGCUAHvoUuLKPBCuN/+TiCfXdCNQ=; b=QjLPCtnsSeTeJ/kKLuo63zDl9UBsZC57YDJOauvH++E7kQPzUn+lXLIFiuNju+VSwl FXbnwr/fD8/enc/iZV583+E+kRFdz3RNJDTiQAIG/UbuSg6r8WV1dqVM7Xoly7TRQwfo ZuUH+JPpQhKtOQ0ssXR4jVydlmM7mJDlHL21MJODaWXXXVJpvbeAMxYfrJYPJFzYyb+i 5aUnn4mFmqPZNvpA0rgt1YiN9CkZF64xU/hUh/m+p4mobhU9O6ncq5nZ7QgldXrEvWzt OsfpssANh/0o7zABgYKjHA2yW0DQAbhdBC8yxbl43o7aHNOJ9NxoGJIoud2U/P7NBOtu PLRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712312729; x=1712917529; 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=9vJCsZ3aWtZ3vLFuGCUAHvoUuLKPBCuN/+TiCfXdCNQ=; b=B2VX6WUqOqWvxA2UforLLnKo0kmrz76Jr9GOW1pF21/EOr5TcnwHfiecEqDM3kB3c3 rq5QFOgjOdAVTiCp+t4zqybXLx6HZC8HjtkuND8oQCqziWrZhtHemyPEy8frwdO/55TU YlbzerX82AZIxrDKM9f5daYN6bOJsCW1TtoSIHFy+7rVYSCIHxbMCHVRk9Z6NoVIV2gA zxcb9P4N++i0XgiMRn6zzEQyqYLZz+4uhL9+KjfW3fEOXxNpbVB3M8WdsaZ4zf+dvyot FLTUTfXCoo3qEW74aJ5T6sSCm9gvCatcnTIYyQGhTYOGIhU/d2nVmxKIEUqjl23HHjoJ DogQ== X-Gm-Message-State: AOJu0YzcVUd5O9l5fiEmGdN9vm1tTKjPlmLWoKssn01bQHMCkj8Q3i8u SNIWgdDN5psQqrvtIj3Oh8D1TIE0ohjzU3ZjMZxvukjU7QZ2KWt9IKrcFRJqRQYrfCB+GoH9B0l M X-Received: by 2002:a05:6358:9805:b0:17e:d8fe:be45 with SMTP id y5-20020a056358980500b0017ed8febe45mr1016780rwa.8.1712312728940; Fri, 05 Apr 2024 03:25:28 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id h10-20020a63f90a000000b005e438fe702dsm1104304pgi.65.2024.04.05.03.25.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 03:25:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org Subject: [PATCH 21/32] target/s390x: Fix translator_fake_ld length Date: Fri, 5 Apr 2024 00:24:48 -1000 Message-Id: <20240405102459.462551-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240405102459.462551-1-richard.henderson@linaro.org> References: <20240405102459.462551-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::22c; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x22c.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. Cc: qemu-s390x@nongnu.org Signed-off-by: Richard Henderson --- 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 4d308860f3..c1614b8264 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -6201,11 +6201,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 Fri Apr 5 10:24:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786234 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp93797wrw; Fri, 5 Apr 2024 03:29:44 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWxalisS3Ak6DvLtQq1CqKP/d3QtQjOgh/BeclSRLQ9YxPQUWCSkwLJQ7k/g2UFew0+Gq2rilpzd1d9GcrIrJQ/ X-Google-Smtp-Source: AGHT+IHvookYNdJOopZfrO8d32EhsCe2qUize4F8OsFuUE2VarnhFFRzhuFYxN2eF9gHXD7EPeKy X-Received: by 2002:a05:620a:a59:b0:78d:48a9:d47d with SMTP id j25-20020a05620a0a5900b0078d48a9d47dmr952833qka.55.1712312983990; Fri, 05 Apr 2024 03:29:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712312983; cv=none; d=google.com; s=arc-20160816; b=wl7XPS7AYWXs9CRBBLukL3CGpUZxH0mSdePTnNPD+M3YtYeQM8nsx0WWylNiWykHbr 5/i0oJLXiy01/mqjfbHw4FuGmMEchtepkfCSU3TkVAEnhDaCpeeAveDTJhoYhI6ou4K1 q7jpUGz6WIpOuuGgwp1vA2T1JX4LK/RaoLvzkrt5yoHEx0TYaPIMtAEYoTZSgVfvYW1k XE6jJHZXheHX2+ZJI3wqaTwM+SVohQcssTd3ppQFDd9+ZxiCE7FsxQ2LO+QychXbMDQM ZzBYldXPzneOCegXz72zO2ROZYOR06ykVUy7GicGtiE20ZhjARPFQo3V1HvaW+8veYYz iI1g== 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=/BwnXL0PuupABmOqDiTYjL1lyGImoPKlNTGPB4Zwgso=; fh=dBGltRZCelj4V8aBoG+OSD7H6rZxxBGgTNXT/erTiSU=; b=st8rI/MfKubw+RL8DUYxLU4DbkO46P4XFze8GrvyhybhGNj3pGpfmn7jGHTMzfUxzj qh5vMotvBcVfTloKp76HZ9MOkrHLnKiRE1pjXSOYWg4gMIGMAoJV3UAOHQNpuK/ITqcc DBPLwdqRlp5SzZW9hZS96J1/3ug7KKnu5oluBWF+UuQM4oOGHExmkA239tpXw/JYQm+W 3ov0wOLuJ4ALDQo/+ZJhHrXdFAVAXL+ajp5SSEA/7QjQHGMcud6yJaHAiyP9hxBayx3Y UrKz2PR2YCU+8bKqdqiMWks6ZDvFqX0XkUjXQ6GtCqW1BERpkWhVX8X4z3fOPcvmm3K9 GKgw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PkyYjQfX; 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 i8-20020a05620a0a0800b00789f4dde9c3si1485094qka.94.2024.04.05.03.29.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Apr 2024 03:29:43 -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=PkyYjQfX; 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 1rsglK-000662-Ps; Fri, 05 Apr 2024 06:25:34 -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 1rsglI-00064t-RJ for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:32 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rsglH-0004nI-Ad for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:32 -0400 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-6ecea46e1bfso1725836b3a.3 for ; Fri, 05 Apr 2024 03:25:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712312730; x=1712917530; 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=/BwnXL0PuupABmOqDiTYjL1lyGImoPKlNTGPB4Zwgso=; b=PkyYjQfXQ5NIUp06rercROu6//7PbPqNI1FqoBB8shDdEftgEGw94YgbfYKKuEzuA1 4j3a/b+/hIKJXvsGc+0SNojRGlUKajg4yHRDH3hzGYIgAfoFYMkxrmd6JFbBHT4yoBZU 33L2Uxie5nagtHhjthB5sKiyBLoTbHKFYt1WY1KF1OKHgppDD+21zbsNFTFmQYTVBK/V 78nce/cYbfGa3ThoPiKeTVQjzBx5CsJcbPMmbjO9oCysAddcvBQeg3oDLmX0M5oBXnxc zStle1a+bqWtn7DWPnFYQ76PveL+DU0dgVA/7zDrPOkVHR4VZooT8T5u8xFgzO+wzds1 BUOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712312730; x=1712917530; 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=/BwnXL0PuupABmOqDiTYjL1lyGImoPKlNTGPB4Zwgso=; b=g4B2yJ+hA06Hpg5OPsGhTHU1Z7sBfoJGQvp+f8U3yAuoDXDeHLcFup09oyTPZcpkKY Uq+eQd7PSklAP8effsP8EI+TtJYdxoaXObtn0vDFW7o0W+KVCepAXmn7WKR3cskpEj79 8diye+FK3LyMhq3pcuUvc5J11wYjW58UgRDeEVbCkIolPOQIAEEKf8/Lsz7m0gjcDgzu +N1+IN8PpJ62TVkwg4i+ODI1E7bj2uFQ1HfZFrNxY7ixFSyq2pNQw0512+kWap05Lf3v eTWS/C3+mokPdfSYLSCrMv1/2GHWXyJV2mPWgcePF6iy4VdssqVuS7jw007xF0ccIdiQ 6nBg== X-Gm-Message-State: AOJu0YwOCN8XNbkdNYFAeJtT2EoZie4bQRZs41+jM1qlk9SHyb6wsIdP 9rDODmrgYcWlorehOV4tQnE//saSQOVr/LBICBQenNRJix1Z0aBqNfNTutgweOQgCWMriWS7sfw J X-Received: by 2002:a05:6a20:54a3:b0:1a3:5d2a:4001 with SMTP id i35-20020a056a2054a300b001a35d2a4001mr1175925pzk.44.1712312730150; Fri, 05 Apr 2024 03:25:30 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id h10-20020a63f90a000000b005e438fe702dsm1104304pgi.65.2024.04.05.03.25.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 03:25:29 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org Subject: [PATCH 22/32] target/s390x: Disassemble EXECUTEd instructions Date: Fri, 5 Apr 2024 00:24:49 -1000 Message-Id: <20240405102459.462551-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240405102459.462551-1-richard.henderson@linaro.org> References: <20240405102459.462551-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x433.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 Cc: qemu-s390x@nongnu.org Signed-off-by: Richard Henderson --- 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 c1614b8264..fed326b136 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -6527,8 +6527,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 Fri Apr 5 10:24:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786217 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp92931wrw; Fri, 5 Apr 2024 03:26:48 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWIVgoJoimC/NzHZ99IK/0kTJhlJf7NwzXAjLumpYFETOMGEpHuBnhD2Cor2/JAlnfQhnLbSmaKv4vttVEdYuWu X-Google-Smtp-Source: AGHT+IEpUntOtMdskaFoBeHVE6s6/qOUxpXDkadm7guwaN6iN1xP/gJ2JZa2ye9EAew99pfAvxdK X-Received: by 2002:a05:6830:4d5:b0:6e9:f88b:1640 with SMTP id s21-20020a05683004d500b006e9f88b1640mr923469otd.21.1712312808260; Fri, 05 Apr 2024 03:26:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712312808; cv=none; d=google.com; s=arc-20160816; b=zq/5FokTraXmFuYojZGsxwBwmN8C33s5F4ZbV/r9fLB+stQrt8gSSkN24P6rI/oB19 W8iUeR6dM/srE9xKryPjoECgMapfHE0ZVGmbAZUsKDSF1TMYjUDBpFrqopZNviK6mn1s /PuIAvph8ZChjc77l8mRejW5c+OqFHabc8MP69Wzq+0SSCRQ2IMQKXMlKzOBGGTY1XIu rgGqE8i1yTnO1DgonnPRbPvMXM+UobFds3mti1XBN7lf6v1S550Rry+S9I4Vxb+XDenA 3p4cXe0zIjepQfI7E6mxPb8FwZoHORFItUdxd69FriDHSxsEGa6ZofDlJq/zSfVQysa1 dXHQ== 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=mQu8+R8TpKFXj2TBf9M0KEgMGt+uMfxKhhpkx/uTdnQ=; fh=yLZwqfag1JeMiXBw5H9ZfaXpNBUTOQFjOO+U0yFfH6M=; b=UBa+K1Bt9dYGz+htbe5/KqGtKtNbf06k6Bb3eg/4Epgmn4CkxnyUr6x0TyiLoOtMYJ FdEJx64Xm5R+ZEtA7cdf+L6mx3pxvra3Es26OjVpP99PFU9CyQFSt9ft0EwqSMfCEyyA IPlAzW4ITiO7lBKomlccj2IwFTBZkBRupkGq0RUryzmU0Pz/yj/BsEBAHtqpO1DH/SZT tu+ZHv11gFKnbW2xwOhsp4YG8pjM1OlDXzCin6Tch1szWZ8t16meox/5sqYI5/QdWQbe 5pm0woS6T1EGniFL1/WIuLT4sdAyVNtCczxfmg73AchEFWHR30J+dGv/INLRyyXivy53 tgrw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BOxQRMn7; 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 t20-20020a05620a451400b0078d4d99860asi518467qkp.81.2024.04.05.03.26.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Apr 2024 03:26:48 -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=BOxQRMn7; 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 1rsglP-00068Z-B3; Fri, 05 Apr 2024 06:25:39 -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 1rsglL-000669-4Q for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:35 -0400 Received: from mail-oi1-x230.google.com ([2607:f8b0:4864:20::230]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rsglJ-0004ng-Jn for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:34 -0400 Received: by mail-oi1-x230.google.com with SMTP id 5614622812f47-3c5d940525fso985381b6e.0 for ; Fri, 05 Apr 2024 03:25:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712312732; x=1712917532; 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=mQu8+R8TpKFXj2TBf9M0KEgMGt+uMfxKhhpkx/uTdnQ=; b=BOxQRMn7kJDyJLP6p4RTyKXT05Weoc9MAJl7fvAHYAc+DJ8N7d5bLS1O8n5fEwzPJK YNGnu1WsMN6a6jVce7KgISYf8avMCg2Jxk9fmSkiO7VpUsmegV9bN4HgjHUsTJntsVTf LjhqCnjdWHz4ZElaXruRgak6RNfoWnDIqWraZqGz7DwoWnXcSY2Ixg/7AuwwKwErF/e+ Yp2neAKtYcAIXkEjl6BwgwSWk9Mz7ttf/qmi91aCW9Yy/y5rvP2o3ZuInW/Yx/w/RAJL 3i3K71gMPBvF6ukzIgtS9zW5JJ9daoGlGi+Xt7szb7AARUG9wraqlgT9pFn8gY2ECkBq BQng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712312732; x=1712917532; 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=mQu8+R8TpKFXj2TBf9M0KEgMGt+uMfxKhhpkx/uTdnQ=; b=sDcLUzdn6+Y5xyPdeY1P8581AjLQf2wzP93Lzt8PQJ0FVl8TmnrkRvR7Pm37nQ17a1 oqV9U6xg1dgmzxo53SvLypeMLqgv2HLmAgZnvK0Ym7KIrBP3gJ0ZBP0D9QFNP/P5SDYS X2kY7JmSw6o1IsBMeF/z1ciqgyVeb2/Yk6r84LRSehn1ro0FE4GR9EprBUlscsxb1RvI /aZUVN11naec0y7DzRt8HoNqfk/kY5vcilYqXwxLopHfXhjqW1/AFKdH6o0G+BgIjrBT yrq596Ip1hMXnckn7BrawTaMFUWH0yfnCGsFkc6iMpSHeJzQVaze5iUnpq48RpSIfCn8 4wbw== X-Gm-Message-State: AOJu0YwkxCmQyT8IsAbTCmIdNRUpNIR0eoTRlGfMOuf22abapG7wnqnY 7C5/MQQie4nDKrZcFvPnsI3wwlnqyDz8m22DytD1RljDn2oPoiWkA2dQ3OupKKPhVycHlQz9RXw y X-Received: by 2002:a05:6870:6122:b0:22e:b382:8b87 with SMTP id s34-20020a056870612200b0022eb3828b87mr1118423oae.41.1712312731384; Fri, 05 Apr 2024 03:25:31 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id h10-20020a63f90a000000b005e438fe702dsm1104304pgi.65.2024.04.05.03.25.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 03:25:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Brian Cain Subject: [PATCH 23/32] target/hexagon: Use translator_ldl in pkt_crosses_page Date: Fri, 5 Apr 2024 00:24:50 -1000 Message-Id: <20240405102459.462551-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240405102459.462551-1-richard.henderson@linaro.org> References: <20240405102459.462551-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::230; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x230.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 Cc: Brian Cain Signed-off-by: Richard Henderson --- 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 Fri Apr 5 10:24:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786232 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp93686wrw; Fri, 5 Apr 2024 03:29:18 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVgYJnsCnPO9DfhopG0pqODRZb2rrIqqdKN4wSINNjLqGuntIHYqA12MLO+TlxCJgPvPI6hSa6zvumQeuJQeb4V X-Google-Smtp-Source: AGHT+IEGAGIESlc7kSKezAHMCpU4GD4u4ARpcLWgitKxaoCCmptLh7FwFzQhC/ge24wINkPMFT76 X-Received: by 2002:ad4:5c4b:0:b0:696:5d0b:e0c5 with SMTP id a11-20020ad45c4b000000b006965d0be0c5mr1051311qva.16.1712312958226; Fri, 05 Apr 2024 03:29:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712312958; cv=none; d=google.com; s=arc-20160816; b=aSVyad82HNsg2isl29AoK4+EXBEaGTbJXyvwlJGCTqouKVcPU8DpopGpmYAWa8gaIU tKXsPOXEZ9C6Olciw8qQP7R1f8WassTL8x/XmvhhJlPRBlqArd9ey125AaUJib/1005D PJUIoCpvmW4hGYIXovYXUFed8xyybU6JfG4ZLGvzhdH8e/ZDUhQSF95PD66x72wXq8Gt SOZC1GsweaZlVbDI970zUrW0t6ZDQXhbuFZEUZGLTWiCuZWEq6jOTEaWoDALt1DINo2O sIvIOFmqneIEjrwNWiobBi9wK1zeXlV9R3SxmHgaJLc4VgiY2j1XHBu41Oe7Q++udaoq i7QA== 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=CAOEMFBYb53UUAJdtrKHFH1TzVh5qJKo1U0lXRimkCs=; fh=+pZXDNwgfp85UCpwo3aKCBwyuvKcXy2soQ3D27FkgsI=; b=FKWD4f7Fd1m1bB419IkKSMLnM2XuFg/vImXFwiW1U6dmYHtX0kCXTI2ijO57UW6Qpk dr7qHoT1s16tdUCVqSWaQT9wzYuA2ee7uNeCtWiFkmWWJpj88s4lx7mmt6u+ImM9PavZ 2vLdxRmhEWx1VTGYezu8FQhNfV2l7ly7ZKtqK9rnjFdU0Jmq/dormFn+V3wYfTkwmLUZ l27CcpjJER8djvbRpxZdKZ/zXIGhY9XZVOnMNcZaYpBAvdp4zHMKXWFu3rbRnGR3Fy/R FuTJ/u3AXCJADOPGlzcej1b5BX0SnRb6Ocq7MeEmCRmRbEjrxdahQSczc/Crcg1uxowf jeRw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nwPZctgb; 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 di9-20020ad458e9000000b0069943cb63f4si375240qvb.217.2024.04.05.03.29.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Apr 2024 03:29:18 -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=nwPZctgb; 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 1rsglO-00068D-Gz; Fri, 05 Apr 2024 06:25:38 -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 1rsglL-00066c-Hm for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:35 -0400 Received: from mail-oa1-x36.google.com ([2001:4860:4864:20::36]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rsglJ-0004nr-T6 for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:35 -0400 Received: by mail-oa1-x36.google.com with SMTP id 586e51a60fabf-22edcfcd187so111823fac.2 for ; Fri, 05 Apr 2024 03:25:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712312733; x=1712917533; 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=CAOEMFBYb53UUAJdtrKHFH1TzVh5qJKo1U0lXRimkCs=; b=nwPZctgbI5gBLeeHxhrhAnfHLsQ/BjlPVZqptuCi+ixXmrYy5uN7+eVbrKK55SkISf yKJbMcUTL9vKe3DtY3I7s04cXktQr5ZfPOW0Oq5Q1f8kMh2B8FD8zB6gGrOygr9RumK/ rALS3XU/lR0HKKuDjDkjjVyA52tsUlL+gBBaOPX4aKFLoGnrg8Wv0wVZwZLr3Jljfozs X4rFw8RQWInTMvo82xHNPJPVfUrC9d5rwIHWCppkjKYf5Bb92TIF8B844T79gXCio/4l k6/035JGJs/haMhhffhQMEPEljK77o+Qv7vabRgDgdyAytoElPVgCO+uSWGbRWXmI/Cw Eltg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712312733; x=1712917533; 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=CAOEMFBYb53UUAJdtrKHFH1TzVh5qJKo1U0lXRimkCs=; b=ZebwwOVX3E/cr9YIaLUCmUaoQRAZ6N9FFsiezROLxYRmsINw6XD9ycKEd8jIS/OBQp CFHq+zncYC/4jIKStUg9er76IHz1Wl3+4sAEBU0kYIqZZJoB2e8mxSaAxZee/9sIejwQ H1ueCZqiCS/MCXf6jw5cBct9o+3WH0k/wwrGD0hYXS8xQpbCl34dG9Me3HmbpgpFWWXJ hNvbaBWgVutP13Me0Jn75iCZTeOsgK6oT3QC5RiOblA4tE24MfI1fCEkL5hTZ2hdeh/L tPHH9W2MmOetU0vGIyUlEhxBTDJ/S889g26UXrCmwdcUacZvNogF3G4LPN+cMLb5hIwG utcQ== X-Gm-Message-State: AOJu0YxNU6QLvgTn7zchFzKPYJUdJVlM/5AHTsrGUJiF9j9PDwUUcJUY KOgGXBBecG/bC6NX3hBez4CXROEc5N3zzJmRIXWvW8KdBR/276Ob1b03s3fJuI6vf4cBSnp0eB8 N X-Received: by 2002:a05:6871:288b:b0:221:9157:b587 with SMTP id bq11-20020a056871288b00b002219157b587mr1120627oac.35.1712312732747; Fri, 05 Apr 2024 03:25:32 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id h10-20020a63f90a000000b005e438fe702dsm1104304pgi.65.2024.04.05.03.25.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 03:25:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: "Edgar E . Iglesias" Subject: [PATCH 24/32] target/microblaze: Use translator_ldl Date: Fri, 5 Apr 2024 00:24:51 -1000 Message-Id: <20240405102459.462551-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240405102459.462551-1-richard.henderson@linaro.org> References: <20240405102459.462551-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::36; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x36.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 Cc: Edgar E. Iglesias Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Edgar E. Iglesias --- 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 be3ff76f78..11d84bc514 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" @@ -1640,7 +1639,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 Fri Apr 5 10:24:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786238 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp93918wrw; Fri, 5 Apr 2024 03:30:03 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXUQeE2SdowumYJJPbKo1ethAJlnyHNx+IQjzqg1uPeM5/EAekYQMW0ATruaI8TXMSq4H0tRBtcOgWVd4ycmz62 X-Google-Smtp-Source: AGHT+IFK81uNWd82a3DrBCjZVCADXYSFRFfOVJLBj1g0LX4hueBoX+5FEfgb8LJNk9pWP8nc0vf8 X-Received: by 2002:a05:620a:1011:b0:78d:45f1:52b5 with SMTP id z17-20020a05620a101100b0078d45f152b5mr1005697qkj.39.1712313003280; Fri, 05 Apr 2024 03:30:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712313003; cv=none; d=google.com; s=arc-20160816; b=tZLcqy0cdQdYXQkGO8uVR8Fk1fg79ljTwt0fONDx6CmKpq42+V0YQ2cwoQWxxaxuRV Eqtm81GRW3h/uqCYrN6C2uYS8vtWZ+wg0PVw41T+LSQvkf1EILWxN89bTKxdKRH24wsk 3XnFOde06ujDffOHmPXM8/pPf9NhYlnKxItMVn3jm1+SbNWClHZYtKKFuysOo5jmhE+U jB+/PGPmxinhfEpHWMejtKnxhv5HfXc7UUGKrV2EF3Q1Z9io9aAZZsuCT8P0gOV4pf9F AAYebyjBFUg4WAX1J1hC+b0eTY+wMP+JGuLCPXxuAlEGd/p1dc3ZrbwkdvWDrAHSpPRN x5gg== 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=D538lejiqMy2S3Z/eKkMIrZXKbMQWBqQMNIx5hsPK8Q=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=Ey0CF6eP10RceIXuba1lnvUhueXNW38ThcIW3eHiOZblibahEqP1Kf7TRb7bpm55pn 32b+ye9QrRhp7zwYvN5c2QTD45DTRaFAUEqI6epzMDqo0Q3/fVNNQuOkLviW0ZGS8zs0 PUsP5gurtVPZKnYzxNI/y0CJs59C7MTosaSo1iDXBh2pwdRYmR7MdYgblGhdrE5WOsji IsoPitDPQBotb6HuEqZpkMHemCPReczJ6VyrntyBWt6SlaCbzKjgsw0ZFzuec4D0WytO dOv2kaIFSlOm/+7yUybKn16oQdjklG9HW6EiG66n0GDA37lFiRoAJK4BL7gS3EfzKB2D z3xg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bMhWn3wi; 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 m4-20020a05620a214400b0078a5d0dc344si1428742qkm.271.2024.04.05.03.30.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Apr 2024 03:30:03 -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=bMhWn3wi; 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 1rsgm7-0006uM-Ul; Fri, 05 Apr 2024 06:26:24 -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 1rsglM-000682-U8 for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:37 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rsglL-0004oM-Bq for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:36 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-6ecf05fd12fso1376979b3a.2 for ; Fri, 05 Apr 2024 03:25:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712312734; x=1712917534; 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=D538lejiqMy2S3Z/eKkMIrZXKbMQWBqQMNIx5hsPK8Q=; b=bMhWn3wiEcWbk+XzBA0ZZijYelGcL3wzK7QTmtAxA1maJsfUm997ddLCMGclxfCD7t I43Q7fjhWCQMMXrME5Oi6B67NUZeNN8J5n4Yw3Y5Xf+2an485qoIP2lWbD5Msn2C4FEA O3F6X3GDECYiyRtUzLyKlqTzTSHyOimNl6ZqXcaX7HMDWC+FXrnQJ9NledGlQ6VoFTQ7 4ZZAZo5BQH6qcvCMz/Gl32zGdNPijl26rMKW7DxSrR1ltKPFWb8aDYSJimF9/Ty1xe2a kshRBzctA4xitm4yXepcmRPCLcRebe0UP6/MAjUD/KvXLctF1OCbzt7l3TvifRrtHnZR NSIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712312734; x=1712917534; 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=D538lejiqMy2S3Z/eKkMIrZXKbMQWBqQMNIx5hsPK8Q=; b=Ogm7FtXVVgBHdjg6lgbAAYy4dC1MpYnZKLgd82WwS9X4A/9BIyS4CkLqAbhu82XOix TELsI/kn/MXXs9hC+7EsSRIPKOXTCshRuVmqXUmcK3B9y/RbJDZbY0bgBXtgxgkO0+tD T8vANSjyXC/ckOAfuK2X04NvmMTAEatvIwu6x1cvpqLE1GRV/H1ocIZHp9nYuZvxIKTc nk2jMZn1mRmCkPe0ZKMapwOdCa+oWTPe7ytQctTPmp7gH7pyELpjXs9uMpSVBHEg6jaZ v+sdO7b8Riwd28SuGZFzjN/fBMcjrSU7u90XR8MMdZQ211vVNVfEikESv2hdN/7s+IhO I8gQ== X-Gm-Message-State: AOJu0YwZ7XvvTUiRUicc7mM0bpEPgzEoGqigBk0VhKLZAqSyMNKov08x vtYVz+xE7WTx3IwzrPZEa3RH1vVMFtS4UN9Pe/dZz1mbyeSP6QPL3AVOLBVGC01y6u5aPk7+ZWj S X-Received: by 2002:a05:6a00:3d49:b0:6ec:da37:d09 with SMTP id lp9-20020a056a003d4900b006ecda370d09mr1049329pfb.16.1712312734117; Fri, 05 Apr 2024 03:25:34 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id h10-20020a63f90a000000b005e438fe702dsm1104304pgi.65.2024.04.05.03.25.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 03:25:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 25/32] target/i386: Use translator_ldub for everything Date: Fri, 5 Apr 2024 00:24:52 -1000 Message-Id: <20240405102459.462551-26-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240405102459.462551-1-richard.henderson@linaro.org> References: <20240405102459.462551-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.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/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 796180f085..d0ba81eb6d 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" @@ -2137,9 +2136,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); } @@ -2717,7 +2715,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 Fri Apr 5 10:24:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786229 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp93288wrw; Fri, 5 Apr 2024 03:27:57 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUKWJqSrM+78v69p4F/G0ggM4TZSKq7s54QmC+twXUCwTZz+DzZFgdtkPck36Zy3QoGIbrPx+VxFyjP0r5Dbiny X-Google-Smtp-Source: AGHT+IGVRcQslflGz3feOylp9D73efpaGqQ1f6vzu8MIqJ1+ZTj7c4nUUUK2YWoF+vroEDEL4lgk X-Received: by 2002:a05:620a:5e0f:b0:78d:3b5c:70ae with SMTP id xz15-20020a05620a5e0f00b0078d3b5c70aemr1090711qkn.61.1712312877698; Fri, 05 Apr 2024 03:27:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712312877; cv=none; d=google.com; s=arc-20160816; b=iVzsq0Vfv3gM4Qqv2R0JB3jjjKoKtUpzmgNz5pOfSV7uAFnxkvB3RJJw6KPzZFRu8w ZrHUdUxCufdfz5D14BxY3g0UB+Psh6qRkjMQNPiqmyYjcUdzM0mFKg39e6OJDJZFwUte b+YvBLwQxhFaFOmyx1qBcR6uGYBHAgJ4xdqi61f0MyHnoEplGSZqm/mSyLlA0HlT29Jv HLCjEy98MhEeCNoBIQisnxDIsCMLJRTo9QaSkUiphYxQSM9jBc3GBJcBPfrQPSbNq1Ck dlZPkKjh+NBe1AI6UghUYkQAgZCJIX5wm33RxsRZZCBY91m4xi/BXaXb/Kv76TwxFnkz J4UQ== 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=tA0b/fSj8XfUCrgQgUfiUA7OwpX6731DGB+eq9CuhnA=; fh=UWHPD0xBgQKCs3dgyo2BTdHMjmw88Vfu+HSRwwJh13c=; b=d+GTsPWnu9DRXLnbzO+nvPRuWzOWPU4tgvOwXRQNfisWrZnD+wdh/xI8jzaB1SJ//R ldbYKV3b09eMms1NhLIQJO+JAbsaR4lZ8IRZYb2KANxQSGNCTlhYyvVGf3xaG3AKPJe6 oYfYsbRr22D/N7RFBENOB9rP6w0mIhx8hsABLtY54i0eY3/Vt0ZoiwqlMYm8/c7/dlbc 1v4GQaTOyMXzFyGYaauEZVTEeqF0s3pyDn2vf4lZbPxQVw4ZI+J33IFNcMFTrsk35rnM LBaKUJ9mDR0kTJ922n200GMnvnYLbEi1FoGn7GH2BbL2N++/iEWqiKLD99FfclcaeTYZ avWQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TXzJT5mU; 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 g17-20020a05620a109100b0078a66ba4635si1406951qkk.169.2024.04.05.03.27.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Apr 2024 03:27:57 -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=TXzJT5mU; 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 1rsglR-0006B0-K1; Fri, 05 Apr 2024 06:25: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 1rsglO-00068I-Ns for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:38 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rsglN-0004oh-29 for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:38 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6e74bd85f26so1768847b3a.1 for ; Fri, 05 Apr 2024 03:25:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712312735; x=1712917535; 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=tA0b/fSj8XfUCrgQgUfiUA7OwpX6731DGB+eq9CuhnA=; b=TXzJT5mU1jTutnVstrqZgjKzyYKhxgeJKH1pQoOjGRst2PbiqcEYfIptSndSKHVYjb m/7YXp2qgsOx0PFm2i7P5/PHBnkgu/9ldRa2E9wW4VJfXPc0Z3853OH/Yq6gUWq6ZQhH npF+J/ucxhFa9hw3Jl4UKJDtmu1coKQ4P59ld+7OV7m6/Jij/unC09hq8ymY9QdkmANu Jm89VEG2XpVdKCeAUMAAVl3pk+xBk5hR/lb/Rwnh5i5vxlQEdjkBLgP2ou9GsZvPXXh4 9G3ZU0frR+pdhbne5SQPxutgE7PK2XtAEi+TjOEJRFfTxFovuEUj5wnupmnhkcbJG9i1 OxZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712312735; x=1712917535; 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=tA0b/fSj8XfUCrgQgUfiUA7OwpX6731DGB+eq9CuhnA=; b=ldKfToy62ODbHapaO/2shP/vK2pYlgkh/sDfENB9rMKzCn6Etw9CbEM14XVMGXLgKS weqitIORj6qXbFMRmSVJ3icVaHRe5PZwBjh7FJIV01F7P3AW161YpRxJUg0SvJGSCNqc 7+HpKSdXnYMblYs/hKz8RNHzZM1adyrMP8BnN8ThG7sC5xXUhCPkApM49Km1mLerUQ6z fBwi8HjSHGS/u4i5TfqB8qFDqkOnyJIPbsjpc1n0Kl1JKNqVYC1DpxdtuNx4z5P3RbMi /YF8Gy9/8VvtD6SIDtygnV38/4OrPxBMSvmpwYUem2g99MJT85WmHTVwxP2l/2cNYCYF 93Aw== X-Gm-Message-State: AOJu0YzT++ETQjdLTZg5u0a9eC2Blhh57HA5xH0aoIod1o6R5Jus2EQ+ wRlQtAtRYlz67wOMTpIQu1l+vbHf5Cz7dKImWUq/v/4aYuJgHHxHyY8HEtZAukDrCAlVMglDeFS 6 X-Received: by 2002:a05:6a00:23d1:b0:6ea:8e89:7faf with SMTP id g17-20020a056a0023d100b006ea8e897fafmr1086111pfc.28.1712312735300; Fri, 05 Apr 2024 03:25:35 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id h10-20020a63f90a000000b005e438fe702dsm1104304pgi.65.2024.04.05.03.25.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 03:25:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Michael Rolnik Subject: [PATCH 26/32] target/avr: Use translator_ldl Date: Fri, 5 Apr 2024 00:24:53 -1000 Message-Id: <20240405102459.462551-27-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240405102459.462551-1-richard.henderson@linaro.org> References: <20240405102459.462551-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x436.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 Cc: Michael Rolnik Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- 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 Fri Apr 5 10:24:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786222 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp93011wrw; Fri, 5 Apr 2024 03:27:05 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW2PfAUytlFIIhAkxsRRjuoa+LES4Spt8V1i+sCTDakKBekvn5fWfF6lWGyMtNjbGSmp86WAymX6DZEQfbt3iQA X-Google-Smtp-Source: AGHT+IF+1jLJp+EBQmbG4t6Q7CmcK0o15MohLeCtWCuDHs/fuy4Po6rD2Pj+cWbGmzzfa6WUKOxH X-Received: by 2002:a05:620a:4309:b0:78b:b0c2:17b6 with SMTP id u9-20020a05620a430900b0078bb0c217b6mr3281935qko.11.1712312825628; Fri, 05 Apr 2024 03:27:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712312825; cv=none; d=google.com; s=arc-20160816; b=ZU6YTlGC2Cm2YhTvO7F9hqSagCAYIpaGPlHkOJuQeAcPBBJmDw3HTGF1wzC9qw1uz+ xYa+2bXAHQpedQYQoMR8nvrLajskudItQyorUrD4brCGDLDoJ8+VDXqzKS75qK1Ecjxx 06EmDmB/UhLQgvmCLGAgTV+oNQ2tXcNroxfKaFo76BagGw5qMNhmWpfXyosveZDUVOAC nBRTy05Hyp6GykSJXegJDSuEKEjFl6haB3sdPmG7zAmvaKxOWKt9k3fRwcfvP5S/8+vj RidhlWtOe86eUb/hLO5f0H9RWIlkmy5VgeAmrKRYKYz/xDHDVZG/tLmhDUVY1BRIm7E1 0yfg== 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=+fs9+k40tx7u0ZrnNCGjYa07BmQdJ80BwtuGhh0yXh4=; fh=+pZXDNwgfp85UCpwo3aKCBwyuvKcXy2soQ3D27FkgsI=; b=k+Zg/9La0SjygnmcN1unKu7L/r+ZQFxvtvJw3ceG4oWqaT/whvNkxHln2VRcFHeg/q DmczSUYSI0I1+1PFy8Vs60UaeyKH7D+mZZSyrAHuQZ/1i0YU3DtuZpQG1BbhmPII9ryt P9mvYihwb2pWDzJ+CsnIVcKRTXyPlkqutf/QWlYWSIU2xh/VMUZl6oXqsV8NiCyDyoHB /2ll/m2mjvcLqp0QL3t2igKk5Pl1/qNg7LcCRXBT5udEEeTYffMEsYRBd69EHx8Vqdv1 R/sUAuXYHL2eY/sibf0WMaYd5MSb1R1B3R+cHB5fB2pQiA/X7Ec2x5c3MJghdu199PYM FGmQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FEnvx95A; 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 z10-20020ac87f8a000000b00431023071efsi1473126qtj.752.2024.04.05.03.27.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Apr 2024 03:27:05 -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=FEnvx95A; 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 1rsglX-0006CK-EQ; Fri, 05 Apr 2024 06:25:47 -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 1rsglP-00068s-Lw for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:41 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rsglO-0004p9-42 for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:39 -0400 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-1e0878b76f3so17015955ad.0 for ; Fri, 05 Apr 2024 03:25:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712312737; x=1712917537; 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=+fs9+k40tx7u0ZrnNCGjYa07BmQdJ80BwtuGhh0yXh4=; b=FEnvx95AgCnbF+lWRAS68tf76Bpo9uTrgrUyqP+S83Xm4AQ3lJCgevvZ/WRm8GjUDe 4lf4XjxoKYo1HcnI3la+uBBrJ5z4LDYRqiUopLXZ6OJotsgkMjl1H/9hZAGLjD0iDUmv McnM+1u2ej00HM7Q/qsbWy1suHgoiAxpgRxdwUcsWXbEvu/QjUHZdC+s5crgBLrRFPCY Dv7tfiB02OExGkunS0zVJnuAOadUTBzP+LnqEM+M3h7QvGLYkadXR1cS6yemEJAUho3y fbvJZja4j1mrY7/+EKSDvLzGLgq7m7rhkO0fvvwz5snG/hl5revXtMZ0A98/3spZ8R3L y6/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712312737; x=1712917537; 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=+fs9+k40tx7u0ZrnNCGjYa07BmQdJ80BwtuGhh0yXh4=; b=r+0S3hQDeoM01hBWgY334jRV1MlSbU+/nlNgI80i0E1pv+qD6nSVuG/Cj0eZnpJjV1 dqydB4cm69PvzJGzim/GSq8k6rbzBCU3W0UlhfqHyrCtmA513n85bwvEebJ6cjDHiDGx VP/OBWT/SgKZObFBbjbMK7t/1paclUeHwsbFa1gdq2hPlbAmmPN+ppv7ivlKQLNTdBv0 EscR/xwWxX7YJRSO5NU7aNSeO8gAFORY7HLxziIxbDwUfdfAyfCBLsMKGpP/py38XDLp 097ZfufDyj68OmhfLflFZSoHHVw/w9FBkI6e9X38hqaWTkWPvHio4CfRkJN+HewE2N8Y t7KA== X-Gm-Message-State: AOJu0YzUdLbV+34qYb37HRdT7LaeASKgRIFgxu6eLfjUUqquYEE+m+0c vDLOQXS+HNx+2gEJ1PCOt6yibCkN+Y2qjPBuJQUK8NO2NK/eNaz9dF4wAfvx9u3+m/Tkht2F60h Y X-Received: by 2002:a17:902:ce90:b0:1e3:c327:35e4 with SMTP id f16-20020a170902ce9000b001e3c32735e4mr1696611plg.5.1712312736873; Fri, 05 Apr 2024 03:25:36 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id h10-20020a63f90a000000b005e438fe702dsm1104304pgi.65.2024.04.05.03.25.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 03:25:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: "Edgar E . Iglesias" Subject: [PATCH 27/32] target/cris: Use translator_ld* in cris_fetch Date: Fri, 5 Apr 2024 00:24:54 -1000 Message-Id: <20240405102459.462551-28-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240405102459.462551-1-richard.henderson@linaro.org> References: <20240405102459.462551-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.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 Cc: Edgar E. Iglesias Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Edgar E. Iglesias --- 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 Fri Apr 5 10:24:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786243 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp94474wrw; Fri, 5 Apr 2024 03:31:28 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX9wAQuPT+je0D/BnbOpKWaPfbeD2Ti5oH7uXN4bg2l/UopdUegGljGE3ZZpr8MOHxMrVHtfsCvZ7sIrc/+Nmfw X-Google-Smtp-Source: AGHT+IGFRMYfSUMtZCLoQOY3NiSrv7Rau+dz0em7PR8LHO1QVqWzWexB+WfImuvnlVFYb1h3eAVn X-Received: by 2002:ac8:7c4b:0:b0:434:48f4:e29b with SMTP id o11-20020ac87c4b000000b0043448f4e29bmr1109885qtv.60.1712313088040; Fri, 05 Apr 2024 03:31:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712313088; cv=none; d=google.com; s=arc-20160816; b=WtKnDM8mBeU9Wl1gqOjbaycZy7KJh4YXOYvUwfHTfPzBXohzH0ElAYmIyNFCLXJWCB kwckibLVCPfsTBS6uaIAzazBMe32gJMsbwfa8Qdmzvsfb2UXTwf4XvKLPpZJQPMjHVbI BXtLdGUZkm1XBy1o3FW4qxN3sH+/6s9qV39z+GhPu+km2YvUMOeYvFLZ+ZkcqbkKn9X1 VBKKoSmX4STgKRbQ3OKoSXWHkt7s9pRZTR3mXi9O9wu9++uH1HXp1lVClI1wBNwtChmY cwXLT1H3ance++m0FSgX6KE1AJDWQaRlR77pszTJZkJixd7f3v7YhFkp9LXusdDRZ02s lPIA== 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=Q4IwNemI6HQ9b33EE9N7v7S1E8PqRebn39PS5dqy4+w=; fh=+pZXDNwgfp85UCpwo3aKCBwyuvKcXy2soQ3D27FkgsI=; b=mx/KdOGwJw51XyRjihROX9ONQXks1mvvUydgYdS4MPhpibsCMngHJmUsO7YDoHEKs3 dnreG6UjHqclfT3z66ZnK2ZszcEV0paQAt6vmAKUwL5ros/O38t5lsmulOY5YvNc8R3V cY8g+5kuJubtbUKeEON37CqaaHZfCFiNHHNXo0MdX19qlSnDLOxSQOuo1UkStJbjnss7 taVFyoXtlJX3pNfvWdxEQHiDRptq5yIKG7UuVoq0IFpCke1Y7jpd+7AxisswxaBBbig+ g7EMi0PgsgYJWCUCNMW8vc72oaIzAHUiWz7Jh4XtDY3qtm3BYCopV47oI5Esaxu1uwVC mbQQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CUN+1If8; 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 d7-20020ac85ac7000000b0043174f88af6si1423230qtd.164.2024.04.05.03.31.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Apr 2024 03:31:28 -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=CUN+1If8; 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 1rsgmA-0007Fm-6X; Fri, 05 Apr 2024 06:26:26 -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 1rsglR-0006Ak-0v for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:41 -0400 Received: from mail-oa1-x2f.google.com ([2001:4860:4864:20::2f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rsglP-0004pO-CG for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:40 -0400 Received: by mail-oa1-x2f.google.com with SMTP id 586e51a60fabf-22eccfeee22so366406fac.2 for ; Fri, 05 Apr 2024 03:25:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712312738; x=1712917538; 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=Q4IwNemI6HQ9b33EE9N7v7S1E8PqRebn39PS5dqy4+w=; b=CUN+1If8puxEiRtWUI3UESzwVOu6NvggSPDX0cGRxtN/4pYq+W9C8Bdgpw5fn+O+Vf v2V/GCf7hKJJQ4MRYkVMTrkmpnKNdSCgjDnht3xrF+nRnypG8dyE5Smsw9DnAdxieZ0i 8F+BsaayO56sHN2hM9JwsLZa4OjlZ9k0MbldA7KkIi58PDALD+NnoR3NIN/5xOh/2jBC Obo5stbr8xq13QnAUQLp+kdr+ZEsFZbQVtE+Z3hOUG4KtJNXbXX21Irohj3UjxP52qb/ ofFbzUhelEK4c4bkziU5zCl64KQtST+c2d3mb5YMuNG4EzyAdgv50PcupPIYmhM3mcPg YHbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712312738; x=1712917538; 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=Q4IwNemI6HQ9b33EE9N7v7S1E8PqRebn39PS5dqy4+w=; b=rwwpw8Lc9dCcNZcUtCT+kdB4zsw3X9SkOyovEwHkl+pVhr57rWqPStd8VVKxSz88zO /GgXrTdoHyaTobpQgd+EvnojUOq0tpgYDzBDbhm3k8U55uyDCL6Oy0aUKL+kWQH8Oti+ fPRsVfuXnLEQ8TX/tBpOIxXuIHWFKvKia42Ndl86VbobXSVyJBuAe58vj/DNzvAcSREN Ivp/wO6pgK9KByrTc0nrQkKADDi60NOWPmpUhdtVZiiIAv6+dKSvn12e0+wLLmyfVr2i nMuGCKDLRhd9yFghrmv7el2P002LDStgGSbsFS2JK9PgdUeFaXVt7Uak8SR6I/wC/x9h 0zvg== X-Gm-Message-State: AOJu0YxNGLkGeNhbnmW0YOya5I9Vn6UdBDnZHUtydjqfIbqnr+m//Bph aClQb1TcwGpI8t/FXuVxHTx0AGwiupn+jQFjFdK1vFgk3gsJqujFV6eFsW0siaA+mmp5aJQXHcA E X-Received: by 2002:a05:6870:9613:b0:22e:cfee:320c with SMTP id d19-20020a056870961300b0022ecfee320cmr1044638oaq.57.1712312738271; Fri, 05 Apr 2024 03:25:38 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id h10-20020a63f90a000000b005e438fe702dsm1104304pgi.65.2024.04.05.03.25.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 03:25:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: "Edgar E . Iglesias" Subject: [PATCH 28/32] target/cris: Use cris_fetch in translate_v10.c.inc Date: Fri, 5 Apr 2024 00:24:55 -1000 Message-Id: <20240405102459.462551-29-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240405102459.462551-1-richard.henderson@linaro.org> References: <20240405102459.462551-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::2f; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x2f.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 Cc: Edgar E. Iglesias Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Edgar E. Iglesias --- 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 Fri Apr 5 10:24:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786227 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp93216wrw; Fri, 5 Apr 2024 03:27:46 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXgb2v+rYCGSMM326hWYgH751MaXIMQJTm8eclhwHZmhdJGDaSc0CoVDYlL1+MmMrlbCXzq/YC2FKV6OHBOdIOW X-Google-Smtp-Source: AGHT+IGNfM0FNWYsJJ56UfOK3tfjBeytdqBJRGhye8EDi4s7/FgielsRItgykoIRJcx89/MQbhMD X-Received: by 2002:ae9:f710:0:b0:78d:4a2d:2baa with SMTP id s16-20020ae9f710000000b0078d4a2d2baamr973085qkg.72.1712312866481; Fri, 05 Apr 2024 03:27:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712312866; cv=none; d=google.com; s=arc-20160816; b=eWfMiBZxX2cirOqdnvveHOcEEadO/fe0e1Q5iEIDJiZQgriw5ToOBID4AhIWRDB19e Jp7Huey6bM59yJZzPmuwy1ttW40D8wmUGOttu/Zm96Tu3dAH9jObEghJu+FydnC1/CIP 2DAzeLIidbvYaAmqu5wbBwt/GDP5cQSLO6IubKwV+HrwsB8svZoiRu3pP3r2UuGR4I3O On1zb7QEtVAnIoQrrIp1PySQoK8qdECb6pyqdC05KH1YykJ6Enu7FX/Yz1jsWzCcVfpY XJ8SDr6pa43sl149DRMCpbGYcipdPW3F2u07x4FHJ/LBBW0ZUe+dPo7DA1GQ/QKloX7w wFpA== 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=oWAgZQ2Av7FDttaOMf2pMnb78RnsfEKN51tfHvsHtMU=; fh=um37n3oR08jEMPPSS229I5aQ76zCoOurJ5utfPrEC3o=; b=SuP2r7trHNx0bjBS/q5ly0gPtYWC3ovYTKSxC3CyZwDUs9wNyj2SRmiOK1TAilr3KX 0RQjneAOc517dkD67O6oKih/4UeyUULcq6+K9kIJevxP1zmiMVia0v/NIn9ICshrQFts EUPoAhsqlSUQPoGUxea7xWOaYRIrHUqX7r4LhTUC1kZXdelGVqbO2mbqIoJ8ZDSPrvS6 3ATrCYb/QOdUzA+1Wpxuej6Msw/LrJOU2DQKoFZ/Z6JpmB2gG9mczduU52WjVS58ggCh p5YW7ea6eqf73H3SyhsBiiFIvspq50m+spkDlNNf6x7/ziHXs0mVcHzS+UD2J2OqhU6E 031w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Jh96cOya; 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 y3-20020a05620a44c300b0078d4de3f8a7si480284qkp.149.2024.04.05.03.27.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Apr 2024 03:27: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=Jh96cOya; 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 1rsgm4-0006Wf-PM; Fri, 05 Apr 2024 06:26:21 -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 1rsglT-0006BF-AJ for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:43 -0400 Received: from mail-oa1-x29.google.com ([2001:4860:4864:20::29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rsglQ-0004pd-Hr for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:41 -0400 Received: by mail-oa1-x29.google.com with SMTP id 586e51a60fabf-22ed72b0082so188991fac.3 for ; Fri, 05 Apr 2024 03:25:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712312739; x=1712917539; 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=oWAgZQ2Av7FDttaOMf2pMnb78RnsfEKN51tfHvsHtMU=; b=Jh96cOyaUYr9+888YUF9hEhiGr0hOwqr5XxYvDfBzFoqTu2NFM4EPmgxXS2WUOadIJ MHDW6n+6G0G9gCoRDr/x20XaoSlhk9uJYUili1gidNl2wIAl68M4CXTOaLak4S9WDwCd QX/B+GkS4UP2fLd/6ilqc+LWDYcYXA0Zx7Nu02/A+nMsbtpkL/jTTRLaLZM5cVdPZ6NI Tk2dGXvSgYFeiRMUFf/ur2SHQJ0Uj36fld/gqbQyqx+CheYKKXhli0NP1f3tsNwMjWes fYLhLCfql1+ESW9co331Ojz5g2lnAnWXLSCg+yFn+5tnKMNe7wYgc1n7EQr6lF1mB/kn H7CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712312739; x=1712917539; 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=oWAgZQ2Av7FDttaOMf2pMnb78RnsfEKN51tfHvsHtMU=; b=KtLG4gVDpfE8pLzMUYkmPa2r392wqxsgIoqHStyKgQhgdre8vNeYb8U2WxtJ214N1Y wlg21SGNuhfqJOdH55mu/mIPujNrFt/Py/7HCdukljTywK+GnVt4wcWf2QpuKv0MtFub iS1p2dbwQOvHvVzsSE+4NxDlQBO3/+EF6pCjd43krJ4fbDxoGIOV5UV+F1dJywiurxsF qZzeV0hhcP+vXydwxxHvap50xBSph29krZ15y2EW/DR3uADfYswuZkZLAix9l8gpMWDZ P8wlJYS7ey6/a4uicrWz+ApZntDqC2Aj+H4MDUqShJO0yVCREoZBGcfqX4hy0fou40+V sKjw== X-Gm-Message-State: AOJu0YzeCEjRjIYcFAM1461PUFwsnok/GwiYWvv/xwkCbw7Vik8vV1h+ sPcl1tguR0XIgFsDi0l5oFc3XMlKa9ElYV9lbKj6yPhxXureHL0R+17FWcRoLy4bgevfiRkySDY s X-Received: by 2002:a05:6870:5b07:b0:221:8a03:6de7 with SMTP id ds7-20020a0568705b0700b002218a036de7mr937273oab.32.1712312739483; Fri, 05 Apr 2024 03:25:39 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id h10-20020a63f90a000000b005e438fe702dsm1104304pgi.65.2024.04.05.03.25.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 03:25:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org Subject: [PATCH 29/32] target/riscv: Use translator_ld* for everything Date: Fri, 5 Apr 2024 00:24:56 -1000 Message-Id: <20240405102459.462551-30-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240405102459.462551-1-richard.henderson@linaro.org> References: <20240405102459.462551-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::29; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x29.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 Cc: qemu-riscv@nongnu.org Signed-off-by: Richard Henderson --- 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 9fd1ac1d60..9a4a68b955 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" @@ -1083,7 +1082,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 */ @@ -1244,7 +1243,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 Fri Apr 5 10:24:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786239 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp93939wrw; Fri, 5 Apr 2024 03:30:06 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU3MInPgJBsxwGAhjYG/8ldzAzjN3KuEqRz4OoINSvjtiOtFLBceRPXDfMymfbqHvdYS+eMPcoQwhXZn9iPL3h5 X-Google-Smtp-Source: AGHT+IH3EDtpgSxvWj05X9IGvgBU9gaWb2TC3sYbqf0+ppJ0I2NHKOa6/fJ+JSW+ZKrygth5RUOK X-Received: by 2002:ad4:5c6b:0:b0:699:310f:5072 with SMTP id i11-20020ad45c6b000000b00699310f5072mr1131836qvh.36.1712313006085; Fri, 05 Apr 2024 03:30:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712313006; cv=none; d=google.com; s=arc-20160816; b=Gt3in8HwvivoAvimrKMse97hhXGLvfpneiLtUOhiFZBeMDkqV/T1xFdSZFiitcxYph xIsCkwhU+4FTJGLmdwLnlvjArgo2QIaEVlA0xzfLCoQqb60+sn9+YXPakj8tREEjL9rC YvZhGpSGH5j6iCh6AmnoFoNI3LS3fEig3g3RGeiD3IVeAZBZ4+LxJJRGVKmWspbGcLPR FTI8W/i+MCf/tWwVd/jMLiNosUrJe7CatszAmXi1wn8NelQQ72uPWevKpHDS/uBXSswd tIqoxFHaWEZa+/tcU6ypjJm9L1v/L6afMJa/NkNGGcUJYeIN/nWsma4Oz0i1bwFyNvUZ /vZg== 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=1gRnORP5tdE9/lL+Q019gMHhCwR/8xBUigSwS4zxh6g=; fh=pKcF2rWkV2U4m2Lap+jKYjpOmXas0tDx61/9YVDomkY=; b=eaRfVFfBZ5AyQeELXoOdnMWi3JhXBe/QKRXWctJ+rOyTZuMhq1Zku898q9hGB/LDnA ham5YT2N8/IoM6z3xOLplcyNfCDU+fALzdLDghzmHEf0m5e0CRlr+uj+sXsSglKq0kVc ihAQzBRfknSNKnOo4UA1Cqbc0XeGuOgbcsaNmZRZJ0qqvfrikrDnFmYVBlIu7O6dfWNF 7A7WSom6waWGa207sgX6X8Ol0a5Ey0O8+JizOJXl00fYZYDxrI4XDYJpTUtp/im0bf3W rL4qHVX6JrTR3PllKPN1nS3lcRiVbB4fvSluF1owwh2WXebSmAVhYiuCYbD5kELr+FI3 MI5w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i4o2DKaY; 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 e27-20020a0caa5b000000b00699243e6578si1444650qvb.160.2024.04.05.03.30.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Apr 2024 03:30:06 -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=i4o2DKaY; 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 1rsglZ-0006DA-HN; Fri, 05 Apr 2024 06:25: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 1rsglU-0006Bv-SV for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:45 -0400 Received: from mail-oo1-xc29.google.com ([2607:f8b0:4864:20::c29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rsglT-0004pr-3C for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:44 -0400 Received: by mail-oo1-xc29.google.com with SMTP id 006d021491bc7-5a50880ce2aso1152569eaf.0 for ; Fri, 05 Apr 2024 03:25:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712312741; x=1712917541; 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=1gRnORP5tdE9/lL+Q019gMHhCwR/8xBUigSwS4zxh6g=; b=i4o2DKaYsLdJmY76dnMKgAvC7QsxqWX0JuP9LE3GSzqtcj2PwV11/2tboUPECMZ4GX nxTDO2ND/O3EW9QWShkOttAdXmV4EVG0zEi0IyWAryY27zCg1U+JJ0zXppBmdrRf7xte gWyTE51iytejPtbLURCh/PLCYt7TGjUfdEb/1ksQyyB3LNCB03nCZt7oRX/LgmY+F7+S 3tQh8OLkr2B76AnvGEe7PCfRgMkK1OYfnb8GtTn8s9TOq2fNEpXckYMqXcD3ry9iPm8q kODjPKl11cj5m70YsbacXgy3DAVj9yVJNA/+0Gu/v1VWnXnSaOvOxLSdSql2rMUWw8gy deBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712312741; x=1712917541; 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=1gRnORP5tdE9/lL+Q019gMHhCwR/8xBUigSwS4zxh6g=; b=lanVVxnAufH/+/PrANhTBG4uaP25yRe6oZJtOXhFPbDkYQyFxMnpdnYz1+jV+OqUs8 Yl7S/hoXsNVbnnOIeY3aUf9Hi6n+6vQ79R1iSUbasWbFqtVNXNPrO7cJSKlcWyEQ9kH+ mR4Q9BlEMjR+vrE7Un8NYEYGzZAyXiCdpxm36WpXh4CZDkgpITRGho+mzCPLPEVB6Ad2 gbQm9nmfZntrbui+krzwh4SdbuerVbk5F6P0GqO6mXNj2MVf7wfrT8tAvRNk96fiMbe7 JPJibR9OfEqt8Abj7VAjNeQVLhagq27JbbscGK/Au0S0XJSvY99StTNmAHt03ULycNIy 1Y9Q== X-Gm-Message-State: AOJu0Yy6j0lXufq18DZoN1UVj3J8+mx4tKHo2VC8NZQGGHq/r/ygIacC 67qdaOgzfFR4+usYTmvGV/ZqTfUV0nbGHwVKA6b3Jv+ySzkJtqxZ+99xym0B64a/bBF4c0fdZuW v X-Received: by 2002:a05:6359:5144:b0:183:f3d1:e0ef with SMTP id oc4-20020a056359514400b00183f3d1e0efmr1181690rwb.14.1712312740667; Fri, 05 Apr 2024 03:25:40 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id h10-20020a63f90a000000b005e438fe702dsm1104304pgi.65.2024.04.05.03.25.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 03:25:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Yoshinori Sato Subject: [PATCH 30/32] target/rx: Use translator_ld* Date: Fri, 5 Apr 2024 00:24:57 -1000 Message-Id: <20240405102459.462551-31-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240405102459.462551-1-richard.henderson@linaro.org> References: <20240405102459.462551-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c29; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc29.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 Cc: Yoshinori Sato Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Yoshinori Sato --- 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 Fri Apr 5 10:24:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786241 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp94275wrw; Fri, 5 Apr 2024 03:30:58 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVdjFmyl2Wdk8l+BDbAEaDre3e6X4c8W1IYefa33yElxNgCBmd9+iCRq4N29HwIFvxVDfkXhjnF/fv7OHQwaYWV X-Google-Smtp-Source: AGHT+IHoeZV1v6m47m9p3XSuFBElMLur0MKvkLjN/XTFaMiWUgXbZUtY2O30Q/AHQ50mdJZSk9XK X-Received: by 2002:a05:6870:e994:b0:22e:de2d:8c00 with SMTP id r20-20020a056870e99400b0022ede2d8c00mr554901oao.24.1712313058463; Fri, 05 Apr 2024 03:30:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712313058; cv=none; d=google.com; s=arc-20160816; b=PCBrczGYVg5g2GDBt6E35FYfIEgqBOIQVWCk3LLjZdZ7LpI0glVbH3hiEnRZDjCyza LByp9w5po1oPCgwRYUS1j+CBshR6ubBPAE3mgR/iZS/+HHSTQgsH/EzwOhrxsvL3Jfbv OxD6F8WJ1RofQfugQZTXf6Zjj6BqbVB4mRc6Vo6z5WuW2GmZJqOHEtziebrJgnOA0ggb y8BeC3MLafZgY8CQ+bQ4LgXwqEMgtgcz3/I3kQ4NWmayM+0+notJogc8iey/pmelWrPP 4injs3XKFmhZ7ONGpq815c7FhymN1PbRbRvDhrTVjBb5kNxgXHCyOdaEWyo9+upQt0VB r30Q== 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=1wv+sXT5wyXDzAXP3RgOrCGl/NGDrvrLpRUdogc33UA=; fh=CYNKLrQn3/SkOzHVC+Oxp/KpGWhDzIr0x67bL1yAbP0=; b=kwp1iBKURwo06xyRmfmVsvNUbByOHNfDUiMuHml0ojiDc52teGeJ0MvmVpsvuq/FUx 9E0wq5ko84R5w9J/QNLylwpc+/bPdd5EthCYQc15keL92E/LUCo7GD8CGuvg5iK/Un5f 1X/k+FuRNFi5Fw2x5qjQsOQlMgoNF3PVAq7CPBHTkcMMJxTSB0N6QxJjQveQ486O6RSR esOps2MD5FFlF3E+1fUNpWsETuoEiw5OnwFydTERiI0RLW7oBC3+ebkaJ8+dYAiuk6zA vrcqlL1iJKnMzLijYQ9OFkwJiqQd/gqQ0yjISc68b19cETdu55t/aRy5LJAzwvgvGcKw V/Kw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QoEr5cvP; 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 bj30-20020a05620a191e00b0078a5dd4165bsi1667352qkb.130.2024.04.05.03.30.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Apr 2024 03:30: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=QoEr5cvP; 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 1rsgm7-0006tH-OI; Fri, 05 Apr 2024 06:26:23 -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 1rsglU-0006Bo-ME for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:45 -0400 Received: from mail-ot1-x32c.google.com ([2607:f8b0:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rsglT-0004q7-3R for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:44 -0400 Received: by mail-ot1-x32c.google.com with SMTP id 46e09a7af769-6e69a9c0eaeso1286098a34.3 for ; Fri, 05 Apr 2024 03:25:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712312742; x=1712917542; 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=1wv+sXT5wyXDzAXP3RgOrCGl/NGDrvrLpRUdogc33UA=; b=QoEr5cvPn/Rv+E5ZkdOC3Picqa65m1pHXtO7gNgYFZWwJ41WMo2KlUksRHCCW9OfHP IxvwvdxbSDoESA0wQbF6iysGQXNu6r34vUq8NpciYt/88DewyzcY+Zp6GE1KrC2iTt+v MF2bQlsSDDTUgzBIlYgOecXaNv1LRKH24av/+NveyoFBZDCmexEMMgr710Blo5FYASuR wzGh/dewGcInA2OJPvMupGT9uEOPf/49EAD3/BUTuthC4RurlGaGo/ZmRQichyRnF7av EBmFajuMPOQXgmY3C93ABdM2aEBjUCAEh1wEhyiv49eD4YX6+fxb4m6wz3OocCVTYu9n 9xyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712312742; x=1712917542; 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=1wv+sXT5wyXDzAXP3RgOrCGl/NGDrvrLpRUdogc33UA=; b=aopizQrZT9O7RcFQXjKFuTxZ3Z4nqwkKJwN1q41U7qh9qZFKu3p0jmkUcki0tNbme9 gsedfhO0AFHlhOy3AgZovTaSdhT2qUKBp5SgTmpEalK+/Iu+YMVxl7oHDE7ff7E8x8YN 4J710S3Odu42pU84QFmKav11dE0cO6mDf+7/2dTQ0os24qBCJxDNB6/u/fgLSTj/U7DW 4oCQJfzyxISU/2k8qHHZcHwTQ6sLCdV73l2lKvVcmXleJZYG0bFr8k1l/pvP5Ijgpv5L XmlExERKz8TACc+6DR0kkBaIsPW6tXYvKDBSrf5ISnO1JcaiqHaH3hbHnguJ9dH9ALko LYEg== X-Gm-Message-State: AOJu0Yw1yFsC5gFa9yYLcjAmloI7lI0pOTKOrcG2P4kan+AE27yKRjeV MycrwPmpAFXgeMT+bXebjVs49ooLT5nB8auOG7CcJTVZM5R0Unc1EzG09867HxtID5VVrFsjfTh C X-Received: by 2002:a05:6359:100c:b0:17b:5fda:a544 with SMTP id ib12-20020a056359100c00b0017b5fdaa544mr1290157rwb.24.1712312741962; Fri, 05 Apr 2024 03:25:41 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id h10-20020a63f90a000000b005e438fe702dsm1104304pgi.65.2024.04.05.03.25.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 03:25:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Max Filippov Subject: [PATCH 31/32] target/xtensa: Use translator_ldub in xtensa_insn_len Date: Fri, 5 Apr 2024 00:24:58 -1000 Message-Id: <20240405102459.462551-32-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240405102459.462551-1-richard.henderson@linaro.org> References: <20240405102459.462551-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32c; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32c.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 Cc: Max Filippov Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- 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 Fri Apr 5 10:24:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786216 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp92925wrw; Fri, 5 Apr 2024 03:26:48 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXjd5/Y4R8eX0jlojQXup2oyttqcBSwFpexdDh3CnjVqXe0s70nm2JIlikziS92G27+1GYZACzKsHWCGCBf9Ssd X-Google-Smtp-Source: AGHT+IFt0EZTNIdcenzVBhUZPlC3ciZxX/JhYzMgPtc3uDx1ZFeN6qxrA6YP+Wxwo73mBA3hEH4A X-Received: by 2002:a05:622a:174f:b0:432:b41a:17d4 with SMTP id l15-20020a05622a174f00b00432b41a17d4mr891750qtk.47.1712312807791; Fri, 05 Apr 2024 03:26:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712312807; cv=none; d=google.com; s=arc-20160816; b=Itg+y4jCsuAaECgcZmqZ3iJX4RorQzVAsV3cr+DVl6pvjXmAS/6XAiOUbzA/hftE9e qAWAYa9R/kUJ92ouuRRLBs2TXoDawlR6iYtX+6DYGT3gd8cHyLAU4kbUmpLW5t+9x8vH rHKVDabYMShx+lurPDlK0+Vx40RUfvDWiC/qT7oMhghtSu2t0YrfuQqB03+vcoweF5Ik 9sIua20GwyikJmpYaPYdqMrpOKqaVR+jakFmqDJU/pq7c2E/QK9EHcoudEFiiPG3jQaH TI0x6VzuBJGmOoaYrIUm35blJxKpaUUX8HsKTOvUT4muKVFLLfpdRl0MMPyhUmsMXEzt QbEw== 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=ccORN4xD1pLxRilHuoEKBsPpuJK8Au1e6hYDpToIDUc=; fh=dBGltRZCelj4V8aBoG+OSD7H6rZxxBGgTNXT/erTiSU=; b=TwGXxzKbJwvFOTy/b2o1CyLoB7QLNHobuUDBSDKzi44nLlRFrZEWHGSOYvUxk1DzZf srqRrbOAX2NNZhsQL+flN5j8FYJ0bwwxfwhnIQRsdDl7iEo3KEfEjQIR1kWTtuogIxtZ /5621+4ciJs5LZ40OFJCm5WLOEfckT/HSkb6lNAuKhAQYjPeksaI4y2jJ6ygBKqYGlj2 kYcqmor0RlRVuaXrKiJ9Czy8z55ulmCp1Ti5GO4hPe3oIN6jjRTGVVswHiNmgITOlV1J BLwJMyfZoFuN+8G90RP6gEOSYbZJ8VAU5SN0tHiUA9/mkGYsYUbkUMG690Ng7E2vGEWY 71IQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="uwBF/IKh"; 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 o13-20020ac87c4d000000b004313b32d8c6si1468331qtv.669.2024.04.05.03.26.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Apr 2024 03:26:47 -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="uwBF/IKh"; 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 1rsgmB-0007Qw-Gd; Fri, 05 Apr 2024 06:26:27 -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 1rsglW-0006CM-4X for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:47 -0400 Received: from mail-oo1-xc2b.google.com ([2607:f8b0:4864:20::c2b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rsglU-0004qP-MJ for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:45 -0400 Received: by mail-oo1-xc2b.google.com with SMTP id 006d021491bc7-5a496fde460so1104631eaf.1 for ; Fri, 05 Apr 2024 03:25:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712312743; x=1712917543; 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=ccORN4xD1pLxRilHuoEKBsPpuJK8Au1e6hYDpToIDUc=; b=uwBF/IKh/Rs10jYrln7eNjcS/wTgj91Jh5Q9PYdME45x5AdINmPNdun+nQnPISroG+ 9A62s+8J2hJGmaQl0ZmxNHMSLaewWcMZimi8wNALLmI3M6YDzyk7vA/udZtdIkcfOC6D btlsLxxlSEIFjgKd3y0tXAjkaO3Hh8JRNSdSjYdbRuV370GQv0AQuetTndMSO/HUDD59 MS9CiBrsCzaW2OXo/00RNIUmb2rzrZFIz7yjLhfX7lbbNNqM4Ei2hSo68ZXa6U9s5p03 3ewidd/TAJXqnCmth0TP1gWf2jj//OHFY3jOF6enoT9idHzPNvhFuUmmAftLTzjetpPO lH7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712312743; x=1712917543; 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=ccORN4xD1pLxRilHuoEKBsPpuJK8Au1e6hYDpToIDUc=; b=fg3HZdJIgjbjscYy6FUNY3gnHKHP1A/TA7RHNV0RaBmlFjkRpiP+MURp37baas2wzD sQRniZRWdPa28xdmQR8m4elGCwEnjBdDzv/gc+FHqyvGn3rdzs+D6WAI5T8qOPiD/2uJ EY3c4LLXUrpf5pAyc2hqvsdSvkoQMJ2OKoxC6X6nMzQSowdPGW0S9mcNb128jztOwKN+ mAlopsMH4VJduEn/mM51r/ZS6Q06Jym7lIRlTVgm2P5j3ZSJxH2Bz/bii+rUEy4BsfYf wEdGxEGCYH/aodnEgkaQ6nEHegKD/Zdo8llSv9Uvt3kaVxOxGq/qg6S9aQJP5vubRtD2 FSUQ== X-Gm-Message-State: AOJu0YxII86oJuKmIn9q3SatBF/hiOpC4Bnd6U6S6mfawxYGpjxBVAFC bFqCj/3s/yDMC0Oc7Z9HToKpxaQfVRBBRWSUnybZnXkkf6d+VR3lcljw6hfx7WJZOsS+7ZvOB0v 7 X-Received: by 2002:a05:6358:ed18:b0:183:5c59:6455 with SMTP id hy24-20020a056358ed1800b001835c596455mr1256537rwb.0.1712312743415; Fri, 05 Apr 2024 03:25:43 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id h10-20020a63f90a000000b005e438fe702dsm1104304pgi.65.2024.04.05.03.25.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 03:25:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org Subject: [PATCH 32/32] target/s390x: Use translator_lduw in get_next_pc Date: Fri, 5 Apr 2024 00:24:59 -1000 Message-Id: <20240405102459.462551-33-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240405102459.462551-1-richard.henderson@linaro.org> References: <20240405102459.462551-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c2b; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc2b.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=unavailable 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 Cc: qemu-s390x@nongnu.org Signed-off-by: Richard Henderson --- 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 fed326b136..aaf0e0c335 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" @@ -6473,7 +6472,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 Fri Apr 5 13:15:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 786248 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp166092wrw; Fri, 5 Apr 2024 06:16:46 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXlhtCp/D94KSnr1Kr6zDWmoLYI/aSW/9/nlKdtn64qhrKBcuDK2cQACOr5cJFPuFiyuXlyyEjscG397RD0ptQ2 X-Google-Smtp-Source: AGHT+IFwAiHcY9TeFy5cokrRJr3h6a0nUxM4poANyb43x4ByEmqK1RihT+IQ+upWeJDdz8175tUG X-Received: by 2002:a05:6102:3ed4:b0:479:d870:5044 with SMTP id n20-20020a0561023ed400b00479d8705044mr1576237vsv.33.1712323005569; Fri, 05 Apr 2024 06:16:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712323005; cv=none; d=google.com; s=arc-20160816; b=oK+f/5pAUnkz1IZ6tk4lhQZpyIC6gAUnOmKogpPc0hEwMzRcw0qasjmVBRsQfZe/Dn XdPNTfg5YNEFjPUKOXNnis7PSA+32kPXxlVAma8gWOfjp1MAniy4sYEm60WpHD4LOTVY 2Jx6VwnZ+xOgDrA2Cd2B1BjmJNWuJCASOeVmU4+1qzSPbYDXgJzuSYTJJvk4aV/FP/eD e1q7OFto0egJUO9rcpnpQ6ppqaHfZ94Nq1+1H3PszThaBD4zqB5U9CYWXmZIjUoJxzhj aaPmD4qKQ257XmpY5NGwC5iexYAxO3LMolAzuesubaQq14RKvNwFao38uMAWcSjiImzD DB6g== 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=bLZl1S54/NJ9uhO86NDCoHEEi7QSVMnYkwt0v60ii9E=; fh=5gGtEWbs/bc4ZS50ZuMZZ2I/Jn5oaYqe3uWxuR8fBxU=; b=LEr/Ob+dxv8r7eaSxr6xuNw+djZyAi+mjLnBE9uV8kqKqW0RuUXJ1AWl8S8N9Ynqwl 4f5jfcfByPzhNGh5tLvUs0xbgV5gME084Caaxyp5YfLqucoMjgectos0pAfVJgj1Vky3 Shd72AM5QnRFlLnuKYqFgYvMRFhB7xYOB/Wtyj8AZqiHGtTkUOazZeMFK+uTdm3g5Zl/ EJyXpFfV3BJG/CFNWE5Lh1h73Ztab/0uZx+lDQzsVkcNwPrU+a3QisqGLq7ZGZr3V4/g SaAyvB4m5VlBRKYt4QhQbe0btHRQotGlI2hjfEdH7urH/cOVzkAKwDjRur8UYaBHQZB0 OtLg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cQnRZuYE; 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 k28-20020a056102005c00b00479dcf64e2asi124766vsp.178.2024.04.05.06.16.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Apr 2024 06:16: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=cQnRZuYE; 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 1rsjQB-0007yh-Hf; Fri, 05 Apr 2024 09:15: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 1rsjPv-0007vI-3U for qemu-devel@nongnu.org; Fri, 05 Apr 2024 09:15:53 -0400 Received: from mail-ed1-x52d.google.com ([2a00:1450: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 1rsjPt-0002vb-8n for qemu-devel@nongnu.org; Fri, 05 Apr 2024 09:15:38 -0400 Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-56bf63af770so1245902a12.3 for ; Fri, 05 Apr 2024 06:15:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712322935; x=1712927735; 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=bLZl1S54/NJ9uhO86NDCoHEEi7QSVMnYkwt0v60ii9E=; b=cQnRZuYEh40sq4+LcIkZrecqgIn+nP7974ZO7szzHSkEUHKhLM3sxzAB726LIDKRfu AIx+rSROL1XYB63NcAfntJy0G1iq3oYUMBZrHwtRUERKDHd0VR4HmGaia29C0F8ih3Tq 6j8wRUN8EF3BCvyuVZMzCJYvr/quXCfDeoFNR8CuEKWH4NFABaIkVtTAwGqIbfRIkEbH CipUDgsLhi72gRp5Pf3iwTvwwGgbEUevEzL79roXYgQukYSKFiGWMh5Lfk3i4yOHWo7L OACDDMRxZ+xtSheOvXHYR77Es6Ymam0uKPVbB6rBfnZvE5B9o9EH/kWX0aXZaotgOgmc g5OA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712322935; x=1712927735; 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=bLZl1S54/NJ9uhO86NDCoHEEi7QSVMnYkwt0v60ii9E=; b=DodonAZaGzAJP4OLBccOLcSHPCUnCLve6z9JG87gm5K9vPU1QwxiE5YuCwl0xU4M+s 0ksCMzoa1vXCBG6LAF/yj33gHIh+LYtvugb28eqnoEdJIcxzsHAF+xLsEn5q4IDEz1xO RtCnekaDn9p2hzFPACNC7esRfmItSEYTOJueF7/ufSdJdmWhZQSGEOUPHEqeGHl2vI3q lVUYhSIQzjpgeq9mM9Y5jqqlk/nf+M04o1vwJkwjigi/FOKVW1b4v+A+2wukj4LXxYZz ngaxJSV6lOLGARbytwjOjSc7MROlr3b2KO1YJi4T2SeBBDC7TscO3k3zlfTAf0VMyeuO ARFQ== X-Gm-Message-State: AOJu0Yyis2HVEkm4VliPJPKR9674eo5fRijh+oEF4xh+kfjk93Ky1y9D FJ/imKp6L1ujLDmByLLlfMuv6NHaVLgo1FbV7z+cHcKb7QfmSE5AVQmqVWhaGJ/35r8xYwXhTIs U X-Received: by 2002:a50:d653:0:b0:56e:2d93:3f7f with SMTP id c19-20020a50d653000000b0056e2d933f7fmr1513747edj.39.1712322935075; Fri, 05 Apr 2024 06:15:35 -0700 (PDT) Received: from m1x-phil.lan ([176.187.216.34]) by smtp.gmail.com with ESMTPSA id b9-20020aa7cd09000000b0056c0d96e099sm762718edw.89.2024.04.05.06.15.33 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Apr 2024 06:15:34 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 33/32] accel/tcg: Remove cpu_ldsb_code / cpu_ldsw_code Date: Fri, 5 Apr 2024 15:15:32 +0200 Message-ID: <20240405131532.40913-1-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240405102459.462551-1-richard.henderson@linaro.org> References: <20240405102459.462551-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52d; envelope-from=philmd@linaro.org; helo=mail-ed1-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 Previous commits replaced them by translator_ld* calls. Signed-off-by: Philippe Mathieu-Daudé --- 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