From nobody Mon Nov 25 09:55:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715760017; cv=none; d=zohomail.com; s=zohoarc; b=aCzVqb/ffrcmQD3HvQGyWKrRa3MsZpF5TTJ18TDjsiZGrhFyRHbTsNbOU7X+xMwyTua5I6P1d71+37dzH+kxwk33F/y1ewrqU3jbHMyatbmozSC4kpYRLEa7v7UXULW9xpjS9cIKGAkbX7+VR1kNl0z7es4gg0K7yUdzPwcRJrI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715760017; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=QME3RTbGMfJpkg4v/+6E8q/97o230nz7+xr7hPnvphQ=; b=c2nnawaN78gUifbMBAbWx8KCsX1+cHxnh9V6VRgHQXNj2OpAYl/CmPnOXszzgHO32HX4HfIFaZs6Au4XS/2fEZD6BjTWk5pG6DPtPRCXlmt4k4a6Yy/QqXxpxCTH+sh2MidFlHFhwkfmeE3p17Txdisrnw/uetY++tNTbpeuCEQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715760017716639.3268040975018; Wed, 15 May 2024 01:00:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79Re-00046k-06; Wed, 15 May 2024 03:53:02 -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 1s79RW-000415-Hx for qemu-devel@nongnu.org; Wed, 15 May 2024 03:52:54 -0400 Received: from mail-lj1-x236.google.com ([2a00:1450:4864:20::236]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s79RT-0001XQ-8J for qemu-devel@nongnu.org; Wed, 15 May 2024 03:52:53 -0400 Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2e0a34b2899so97510901fa.3 for ; Wed, 15 May 2024 00:52:50 -0700 (PDT) Received: from stoup.. ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm222611855e9.37.2024.05.15.00.52.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:52:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715759569; x=1716364369; 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=QME3RTbGMfJpkg4v/+6E8q/97o230nz7+xr7hPnvphQ=; b=XyJmGYikq8NllYveg6JSEmxlHiAdvHe6bRZmada2p1ABnQtNXo0SjNOuOk5WzIzaa/ sq5UDyWagokT8fkPPDV9lyeKsmfmFpUr2C746znPuJ9uE8kKrGyaYoTc1LCRMhjJY8xG apdRvn1z7oJP7+KQlwCV5nkiQkFKJglZMLyc4+sTbR/RugEzS9+IaIZw4jUqtxVUbdsc jXI6iOe23qgqWSTrRtbzqnoMz4G2H2guQIFxKYQnqWqxVFFbqDCYb5uCAd6pxYmQ/jpF 2pBju+mPMgW5LkfDITZBONI/oXxrakmqC5UWZH2dsn3frbko4AGGSReCmuQ7loIahe+a WPmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759569; x=1716364369; 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=QME3RTbGMfJpkg4v/+6E8q/97o230nz7+xr7hPnvphQ=; b=Eh0q9m5fVePi3E6AIYrca6gClDndE+mXk6Nc7gn8K+mtksnkGWs+G0z3x/BhkWPeyx dHMiRphxlTAqckEbRZcbXSXzAyC5jTYRxXkfUlFmipBGSyOO5FxuROegLHL7ELxlGDzq qBULSsBkzHJPN7uE6qGV9Wsk9jou7fz7g3wzOdX5LJyu+N3+UPJRPei+/nsYENBQPHs7 UbrBYSaMn8014PGC7OaWQRANzN6+GISVWZo7JgE8jhU6Nfx6ieeE9sxvooHS4Y1duABw UI7nXb1FUUiN2PwXgbxrMiaXQ2bKmirReEuoaHBq9ToTBLoOZf+KrD9Wjz+EUShPVC1+ 4SLg== X-Gm-Message-State: AOJu0Yx+YaocWEXDPmqDmLZT2OMPwaxBiGpP/YKwhU7wl5a/mvs3HOEj iawuM/Y6LVR/GmBK5jpN9Mt7WYAg7iYYXeYPUFJ7tXM0czbQMYM6jAmR9J/mcQZJHBm6SJtqWIX n7oc= X-Google-Smtp-Source: AGHT+IF5bwlXz4KQbyyGmKF89FVki54N0Nv8Ca94cWHDc7eGZi0xwUYAwzLoeg+0TMQIq1N9CLfmtw== X-Received: by 2002:a2e:905a:0:b0:2e0:4216:6fa8 with SMTP id 38308e7fff4ca-2e5203b421emr140198451fa.39.1715759569222; Wed, 15 May 2024 00:52:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 01/34] accel/tcg: Use vaddr in translator_ld* Date: Wed, 15 May 2024 09:52:14 +0200 Message-Id: <20240515075247.68024-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075247.68024-1-richard.henderson@linaro.org> References: <20240515075247.68024-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::236; envelope-from=richard.henderson@linaro.org; helo=mail-lj1-x236.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715760018286100020 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- include/exec/translator.h | 21 +++++++++------------ accel/tcg/translator.c | 15 ++++++++------- target/hexagon/translate.c | 1 + target/microblaze/translate.c | 1 + 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/include/exec/translator.h b/include/exec/translator.h index 6cd937ac5c..51489c181c 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -19,10 +19,7 @@ */ =20 #include "qemu/bswap.h" -#include "exec/cpu-common.h" -#include "exec/cpu-defs.h" -#include "exec/abi_ptr.h" -#include "cpu.h" +#include "exec/vaddr.h" =20 /** * gen_intermediate_code @@ -185,14 +182,14 @@ bool translator_io_start(DisasContextBase *db); * the relevant information at translation time. */ =20 -uint8_t translator_ldub(CPUArchState *env, DisasContextBase *db, abi_ptr p= c); -uint16_t translator_lduw(CPUArchState *env, DisasContextBase *db, abi_ptr = pc); -uint32_t translator_ldl(CPUArchState *env, DisasContextBase *db, abi_ptr p= c); -uint64_t translator_ldq(CPUArchState *env, DisasContextBase *db, abi_ptr p= c); +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); =20 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 =3D translator_lduw(env, db, pc); if (do_swap) { @@ -203,7 +200,7 @@ translator_lduw_swap(CPUArchState *env, DisasContextBas= e *db, =20 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 =3D translator_ldl(env, db, pc); if (do_swap) { @@ -214,7 +211,7 @@ translator_ldl_swap(CPUArchState *env, DisasContextBase= *db, =20 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 =3D translator_ldq(env, db, pc); if (do_swap) { @@ -233,7 +230,7 @@ translator_ldq_swap(CPUArchState *env, DisasContextBase= *db, * re-synthesised for s390x "ex"). It ensures we update other areas of * the translator with details of the executed instruction. */ -void translator_fake_ldb(uint8_t insn8, abi_ptr pc); +void translator_fake_ldb(uint8_t insn8, vaddr pc); =20 /* * 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 6832e55135..53225290b1 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -14,6 +14,7 @@ #include "exec/translator.h" #include "exec/cpu_ldst.h" #include "exec/plugin-gen.h" +#include "exec/cpu_ldst.h" #include "tcg/tcg-op-common.h" #include "internal-target.h" =20 @@ -294,11 +295,11 @@ static void *translator_access(CPUArchState *env, Dis= asContextBase *db, return host + (pc - base); } =20 -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 =3D tcg_ctx->plugin_insn; - abi_ptr off; + size_t off; =20 if (insn =3D=3D NULL) { return; @@ -315,7 +316,7 @@ static void plugin_insn_append(abi_ptr pc, const void *= from, size_t size) #endif } =20 -uint8_t translator_ldub(CPUArchState *env, DisasContextBase *db, abi_ptr p= c) +uint8_t translator_ldub(CPUArchState *env, DisasContextBase *db, vaddr pc) { uint8_t ret; void *p =3D translator_access(env, db, pc, sizeof(ret)); @@ -329,7 +330,7 @@ uint8_t translator_ldub(CPUArchState *env, DisasContext= Base *db, abi_ptr pc) return ret; } =20 -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 =3D translator_access(env, db, pc, sizeof(ret)); @@ -344,7 +345,7 @@ uint16_t translator_lduw(CPUArchState *env, DisasContex= tBase *db, abi_ptr pc) return ret; } =20 -uint32_t translator_ldl(CPUArchState *env, DisasContextBase *db, abi_ptr p= c) +uint32_t translator_ldl(CPUArchState *env, DisasContextBase *db, vaddr pc) { uint32_t ret, plug; void *p =3D translator_access(env, db, pc, sizeof(ret)); @@ -359,7 +360,7 @@ uint32_t translator_ldl(CPUArchState *env, DisasContext= Base *db, abi_ptr pc) return ret; } =20 -uint64_t translator_ldq(CPUArchState *env, DisasContextBase *db, abi_ptr p= c) +uint64_t translator_ldq(CPUArchState *env, DisasContextBase *db, vaddr pc) { uint64_t ret, plug; void *p =3D translator_access(env, db, pc, sizeof(ret)); @@ -374,7 +375,7 @@ uint64_t translator_ldq(CPUArchState *env, DisasContext= Base *db, abi_ptr pc) return ret; } =20 -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 0904dc2d38..fcba82f7dc 100644 --- a/target/hexagon/translate.c +++ b/target/hexagon/translate.c @@ -25,6 +25,7 @@ #include "exec/translation-block.h" #include "exec/cpu_ldst.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 6d89c1a175..84cca04962 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -26,6 +26,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" =20 --=20 2.34.1 From nobody Mon Nov 25 09:55:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715759653; cv=none; d=zohomail.com; s=zohoarc; b=jJgmJHwF/EuIlFi3rdHmiT5S9Mh2V+t8F0aXJ31y7IO+ldY74Q9Wh3+caOvIqL3rn569JBx5DPRUamipbQvUdlTiLH+N/83BTsVlnlP78HHi42hW1JGC1punLgN7kuICcvlivLpXxkd26QZps2UYkb/oYaEpizqxtPj8931+zNc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715759653; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=B1bT30jWis5RNXLNoiGpiK9Xlgt7r4X1awl1+hpB8zY=; b=FhZ5FscnQiJsx9+7GK8dT546UaU7V4nEFM0pS67ZSCVzhiToDyMOJurOAhDadEuZJtZrzMhX+MXZ8bjTn0hBiX0gOgIIkliuE3t2LVuuuL3M17GwX0+JpUlMVNA9x6PnQ1Vpa9WVcKKN6YdcbykcQzLrkXDJUnj9pbHeBFDmGXo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715759653095738.9621601387364; Wed, 15 May 2024 00:54:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79RY-00043H-Sc; Wed, 15 May 2024 03:52:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s79RW-00040j-2J for qemu-devel@nongnu.org; Wed, 15 May 2024 03:52:54 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s79RU-0001XY-Ct for qemu-devel@nongnu.org; Wed, 15 May 2024 03:52:53 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-41ffad242c8so34398895e9.3 for ; Wed, 15 May 2024 00:52:51 -0700 (PDT) Received: from stoup.. ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm222611855e9.37.2024.05.15.00.52.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:52:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715759570; x=1716364370; 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=B1bT30jWis5RNXLNoiGpiK9Xlgt7r4X1awl1+hpB8zY=; b=yplCe7JbWnPJdsuOFXOMEIsGxXnjFM4+QOd7/LCe9ijMU9qIpkA3FUTQHMCQW+j33y aSo7GTP9ffAoWeyn9AuxGnoSjS6XdI4QR8m8b9zREiMXCN/F6IMmExcEot6Q8Fd6Vl0e by9RK+5poqpcja7O3fLwfzTulW4A+qK1+UlHdSVfAGSrz46KMm9ZiX4uUurtM0ya5561 HtJpFK8MW3zBOYUNd+U0W+fnaptGzfn0vrJ76xewqQCsrF7KenrQcHQby4nDgdpZzPHr UReCLrP+1wVzK1k/Mz+BQ+h0fTJ4O76IUdhY9ZFU9GAfzXJoxIysoNcfJ78LLOJvvPXp AE2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759570; x=1716364370; 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=B1bT30jWis5RNXLNoiGpiK9Xlgt7r4X1awl1+hpB8zY=; b=V/lwgEIrSRrF4fM+u+yvJ0S9XGCrPghcA8N5nfh5EnYy0MoDHbIixRB0i9Kj8Dbi4P gat7eKyhlId7xXbTVzkxDbbP/HGkAEhS+YthQcGLALleYAKYmLN33mKgjrq90GHPTu9D pe7Z6SKEvvXe2hCvDVmAlvmTnhDOil9LWgYODhomiLQs7VPh4YZlmuvllatU+l5+AaMt VQ79fE1UfMl4Rh0uHc0Omh8s610pevQjZP82O5SokftPVZdew6fvEG71k5c0xn9fRME5 lrb9N6wER5Y3G6CVHh50UPHiMnSoKyF+RVzTu6lQJqC8Et1aOHgP4MV36Qyo3L/ZS3qo OC6Q== X-Gm-Message-State: AOJu0YwExiwmqZXGAOD6XfbH3QFIIR5boenju++h+nghbHTFmkb17OO7 zL+9vml1rl5JIUy5eCrgYmfngNvnYmKpWzVmQuYliziltN1/GQHBnuGa9TSrYH4egPUuYlNol5T +p6c= X-Google-Smtp-Source: AGHT+IH7tcxYZB5nzEFXg+irH+sl2SY9hRnIfUaQLVlQkfpgvzKVy1aLJKwDo1JJGOB89FT/y+1sfw== X-Received: by 2002:a05:600c:5490:b0:420:1aba:5030 with SMTP id 5b1f17b1804b1-4201aba51c4mr53125065e9.41.1715759569803; Wed, 15 May 2024 00:52:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 02/34] accel/tcg: Hide in_same_page outside of a target-specific context Date: Wed, 15 May 2024 09:52:15 +0200 Message-Id: <20240515075247.68024-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075247.68024-1-richard.henderson@linaro.org> References: <20240515075247.68024-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x336.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715759654739100003 While there are other methods that could be used to replace TARGET_PAGE_MASK, the function is not really required outside the context of target-specific translation. This makes the header usable by target independent code. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- include/exec/translator.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/exec/translator.h b/include/exec/translator.h index 51489c181c..212362f5a0 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -232,6 +232,7 @@ translator_ldq_swap(CPUArchState *env, DisasContextBase= *db, */ void translator_fake_ldb(uint8_t insn8, vaddr pc); =20 +#ifdef COMPILING_PER_TARGET /* * Return whether addr is on the same page as where disassembly started. * Translators can use this to enforce the rule that only single-insn @@ -241,5 +242,6 @@ static inline bool is_same_page(const DisasContextBase = *db, vaddr addr) { return ((addr ^ db->pc_first) & TARGET_PAGE_MASK) =3D=3D 0; } +#endif =20 #endif /* EXEC__TRANSLATOR_H */ --=20 2.34.1 From nobody Mon Nov 25 09:55:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715759668; cv=none; d=zohomail.com; s=zohoarc; b=VWBzvwh4OG6faKdEDSZ1oddYTq0njY1YBJrkoE02/hHdhRlpRMvrYxFUnaA+Hfi/+poSaZPtoaYaaDovOPqx1Gs2ZfBLafx8xvcFcFZnmQhFa/+tiNyE2Iv0jN6Cm+3WvOpxQbtkU9nrWMTPJy8haoX+Di3K0IWrsd8GtgXAfWk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715759668; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Z538Yc8eAgdGOVrA7CuXrxetPsi8c98l/ZVNOYY/ekc=; b=JjFfUWHLcobuP4kUIVan7/mYVWqNxrOEqIcageu9kxOtpVF/jIAkFJQCJxBUwGUyk7EbTgoAartYTUq7Tk3eGQfKRr3jHqWG6IvYcupziHjqV0d/frD1AvXsSiRaY0cPZyds8rcPdEtV/k3lOt92DDeRSvhJkcA7ll4d/v3LYZ0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17157596680871009.4090184004637; Wed, 15 May 2024 00:54:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79Rc-00044k-Ad; Wed, 15 May 2024 03:53:00 -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 1s79RW-000416-IJ for qemu-devel@nongnu.org; Wed, 15 May 2024 03:52:54 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s79RU-0001Xg-Cv for qemu-devel@nongnu.org; Wed, 15 May 2024 03:52:53 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-420180b59b7so19010495e9.0 for ; Wed, 15 May 2024 00:52:51 -0700 (PDT) Received: from stoup.. ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm222611855e9.37.2024.05.15.00.52.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:52:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715759570; x=1716364370; 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=Z538Yc8eAgdGOVrA7CuXrxetPsi8c98l/ZVNOYY/ekc=; b=rbIGEI0skirPterv4lC1c/VgpG+Stm1r7anoDncO/nrsE08PVyL3Sn3HR69kbTqtRW Vh7MN45bEk52eGXqtKBvvRAap0N4eaSaEXg7IXDZMbx3OZH5Uvrrv/tXxuZeH6xWdPvL v7GsJ/9zF/MA/SV6IROanLELuWnXmdXB0uPh4+iH8S08LbhjRCG1jWHhZwmIio308Nms bER55cGB9Mx3L0d3zr4c10kfFpbVwoxDFFK8xuSBFjQepPWmlnx33uGOFuxh00wRYscx Lncv/XafPQPSC13Ja1yrNPYEsAhUroJeaMCeFKMmNZ1nGLt1uiQTIRD6JgxXjGRCr/mE UIUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759570; x=1716364370; 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=Z538Yc8eAgdGOVrA7CuXrxetPsi8c98l/ZVNOYY/ekc=; b=AQkH9PbLLSGetfGCOROJGdFfP4/VQ2PWIbJmFpV3ezHy5bsYy0YlYqgPrTd/nLCIsF pjOc+gJ7SRDbwhTTI7Yh+IFhF8Ex1YT3BlOLNsITJJmf40UdRlb/vFoOljdJoDUrP9TS CR1thv9y2fYuR6MVHHAdyvcfLRlgbgPgycZ81OgDIU67hRj8IiMqNq8cOdsgAnulDYi/ qt3yMKTAMJAnNzq+f3stMb6eozfowk3F7EhhGPT3XSQ+mmMaIj/Em1dvsgSZ+axe4qE5 IChDZV+Sa4E31FlWolCdLEC5K3jfkZR75nmvOJQyEqkW1SjPFGqkSl4/M5M57Lpl+hQA 2/Rg== X-Gm-Message-State: AOJu0YyKvJGAFqq8ODYcBlxAcLVHKpxYJsiBnMbaetOELZ5gvD74M1nr EUqjq9Jnv6V6jYdlKZjkibgmKTGIERfWpc508ZJh8ssoj2Nq6ozbyfDjTuCQ4Dc5NviVOe8ZTiZ n1gQ= X-Google-Smtp-Source: AGHT+IG1U6YTY8AVHQlYaO5GHa5ARMrKpCDIDiNT40r+epYIN7BXehIIWzWY1KmPeSNuGZxDZ/jV7Q== X-Received: by 2002:a05:600c:4752:b0:41b:fc7a:e7ee with SMTP id 5b1f17b1804b1-41fea539719mr111013675e9.0.1715759570310; Wed, 15 May 2024 00:52:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 03/34] accel/tcg: Pass DisasContextBase to translator_fake_ldb Date: Wed, 15 May 2024 09:52:16 +0200 Message-Id: <20240515075247.68024-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075247.68024-1-richard.henderson@linaro.org> References: <20240515075247.68024-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x332.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715759668792100001 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- include/exec/translator.h | 5 +++-- accel/tcg/translator.c | 2 +- target/s390x/tcg/translate.c | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/exec/translator.h b/include/exec/translator.h index 212362f5a0..348985c3a3 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -222,15 +222,16 @@ translator_ldq_swap(CPUArchState *env, DisasContextBa= se *db, =20 /** * 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); =20 #ifdef COMPILING_PER_TARGET /* diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 53225290b1..3456455fa5 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -375,7 +375,7 @@ uint64_t translator_ldq(CPUArchState *env, DisasContext= Base *db, vaddr pc) return ret; } =20 -void translator_fake_ldb(uint8_t insn8, vaddr pc) +void translator_fake_ldb(DisasContextBase *db, vaddr pc, uint8_t insn8) { plugin_insn_append(pc, &insn8, sizeof(insn8)); } diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index 90a74ee795..6d7f6e7064 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -6203,7 +6203,7 @@ static const DisasInsn *extract_insn(CPUS390XState *e= nv, DisasContext *s) /* Register insn bytes with translator so plugins work. */ for (int i =3D 0; i < ilen; i++) { uint8_t byte =3D extract64(insn, 56 - (i * 8), 8); - translator_fake_ldb(byte, pc + i); + translator_fake_ldb(&s->base, pc + i, byte); } op =3D insn >> 56; } else { --=20 2.34.1 From nobody Mon Nov 25 09:55:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715759611; cv=none; d=zohomail.com; s=zohoarc; b=hGg1BYSF1yp5QKAs9N6p0Dx4NL+YL/pRQxV1zOAySsNaArdKa4rDDtcXl4Yb5Rg0u2diS/2EHUnRYFbzTmTH2MkMi8VPq3WDSqtAu6ey1UWN+2d2RfWE4keLaW/BDW/aQPppwaQex1w1+hf8UbhXEgphJDvajpTZHZuab7a/JgE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715759611; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=4nDvS6RxjvEh929vNeT9BpypBMUhGJI6gnrhoY//llg=; b=jehpiix0I2JdrXd7yrfrofogE5drTLHz/D+ettW+ypMNl1M6gOtm/sv9aM94TXBDQmtigLH4vD8yanPf15x92n9n/qfvstuIO63jbit+w3+00qoYlopDlZueFZ63+jKTNWRCywyn+0ii7wmZL9qGYXq5k/fHGpBel8S4KTUB0HA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715759611964503.8752073567589; Wed, 15 May 2024 00:53:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79Rd-00046V-OL; Wed, 15 May 2024 03:53:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s79RW-00041N-Sl for qemu-devel@nongnu.org; Wed, 15 May 2024 03:52:55 -0400 Received: from mail-lj1-x232.google.com ([2a00:1450:4864:20::232]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s79RU-0001Xp-ME for qemu-devel@nongnu.org; Wed, 15 May 2024 03:52:54 -0400 Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2e538a264f7so68215321fa.0 for ; Wed, 15 May 2024 00:52:52 -0700 (PDT) Received: from stoup.. ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm222611855e9.37.2024.05.15.00.52.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:52:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715759571; x=1716364371; 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=4nDvS6RxjvEh929vNeT9BpypBMUhGJI6gnrhoY//llg=; b=cTiK2d+fff/hFMRQq4Owupu1qePYqLIVxwRv+fCf6T2XVymtgCfQfdQCY4pf06nPtm +SnPbkaHrP4rXiwazwsWkAnT6o+8ssWi7Vs31sks3qOUUgy0UOOIdsD3uP9sPMPVFfkf q/kd3zpUeoW7mJR1slgKY83AqNk4StAvseTKPk0X0325Uh+O1KcBB3eTAdC3wcmk0+9P m6wc22TdsvqodtyZWZoP2oq1SzTB2DW6sBKkszxm7SIl3RzCD7gRIGZV+/DGH//4i52W 4luYy3x6K68sb4WUcsSYL6lTymB/xSq0BasmZMSoF1WOKNpWvqlKhvGrPzvGsQb25FrJ MSFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759571; x=1716364371; 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=4nDvS6RxjvEh929vNeT9BpypBMUhGJI6gnrhoY//llg=; b=qA65HHRLTyBfHGVqXcyxLcZEGZ/JbWcDbyxiAopgmZ/DQA61dHkaw7HGlZcaUDbA70 KM6+CK5osFZKaOMtUxakS7QBTPjE3nPoc2cz19IcFLC1IpSJ8vhiuMADChSTB6ljCRl1 XkJaUXN9drx0OY/WIymOpkkQHC1qn/IAcn9RjaeJGkQBdoAh4fEfNh3qeVAvzwwEdy+X Jxks/IyTKe3+t9C+kIwgYxYd/i2cyLKWVwL5TXgzUzznkLAq2sNGmdTS5anKR9I1PnEO oZB/AC73Zgs/HhNMuR4xpRa+mSAQV7QeFhYSJ/j0eTODnNYb6JJdlgeIfl4/J0kTm7eb 5VFg== X-Gm-Message-State: AOJu0YxI//To1VquiYGIVDl0ocyJiKl49nD8fP6F6aBLPFiC3Vu67w1p 70ywJB0wZyaIYlgF8WzaAz8KmvVWnJsI2loiV8xvIytiI7QiiWhZtllzG2wNGtgESAZ2sYLOLiH nGDU= X-Google-Smtp-Source: AGHT+IH4BiYMMXrnkoQy3EkcS2kbJywZnaIQk62N2yQvhwF0R8zhkJgpZ61GTUiJuRxVA8/ioGQbbg== X-Received: by 2002:a2e:9e14:0:b0:2e1:c97b:6f1f with SMTP id 38308e7fff4ca-2e5203a795emr95618661fa.51.1715759570854; Wed, 15 May 2024 00:52:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 04/34] accel/tcg: Reorg translator_ld* Date: Wed, 15 May 2024 09:52:17 +0200 Message-Id: <20240515075247.68024-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075247.68024-1-richard.henderson@linaro.org> References: <20240515075247.68024-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::232; envelope-from=richard.henderson@linaro.org; helo=mail-lj1-x232.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715759612594100002 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. Reviewed-by: Philippe Mathieu-Daud=C3=A9 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 3456455fa5..0848026935 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -230,69 +230,88 @@ void translator_loop(CPUState *cpu, TranslationBlock = *tb, int *max_insns, } } =20 -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 =3D db->tb; + vaddr last =3D pc + len - 1; void *host; - vaddr base, end; - TranslationBlock *tb; - - tb =3D db->tb; + vaddr base; =20 /* Use slow path if first page is MMIO. */ if (unlikely(tb_page_addr0(tb) =3D=3D -1)) { - return NULL; + return false; } =20 - end =3D pc + len - 1; - if (likely(is_same_page(db, end))) { - host =3D db->host_addr[0]; - base =3D db->pc_first; - } else { + host =3D db->host_addr[0]; + base =3D db->pc_first; + + if (likely(((base ^ last) & TARGET_PAGE_MASK) =3D=3D 0)) { + /* Entire read is from the first page. */ + memcpy(dest, host + (pc - base), len); + return true; + } + + if (unlikely(((base ^ pc) & TARGET_PAGE_MASK) =3D=3D 0)) { + /* Read begins on the first page and extends to the second. */ + size_t len0 =3D -(pc | TARGET_PAGE_MASK); + memcpy(dest, host + (pc - base), len0); + pc +=3D len0; + dest +=3D len0; + len -=3D 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 =3D (base & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE; + assert(((base ^ pc) & TARGET_PAGE_MASK) =3D=3D 0); + assert(((base ^ last) & TARGET_PAGE_MASK) =3D=3D 0); + host =3D db->host_addr[1]; + + if (host =3D=3D NULL) { + tb_page_addr_t page0, old_page1, new_page1; + + new_page1 =3D 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 =3D=3D -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 =3D tb_page_addr1(tb); + if (likely(new_page1 !=3D old_page1)) { + page0 =3D tb_page_addr0(tb); + if (unlikely(old_page1 !=3D -1)) { + tb_unlock_page1(page0, old_page1); + } + tb_set_page_addr1(tb, new_page1); + tb_lock_page1(page0, new_page1); + } host =3D db->host_addr[1]; - base =3D TARGET_PAGE_ALIGN(db->pc_first); - if (host =3D=3D NULL) { - tb_page_addr_t page0, old_page1, new_page1; - - new_page1 =3D get_page_addr_code_hostp(env, base, &db->host_ad= dr[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 =3D=3D -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 =3D tb_page_addr1(tb); - if (likely(new_page1 !=3D old_page1)) { - page0 =3D tb_page_addr0(tb); - if (unlikely(old_page1 !=3D -1)) { - tb_unlock_page1(page0, old_page1); - } - tb_set_page_addr1(tb, new_page1); - tb_lock_page1(page0, new_page1); - } - host =3D db->host_addr[1]; - } - - /* Use slow path when crossing pages. */ - if (is_same_page(db, pc)) { - return NULL; - } } =20 - tcg_debug_assert(pc >=3D base); - return host + (pc - base); + memcpy(dest, host + (pc - base), len); + return true; } =20 static void plugin_insn_append(vaddr pc, const void *from, size_t size) @@ -318,61 +337,55 @@ static void plugin_insn_append(vaddr pc, const void *= from, size_t size) =20 uint8_t translator_ldub(CPUArchState *env, DisasContextBase *db, vaddr pc) { - uint8_t ret; - void *p =3D translator_access(env, db, pc, sizeof(ret)); + uint8_t raw; =20 - if (p) { - plugin_insn_append(pc, p, sizeof(ret)); - return ldub_p(p); + if (!translator_ld(env, db, &raw, pc, sizeof(raw))) { + raw =3D cpu_ldub_code(env, pc); } - ret =3D cpu_ldub_code(env, pc); - plugin_insn_append(pc, &ret, sizeof(ret)); - return ret; + plugin_insn_append(pc, &raw, sizeof(raw)); + return raw; } =20 uint16_t translator_lduw(CPUArchState *env, DisasContextBase *db, vaddr pc) { - uint16_t ret, plug; - void *p =3D translator_access(env, db, pc, sizeof(ret)); + uint16_t raw, tgt; =20 - if (p) { - plugin_insn_append(pc, p, sizeof(ret)); - return lduw_p(p); + if (translator_ld(env, db, &raw, pc, sizeof(raw))) { + tgt =3D tswap16(raw); + } else { + tgt =3D cpu_lduw_code(env, pc); + raw =3D tswap16(tgt); } - ret =3D cpu_lduw_code(env, pc); - plug =3D tswap16(ret); - plugin_insn_append(pc, &plug, sizeof(ret)); - return ret; + plugin_insn_append(pc, &raw, sizeof(raw)); + return tgt; } =20 uint32_t translator_ldl(CPUArchState *env, DisasContextBase *db, vaddr pc) { - uint32_t ret, plug; - void *p =3D translator_access(env, db, pc, sizeof(ret)); + uint32_t raw, tgt; =20 - if (p) { - plugin_insn_append(pc, p, sizeof(ret)); - return ldl_p(p); + if (translator_ld(env, db, &raw, pc, sizeof(raw))) { + tgt =3D tswap32(raw); + } else { + tgt =3D cpu_ldl_code(env, pc); + raw =3D tswap32(tgt); } - ret =3D cpu_ldl_code(env, pc); - plug =3D tswap32(ret); - plugin_insn_append(pc, &plug, sizeof(ret)); - return ret; + plugin_insn_append(pc, &raw, sizeof(raw)); + return tgt; } =20 uint64_t translator_ldq(CPUArchState *env, DisasContextBase *db, vaddr pc) { - uint64_t ret, plug; - void *p =3D translator_access(env, db, pc, sizeof(ret)); + uint64_t raw, tgt; =20 - if (p) { - plugin_insn_append(pc, p, sizeof(ret)); - return ldq_p(p); + if (translator_ld(env, db, &raw, pc, sizeof(raw))) { + tgt =3D tswap64(raw); + } else { + tgt =3D cpu_ldq_code(env, pc); + raw =3D tswap64(tgt); } - ret =3D cpu_ldq_code(env, pc); - plug =3D tswap64(ret); - plugin_insn_append(pc, &plug, sizeof(ret)); - return ret; + plugin_insn_append(pc, &raw, sizeof(raw)); + return tgt; } =20 void translator_fake_ldb(DisasContextBase *db, vaddr pc, uint8_t insn8) --=20 2.34.1 From nobody Mon Nov 25 09:55:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715759727; cv=none; d=zohomail.com; s=zohoarc; b=IUSk8urb3QghTYs8zoZWOGMb+OE7NIRGAX8ZDb25wRGPQOqVrf1v43naDJNaWH4AEZdEqcNhQtMLrDq6Pb4nRskh/zqU1wuGdUhj5WBiJVK58zCzaQ7+pcsr802II7qjl+HjF00vG0JJxq9DznLJItyYdeProGO5zsAqlPlUYq0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715759727; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=jEfUsltW8rumdTfAvGwXpV5AkkGUJRb2ZtYX2v2b8B4=; b=Hg7DDmR3mLsOjchCXFylFMxGIzhwu1+l5syxKphCy7et4pphIAIVC/J+/kxawUBdkwn8CEJnslNyh93aAcsWJgEcfg1wj8pheggvt6aMsLAGFiVLxf5usAn6CdtCvzgI9XsshUagJQfgEZIM/ig6TThW8QHZP0cmc5BJJ4uli34= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715759727495125.97485916523021; Wed, 15 May 2024 00:55:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79Rg-000484-F2; Wed, 15 May 2024 03:53:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s79RZ-000448-Cz for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:00 -0400 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s79RW-0001YN-WB for qemu-devel@nongnu.org; Wed, 15 May 2024 03:52:56 -0400 Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2e0b2ddc5d1so94803901fa.3 for ; Wed, 15 May 2024 00:52:54 -0700 (PDT) Received: from stoup.. ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm222611855e9.37.2024.05.15.00.52.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:52:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715759573; x=1716364373; 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=jEfUsltW8rumdTfAvGwXpV5AkkGUJRb2ZtYX2v2b8B4=; b=BDu0s1/AVAevqwp+t+UuvPkok0WzHr9eUHY7tiYqTL65SD4lcNSql48r2iX3PllbdE yWtfm4uH1q2xXRH7Uf76OFaA5OlCz/T7kvJ7yiEuN8B69RIu9NSDyjNBOf8R5cpL1QS+ XQJWDMio/h7GI7J0GlDw4crowCH3QLJ+n/jJtPdzmjoVPWG5xEAzT14PUYnU4fgrmWkO iXnYaIoWY0NrcSt9ocd7zzuY2aB9SkKo4lKS2YYIVNxIv+qWJk1A/49+pkg5CpikuTeV nKcUy/5l0ajJaazimHN4+BKAw4Ro0cfiI18ij6KGJRmAe1svg/IlRMjBwJ4Nh3CBQhXV YO4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759573; x=1716364373; 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=jEfUsltW8rumdTfAvGwXpV5AkkGUJRb2ZtYX2v2b8B4=; b=lgAqo6UmXTFwEje/9v+8T++QVJub5Dgx0FXiD0qczi18IR+ctpaTwJK4e0YeQo/9Lw j3XA3YJm5iwl2ZmgzFQ/Mg0ix71wg/jVLEOoG8IWNPBMur0bRjlwisWSkwXyU76y2H7N 9+uir+v+XMPNlRQo/4ImLRXoBAXkrun3t/V6fyoq0DumwlxVf903YOLqRL8bIgmZ7gxC veEU570Wfok039xGOkMzN29kI23tOdS1Y8VgJVF7DZKGZ95RRuRAoT1vibxVdNhf61S8 jZLdexHTSjGjCjPZLEqPWXLcx9PzfUZ0pSXDuqZgrpjfsQM88i9K5BZg4pT2J9V+xwUO ++Hw== X-Gm-Message-State: AOJu0Yz8tE6oLVTZqvCIPd5vag1RhszQ69ncFIuraOkZbk+2nAM9a3Gx 10sMAtk4tB+qWi6pGdzqftk57GRgsf8L06u5K1asQIPlCb3rrcLQIFs/DvoFf5d+yD+X7tnPeSl /Y/Y= X-Google-Smtp-Source: AGHT+IGpx0zsiVHEZYxAklJSyQOzWLf/V1V/o75oNS7t2vF+62O8kPdB8RSJgFFFlQEtrofCKP7pNg== X-Received: by 2002:a2e:954d:0:b0:2df:757c:af13 with SMTP id 38308e7fff4ca-2e5203a4670mr96012101fa.40.1715759571496; Wed, 15 May 2024 00:52:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 05/34] accel/tcg: Cap the translation block when we encounter mmio Date: Wed, 15 May 2024 09:52:18 +0200 Message-Id: <20240515075247.68024-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075247.68024-1-richard.henderson@linaro.org> References: <20240515075247.68024-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::22e; envelope-from=richard.henderson@linaro.org; helo=mail-lj1-x22e.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715759729098100015 Do not allow translation to proceed beyond one insn with mmio, as we will not be caching the TranslationBlock. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- accel/tcg/translator.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 0848026935..18138c61e1 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -240,6 +240,8 @@ static bool translator_ld(CPUArchState *env, DisasConte= xtBase *db, =20 /* Use slow path if first page is MMIO. */ if (unlikely(tb_page_addr0(tb) =3D=3D -1)) { + /* We capped translation with first page MMIO in tb_gen_code. */ + tcg_debug_assert(db->max_insns =3D=3D 1); return false; } =20 @@ -288,6 +290,8 @@ static bool translator_ld(CPUArchState *env, DisasConte= xtBase *db, if (unlikely(new_page1 =3D=3D -1)) { tb_unlock_pages(tb); tb_set_page_addr0(tb, -1); + /* Require that this be the final insn. */ + db->max_insns =3D db->num_insns; return false; } =20 --=20 2.34.1 From nobody Mon Nov 25 09:55:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715759726; cv=none; d=zohomail.com; s=zohoarc; b=hexpKmWPVxOkT5x+gQCXd50/48pKyI71aRRrlFlioYfqwHt6axUxued64BvJFf9rEhMu5eAC5Pq5/9WjTskA46fmFx0UvIww3Rhew3BEkcmIqMYT56EZw8kpmcvB4ZvKBxZNUUTAK8WTVLGKemFFgdOwQyZF4ziV7lad+yRY3k0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715759726; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=aHBV7vFxAWndnD846QEnn6hvoRiyYa0vJI3T3k5IEYM=; b=PlyugzwGLhGCa+zXz0WM6RYOe15LrtBrqjG+i7TwPuba8xDUejB8DWFK5y1UCtkfBB0WM2qMVnGw5IqjG0ldv+XGdNjyvFb/GOMstmDaEBtxyFkbDssqkDaeqU+Qj6LlkrqZRtYriUYwxhFb0aYVvToy07WIc0Qu2TrKlLeYXTA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 171575972677496.92254770493946; Wed, 15 May 2024 00:55:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79Rf-00047o-Cw; Wed, 15 May 2024 03:53:03 -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 1s79Ra-00044i-PR for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:00 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450: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 1s79RY-0001Yc-6L for qemu-devel@nongnu.org; Wed, 15 May 2024 03:52:58 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-41fd5dc04f0so41586675e9.0 for ; Wed, 15 May 2024 00:52:55 -0700 (PDT) Received: from stoup.. ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm222611855e9.37.2024.05.15.00.52.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:52:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715759574; x=1716364374; 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=aHBV7vFxAWndnD846QEnn6hvoRiyYa0vJI3T3k5IEYM=; b=HBncV/yU9gRVxpjxNumTFH48o5LIsr4hfQ+zWaB1CfNZ+74VNrPijblIwCuGAmyGdK +uVKQCOYDbifP9QTaiin5clw7yvXyQodnMPIEeHMc4C4Id9tI6Yv+Ucp16u/bAkMH4dJ CPrRwi1/+1I3Uq7T3sLshKXC1Apva39SFHywRIGeX4dGldxMlhDzZwzs4Qg7NmQbF6Tm BKA96rF+vjxO0Mi5PeoXKWK11mEMacF7p6Vh5tVwXwjbmccdAwwZYVL8f4neiEM44TS/ FBdiWiok20W4CKTjItLtDhB0W9FO+trjKSupbLXWUB4ux8Axag3o/rnZv2o6U4VVPxL+ YSWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759574; x=1716364374; 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=aHBV7vFxAWndnD846QEnn6hvoRiyYa0vJI3T3k5IEYM=; b=Pux/K2OELLgzD6f+4KAFEceUTUk1TS5DDL9e29nEGESYObANBKwR9lVaABSIjEx54p UoIb+P+6WlD/fLbS00bHJU9V0UTXJnSEBHuhJ/N/Z+cCJloyV7O6GSfatd/V7j8RqOxc p3qhku4uvPDP9ECEsibWZxsW09qa29cN5HmR9kZU3LsSt+3lhlkKe1PU9xyNPUbyp/FU rR4P48BRrri7Uq/ph28Q86G9sOTVeMlixs+t3cezLwSYsKLW8kgub3ke1vk6MzlOF52f Fmn3ZGilFT/k9/kespsk82hVTkbkU3xN8DVIPllm4TnsEXzTN9VkM5mn+813lX+SrDEX 0Wyw== X-Gm-Message-State: AOJu0YxRng1iD68KXhb78a+/ln6TvXqXqV6SZwr9l5OMOhXarfGtQ/YQ /8abCcQa5dGEd16X5ZueOo0OaZkexJlxN224d3To3tRYiQN04lirqPuI/mwkOH0Bh8ltK5jNZIk 9BOc= X-Google-Smtp-Source: AGHT+IFSwlp4fkHioTMh8wCKKhD6fvCPeU+VWB+QFLijcj5wqOJcBQwImd7VlyxdxwcGSYeYnA5UPg== X-Received: by 2002:a05:600c:4f0c:b0:420:1f0f:fe19 with SMTP id 5b1f17b1804b1-4201f0fff56mr51343725e9.13.1715759574108; Wed, 15 May 2024 00:52:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 06/34] accel/tcg: Record mmio bytes during translation Date: Wed, 15 May 2024 09:52:19 +0200 Message-Id: <20240515075247.68024-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075247.68024-1-richard.henderson@linaro.org> References: <20240515075247.68024-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715759727060100001 This will be able to replace plugin_insn_append, and will be usable for disassembly. Reviewed-by: Philippe Mathieu-Daud=C3=A9 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 348985c3a3..4a86907ecc 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -90,6 +90,18 @@ typedef struct DisasContextBase { bool plugin_enabled; struct TCGOp *insn_start; void *host_addr[2]; + + /* + * Record insn data that we cannot read directly from host memory. + * There are only two reasons we cannot use host memory: + * (1) We are executing from I/O, + * (2) We are executing a synthetic instruction (s390x EX). + * In both cases we need record exactly one instruction, + * and thus the maximum amount of data we record is limited. + */ + int record_start; + int record_len; + uint8_t record[32]; } DisasContextBase; =20 /** diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 18138c61e1..86a1fe17a0 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -132,6 +132,8 @@ void translator_loop(CPUState *cpu, TranslationBlock *t= b, int *max_insns, db->insn_start =3D NULL; db->host_addr[0] =3D host_pc; db->host_addr[1] =3D NULL; + db->record_start =3D 0; + db->record_len =3D 0; =20 ops->init_disas_context(db, cpu); tcg_debug_assert(db->is_jmp =3D=3D DISAS_NEXT); /* no early exit */ @@ -318,6 +320,39 @@ static bool translator_ld(CPUArchState *env, DisasCont= extBase *db, return true; } =20 +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 =3D 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 =3D=3D 0) { + db->record_start =3D offset; + db->record_len =3D size; + } else { + assert(offset =3D=3D db->record_start + db->record_len); + assert(db->record_len + size <=3D sizeof(db->record)); + db->record_len +=3D 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 @@ -345,6 +380,7 @@ uint8_t translator_ldub(CPUArchState *env, DisasContext= Base *db, vaddr pc) =20 if (!translator_ld(env, db, &raw, pc, sizeof(raw))) { raw =3D cpu_ldub_code(env, pc); + record_save(db, pc, &raw, sizeof(raw)); } plugin_insn_append(pc, &raw, sizeof(raw)); return raw; @@ -359,6 +395,7 @@ uint16_t translator_lduw(CPUArchState *env, DisasContex= tBase *db, vaddr pc) } else { tgt =3D cpu_lduw_code(env, pc); raw =3D tswap16(tgt); + record_save(db, pc, &raw, sizeof(raw)); } plugin_insn_append(pc, &raw, sizeof(raw)); return tgt; @@ -373,6 +410,7 @@ uint32_t translator_ldl(CPUArchState *env, DisasContext= Base *db, vaddr pc) } else { tgt =3D cpu_ldl_code(env, pc); raw =3D tswap32(tgt); + record_save(db, pc, &raw, sizeof(raw)); } plugin_insn_append(pc, &raw, sizeof(raw)); return tgt; @@ -387,6 +425,7 @@ uint64_t translator_ldq(CPUArchState *env, DisasContext= Base *db, vaddr pc) } else { tgt =3D cpu_ldq_code(env, pc); raw =3D tswap64(tgt); + record_save(db, pc, &raw, sizeof(raw)); } plugin_insn_append(pc, &raw, sizeof(raw)); return tgt; @@ -394,5 +433,7 @@ uint64_t translator_ldq(CPUArchState *env, DisasContext= Base *db, vaddr pc) =20 void translator_fake_ldb(DisasContextBase *db, vaddr pc, uint8_t insn8) { + assert(pc >=3D db->pc_first); + record_save(db, pc, &insn8, sizeof(insn8)); plugin_insn_append(pc, &insn8, sizeof(insn8)); } --=20 2.34.1 From nobody Mon Nov 25 09:55:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715759861; cv=none; d=zohomail.com; s=zohoarc; b=G0NAjF3thzXjBbpd1vQS26WXcv8kPnp/j33tBiHU8pM91xgk4e+2//XsuE7FKnDgrsjV2BxIu8OcbCT8NB8vLEm8f54ksArnRgxvhZRf+wG2XjvZ+PvOhxlxRYBb7SgAeIOjSjYMhSjBxN+TED3BradTYSwtkjKqn1pdLAuQcAs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715759861; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=oqU8ItNdi4m1XZTYvDwRO0vv7Nr1dGEj2Szzh23jUJo=; b=ZdgbK8+8yxT+QvV9/p0ue0YB4f5ugGsejd9q99KT9eLBf8nqJ7djf7aTdX/NtgzY2HqU0J25Kw08yYUsUItX9BhFU7G2Aw6PZrq+jJh6r0xKJeTykgu0XDat6uGnMYooGJSauaCMCnds26w2h1yRgavucB0YjATHC2cxEsSqQos= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715759861436393.7128429145439; Wed, 15 May 2024 00:57:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79Rk-0004B6-7A; Wed, 15 May 2024 03:53:08 -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 1s79Rb-00044o-Hq for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:00 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s79RZ-0001Yr-5s for qemu-devel@nongnu.org; Wed, 15 May 2024 03:52:59 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-41ffad2426eso48853725e9.3 for ; Wed, 15 May 2024 00:52:55 -0700 (PDT) Received: from stoup.. ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm222611855e9.37.2024.05.15.00.52.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:52:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715759574; x=1716364374; 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=oqU8ItNdi4m1XZTYvDwRO0vv7Nr1dGEj2Szzh23jUJo=; b=oJ1tXAq1cmxTT+P3SsDtAGK7w69uZvAZqT5xlZn2XaXMGkU0W+1Dgm53Nm9MUSC1w6 oxQKE1ybxaDfGmrkGYhji1XUQz09lqs2JBxwzrRzIdtAXQBku8FYkjNhyT7+84z3Zl8d I2B+rMaV0j4HHfy/zsGxvCZPEr7Gfp1ah5h7UKr3rI1lxVnKVELeVShxFIP0R64zTJp6 PWUuIiXQfWZGuPbK5uJjQU4ONDB9nENCrp1cA5tTLZbfj5J2N89Ho1h33zHvepWBur67 qzg8AA8c/SZfgG9KIpU6ToOWvkt6QfZfcFLqLZCRmmINcoLUi9zLBI2IAP/AZRftCGT8 +QAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759574; x=1716364374; 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=oqU8ItNdi4m1XZTYvDwRO0vv7Nr1dGEj2Szzh23jUJo=; b=J6nnbNOQ9QFSPUPdMLJsmb5m2E4SWkkBrqto+r05/2GujW9htNleGPQUYLwT5NczJm D1Emx7fPVZf6e6HVb+VKuGgMG2FH3njNQCxIQffLNLdEV3sstRpA9wqAdi7e+ct7JxeK rqg94/xfdFjKhyIqF6NUOM+nFStPokk41yUQKAqx+rp52egDR0g/o0SLrqa60zArIwEw CMnrAIJ7F44IXSW2WDPj51OsylpEmoOe0QJ9hVmQs4+KGf+rO8n6k4Mmuji06RD+ipID vv+wyXg4iEQR4jTF8kASnFgoNX+BA98jibV8cZOFvao0KsghJLnMXkMwqCmMJ1aJgu0Z 6H9w== X-Gm-Message-State: AOJu0Yxk2QLt80geGmG0PPZhboDIzMuNFAl/sOJQseTVfY7JXH7V4FDT wPuVprZ7pJqvSzqklt1DVRvJmEfZ4z1M/ZGTtRlYSe6R+FJgaXs9Vn9gOkt+gUvVwLznCnGv3UR M1v4= X-Google-Smtp-Source: AGHT+IHEbxIPwdrzJMO9q2gwXYeDQd77ATDKAt6/xn1pjSBHJAuyqRGE3BptY36EBAWgEuYAQt2XUQ== X-Received: by 2002:a05:600c:444e:b0:41b:e244:164a with SMTP id 5b1f17b1804b1-41fea9324cemr156127495e9.6.1715759574662; Wed, 15 May 2024 00:52:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 07/34] accel/tcg: Record when translator_fake_ldb is used Date: Wed, 15 May 2024 09:52:20 +0200 Message-Id: <20240515075247.68024-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075247.68024-1-richard.henderson@linaro.org> References: <20240515075247.68024-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x329.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715759861633100005 Remove left-over comment from commit dcd092a063 ("accel/tcg: Improve can_do_io management"). Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- include/exec/translator.h | 3 ++- accel/tcg/translator.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/exec/translator.h b/include/exec/translator.h index 4a86907ecc..70cef2c0be 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -72,8 +72,8 @@ typedef enum DisasJumpType { * @num_insns: Number of translated instructions (including current). * @max_insns: Maximum number of instructions to be translated in this TB. * @singlestep_enabled: "Hardware" single stepping enabled. - * @saved_can_do_io: Known value of cpu->neg.can_do_io, or -1 for unknown. * @plugin_enabled: TCG plugin enabled in this TB. + * @fake_insn: True if translator_fake_ldb used. * @insn_start: The last op emitted by the insn_start hook, * which is expected to be INDEX_op_insn_start. * @@ -88,6 +88,7 @@ typedef struct DisasContextBase { int max_insns; bool singlestep_enabled; bool plugin_enabled; + bool fake_insn; struct TCGOp *insn_start; void *host_addr[2]; =20 diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 86a1fe17a0..aa9f36aaa0 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -130,6 +130,7 @@ void translator_loop(CPUState *cpu, TranslationBlock *t= b, int *max_insns, db->max_insns =3D *max_insns; db->singlestep_enabled =3D cflags & CF_SINGLE_STEP; db->insn_start =3D NULL; + db->fake_insn =3D false; db->host_addr[0] =3D host_pc; db->host_addr[1] =3D NULL; db->record_start =3D 0; @@ -434,6 +435,7 @@ uint64_t translator_ldq(CPUArchState *env, DisasContext= Base *db, vaddr pc) void translator_fake_ldb(DisasContextBase *db, vaddr pc, uint8_t insn8) { assert(pc >=3D db->pc_first); + db->fake_insn =3D true; record_save(db, pc, &insn8, sizeof(insn8)); plugin_insn_append(pc, &insn8, sizeof(insn8)); } --=20 2.34.1 From nobody Mon Nov 25 09:55:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715759615; cv=none; d=zohomail.com; s=zohoarc; b=WzJtcdV6ykgh4gl9o27n8zq9IA2pfjLn3evlmrDpOyaI8uQRSLAaQ6m53CEM1i9wFawqU/Ivw1+l0sVWXpl056jrreUxR69PFVqplsNlosEPNdlmrXgqJjlUM///e6eCfzTih+IlFmgRmRC5S9auRIddjfYRwVZPXulzIrBkAyY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715759615; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=1Iqnca+HhnCCBvOshaH/DqsUrANLuNbYvwccCz1eMgU=; b=AYn2DoDYPHMs+/uTlzIa9bu2eR9ZJHCaqLjBZi+FO4AjagWWWme2j5LJCd+Iykff9hcjwwfkdWY6+NKFPeOA7YoK6rssaeI0oduCNuGmi3+F28LRtIcFaN4c8Saz2q444rudlZ5eR7/uSqziBJQlxzBtnlKLNsh9yKz5x3aZuuw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715759615779693.5666852168201; Wed, 15 May 2024 00:53:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79Rf-00047b-2n; Wed, 15 May 2024 03:53:03 -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 1s79Rc-000459-9F for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:00 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s79RZ-0001Yx-Vs for qemu-devel@nongnu.org; Wed, 15 May 2024 03:52:59 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-41fc53252ceso45478335e9.0 for ; Wed, 15 May 2024 00:52:56 -0700 (PDT) Received: from stoup.. ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm222611855e9.37.2024.05.15.00.52.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:52:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715759575; x=1716364375; 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=1Iqnca+HhnCCBvOshaH/DqsUrANLuNbYvwccCz1eMgU=; b=ZMbpsqZ/JpCVkNuwB18S4EZkjyaFzI3hd/m0OMxvVKoj+4zwITahTAZwG7e5Q+toEU K6UdNgMnX+cqVRFmMTL1tzDF2odygnkFvb2Rm+wh8EpupJWgZ/sybQ9pjrydJyap2h3S Twsh5bYVlAhtVqZLj/XaQWPfTbyKP5XBR6RDEWHyyRT/TAGUWnSEGQId9kGI24emWZmH 7xtaDWBELcRrjhuwMqEpLLVi7OJZ5a6L29i4mgOwIoJYjavHzz/ARKmhPMACtA4nfN8J f5keGQ/hGlz8dW7Ai+6iPPRbNNFZHkX50GA8nysrHQFkCJcmruiCM2CUU83ThyV/9Fwi v3Hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759575; x=1716364375; 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=1Iqnca+HhnCCBvOshaH/DqsUrANLuNbYvwccCz1eMgU=; b=UWvDpvetA7YFGmDUt5pTMkayqpSUqF7Sfg25odD1ElBel+meRnRh5S+CWOY4aXfmsT hNpRuHOiygTVvjwdpoeYjYZn4hDGheGTOU/DzPYmEtI9PBCrtPoN+POuQkhJagItlbe4 TcqQhiCMhmGtqezafoga3Wo+txTujwCJwfmrxj+/CWcFfOJyTf+EGmdqeih7H3anP6qO kg9BS9vPbQyf/ccFqIPZArKW5JNDcsPJOd5PYKue3ryUl48TPj48UcAK6+GeVTX0Edbv cHUYlwPEdUQkfSAO6BcJzuivBx94zTYGf9iCGnk3+WHxQhwH8Pp6hr3c29SEXtPfiOCW ouPA== X-Gm-Message-State: AOJu0Yx5Usq5Du2gsUzn6CYZ/HolaRVApop2vwe9wub3qoO+ZtVAbpGv HxM11z1EPDi6KB1Dj5R8OIw3sl0BDteifQV6mflgLj6oua3UQ29Csmbi+M39rmBjQDjb1xR/H/k eHw0= X-Google-Smtp-Source: AGHT+IErZClWZ8+m1NNDBmn5mCdS0GibT0sHIu7HWZ2qkQUE6YE95stVMs2AWHBjZrqxaCoWi6rMqg== X-Received: by 2002:a05:600c:3c83:b0:418:ed13:302d with SMTP id 5b1f17b1804b1-41feac55135mr125046055e9.26.1715759575266; Wed, 15 May 2024 00:52:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 08/34] accel/tcg: Record DisasContextBase in tcg_ctx for plugins Date: Wed, 15 May 2024 09:52:21 +0200 Message-Id: <20240515075247.68024-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075247.68024-1-richard.henderson@linaro.org> References: <20240515075247.68024-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x332.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715759616617100001 Reviewed-by: Philippe Mathieu-Daud=C3=A9 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; =20 /* 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 49f5d1c2e4..842da97204 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 DisasCont= extBase *db, tcg_gen_plugin_cb(PLUGIN_GEN_FROM_TB); } =20 + tcg_ctx->plugin_db =3D db; tcg_ctx->plugin_insn =3D NULL; =20 return ret; --=20 2.34.1 From nobody Mon Nov 25 09:55:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715760140; cv=none; d=zohomail.com; s=zohoarc; b=IHL3ZhDLFjxj+4Nkw1kR2N8u5NWXqUf0mWbeOq36wNKy3X8IUafBVFYZG24U3xbxSXIGqhVmaEh8Oxm7ZzwugnU72Z8nMOz0Sn30d90PJswX2+KryqU8pUJyP3bfOkd+EVfYRIF1XJq/tE6fRiAJTOf0DLcv4hzolKhXGhBeitI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715760140; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=CtQK7Z5/e08tg2ZG57AjvcglO+yjRFx9a1dcx4y70SE=; b=fYQ4AgzXyg5TqRFSI6bJ38iQZRDy7TvEnsKyUX0dYTcf8DWS4XF3DErbuZQUzfmpt30aUzXAXnMGgoYd/i75zmB2Qtjzsfi6iDRTRR2znFjresGGezZh/wDaFfkrHNeaBIdqSvthmlYvh9cdrSPBirDmtIlEfXDe9oyqgbmoywM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715760140412229.88902157785412; Wed, 15 May 2024 01:02:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79Rh-00048H-IQ; Wed, 15 May 2024 03:53:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s79Rc-00045A-9X for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:00 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s79RZ-0001ZK-60 for qemu-devel@nongnu.org; Wed, 15 May 2024 03:52:59 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-420180b5898so18897865e9.2 for ; Wed, 15 May 2024 00:52:56 -0700 (PDT) Received: from stoup.. ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm222611855e9.37.2024.05.15.00.52.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:52:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715759576; x=1716364376; 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=CtQK7Z5/e08tg2ZG57AjvcglO+yjRFx9a1dcx4y70SE=; b=IERvbZaenhzUbRe8lCagMk4x/mlhJswv8u1YyHQUqaYWnuZtz1CZEBmaVq+jn1FJKj FAiHgIwazbwQ256YUvVCyLXRryo8VGmc6vXdnlJw+gg998f6+YPArYIop+dOXZF9Dtk3 TUOdcCVZ16fq3UtTt1f5QtyZTm79uVhQK6IANpFeFwAJHrku6Er1D8ccktf+J/a3kobb m3zUzpbtAks2InYhJvh1jbcA6njtyPuQ7HS+pX6dC5szo/C45Rhe+luU6hRWSseinwmx jUFlhxfeOMFKshtnz823BTjrN9ksahns0x2PTfx4w6oaR3Cpz2umjJpaJaDF9vm1Su54 SpNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759576; x=1716364376; 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=CtQK7Z5/e08tg2ZG57AjvcglO+yjRFx9a1dcx4y70SE=; b=p7O8k5szPdUrj1rZsCda4QjKVZkNEYViS57vxxLGklKMpl0JQEuv1fjSDtVJtm/mQ1 2x4PuOfDhbEVQIMatZ9EhF6LfMiLevKm8RMGtY6H2/PMKeWBnsp5kY21joDE7nOKT8zT 4yKbeEKbLEjvLBmJx0Y2myg7SCICbkRsOmSBrLE24s9G5ou7KpI8hhocQym8G1/0iyKI kEdbcm2+mATufg9DnyIG+EWD2AMA7v5zl7bdoY6oVKI7EUm+q7UFN5synh3EJsumL8ni wKNG6eEUofr9MDwq57vcFCzaTEAymR2AaYi9tN3wQPXRcPnWAMq0QUi9RhLJPfRwAscU 4gHA== X-Gm-Message-State: AOJu0YyLZc1m7bcU1UXlxM6yKckIH5RndaTW87U6oimFw686CMmUGXGd zYaWSJ8lJrp1H4Z40vd4CYcurnNruD1Q6CZQvdRqjEIh6NJNE9ohBHvrtMogT71pjmR9YHj3VbL rSh4= X-Google-Smtp-Source: AGHT+IFZDTUoIfvdFaFjiR6wL3uvvuLEhv8DXG7nZiF3Wztz8Ypwh38hbExnnJ2xXbZvX85OgadJJQ== X-Received: by 2002:a05:600c:3108:b0:419:678e:64ce with SMTP id 5b1f17b1804b1-41fead6ae05mr118953635e9.36.1715759575849; Wed, 15 May 2024 00:52:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 09/34] plugins: Copy memory in qemu_plugin_insn_data Date: Wed, 15 May 2024 09:52:22 +0200 Message-Id: <20240515075247.68024-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075247.68024-1-richard.henderson@linaro.org> References: <20240515075247.68024-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x329.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715760140884100001 Instead of returning a host pointer, copy the data into storage provided by the caller. Reviewed-by: Philippe Mathieu-Daud=C3=A9 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; =20 extern QEMU_PLUGIN_EXPORT int qemu_plugin_version; =20 -#define QEMU_PLUGIN_VERSION 2 +#define QEMU_PLUGIN_VERSION 3 =20 /** * 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); =20 /** - * 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); =20 /** * 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 q= emu_plugin_tb *tb) NULL); } } else { - uint32_t insn_opcode; - insn_opcode =3D *((uint32_t *)qemu_plugin_insn_data(insn)); + uint32_t insn_opcode =3D 0; + qemu_plugin_insn_data(insn, &insn_opcode, sizeof(insn_opcode)); + char *output =3D g_strdup_printf("0x%"PRIx64", 0x%"PRIx32", \"= %s\"", insn_vaddr, insn_opcode, insn_d= isas); =20 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 =3D NULL; - uint32_t opcode; + uint32_t opcode =3D 0; InsnClassExecCount *class =3D NULL; =20 /* @@ -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 =3D *((uint32_t *)qemu_plugin_insn_data(insn)); + qemu_plugin_insn_data(insn, &opcode, sizeof(opcode)); =20 for (i =3D 0; !cnt && i < class_table_sz; i++) { class =3D &class_table[i]; diff --git a/plugins/api.c b/plugins/api.c index 2144da1fe8..5ff4e9d325 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -216,9 +216,12 @@ qemu_plugin_tb_get_insn(const struct qemu_plugin_tb *t= b, size_t idx) * instruction being translated. */ =20 -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 =3D MIN(len, insn->data->len); + memcpy(dest, insn->data->data, len); + return len; } =20 size_t qemu_plugin_insn_size(const struct qemu_plugin_insn *insn) --=20 2.34.1 From nobody Mon Nov 25 09:55:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715760013; cv=none; d=zohomail.com; s=zohoarc; b=bYZNbA86AG/IQD3e5H664o0jKJ6yWRdDdpXvwegpuSLVB+4F+J9u1sGzEua7xzCqd4GMLxJKdX7FJCOxuqrdi9CMs92EZvoi4WkMgvvImI45b6bZC2Y2kvOtaX73AUb4fPZo0eZ5rivkU+OPxaBlnbzHCYq0rbjqmeVOEtCGzec= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715760013; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=yLGS6fJq+lOqJ3w5Tkv/jajaJfxbK2E7v4a67YW3xHU=; b=AKVIxWscxNs/wspg9Oj1QrJJCoOHphQpFBIHO34rkdu/bhNGfDv7fRstpXFaGBfsyw/rfSj775zn0FJwwowrxPyrqQVltSIo5yGSWkfh65GLMSHLT0vtiNpr774Dl5SLIo9CdfCh2/nTOlCBLD2YQfEpQ5IDrTc7pmFSyLyo6uI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715760013795938.8713833749625; Wed, 15 May 2024 01:00:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79Rt-0004J1-J1; Wed, 15 May 2024 03:53:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s79Rq-0004Gg-FC for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:14 -0400 Received: from mail-lj1-x22f.google.com ([2a00:1450:4864:20::22f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s79Ra-0001ZV-5d for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:13 -0400 Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2e45c0a8360so67668981fa.3 for ; Wed, 15 May 2024 00:52:57 -0700 (PDT) Received: from stoup.. ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm222611855e9.37.2024.05.15.00.52.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:52:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715759576; x=1716364376; 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=yLGS6fJq+lOqJ3w5Tkv/jajaJfxbK2E7v4a67YW3xHU=; b=r+3VOZ2yLERwvK2MBqJLdgUlJlqAndMFnsL39I3vMAWJq5BHL8YL73Ty3mqDwuQkES 0JgBc7aa4IfE4u1+IZAPfELdjhwsXrFfc0/4TXBfCg5cw4FIR5cSderVMt1B973hqycg guwksHBE7n6XuATRMFgQydmCLG4mQk9RPhSc++t1DC4HAQ0WBjbDXM3gHDsTbY6ryaEP h1YO94y4tn0rm9hOEq/XAjcd7i577TWEUkVoebim/NNn8GhIYia0AvaIjHn3kDGXV9aQ Wq8+sjgN3xQcJPVfXFlwBvkIRXRGXFq7GxTiwqu0WtMW8gJfLp5t0pNXvRr959VjW5xJ sNoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759576; x=1716364376; 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=yLGS6fJq+lOqJ3w5Tkv/jajaJfxbK2E7v4a67YW3xHU=; b=k+S9YJvTP4jparah0xKOhEYY/LuUg6j+13kylkGmaNg/gA4vVLx7WpEy2oWHBykvIu HIerYmkPrNgNMFcjqPgVyO0ROcgAjyxKo9tEWOcWWXysbDvubdRMqcYSrhvmg+K/3oZr oVXGMHRGOK/6wnkdq+X7rdvskzrLeaI78zFgc1RDHM0wkw0SVTshIQ7rjgtmkKQtJ0OG xfRlBp8yTYz/+z6Swvle/6g8eqaWG5zCplBbTb6CQw53jzJOvo96lHUf+r5bNhPtUXQB NbRFvpr2G8bFaQjgkf8YoEldrVDNg/LITea/HL5l4dYzA+HaB1Linrm2bUYfdlfq4Pvr Xv7A== X-Gm-Message-State: AOJu0YxHHHgylgiaunKScTug3ERmOLrFTE7Ce4BWS7FgFwgtteb1JC7R xL6ppVo6iVvSc5Rao21tw6j0Q3N7vOxZ/qkm7pgUlfkCP38brtu+YmDfQsYBzEr1G/XOHqUlBRJ M5VU= X-Google-Smtp-Source: AGHT+IEKZISrQwJ9+8PtZGQiHX2bzC5dSs7cFrgeb/zG3tVJgOlRvl1wwK0Lp1L6FAIyuW1Ets59sQ== X-Received: by 2002:a2e:a175:0:b0:2e3:3b4e:43e4 with SMTP id 38308e7fff4ca-2e5204b2ed4mr99294941fa.32.1715759576376; Wed, 15 May 2024 00:52:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 10/34] accel/tcg: Implement translator_st Date: Wed, 15 May 2024 09:52:23 +0200 Message-Id: <20240515075247.68024-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075247.68024-1-richard.henderson@linaro.org> References: <20240515075247.68024-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::22f; envelope-from=richard.henderson@linaro.org; helo=mail-lj1-x22f.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715760014241100004 Copy data out of a completed translation. This will be used for both plugins and disassembly. Reviewed-by: Philippe Mathieu-Daud=C3=A9 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 70cef2c0be..fff857a0cc 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -246,6 +246,29 @@ translator_ldq_swap(CPUArchState *env, DisasContextBas= e *db, */ void translator_fake_ldb(DisasContextBase *db, vaddr pc, uint8_t insn8); =20 +/** + * 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 COMPILING_PER_TARGET /* * 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 aa9f36aaa0..01e1f0977b 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -354,6 +354,61 @@ static void record_save(DisasContextBase *db, vaddr pc, memcpy(db->record + (offset - db->record_start), from, size); } =20 +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 =3D addr - db->pc_first; + offset_end =3D offset + len; + if (offset_end > translator_st_len(db)) { + return false; + } + + if (!db->fake_insn) { + size_t offset_page1 =3D -(db->pc_first | TARGET_PAGE_MASK); + + /* Get all the bytes from the first page. */ + if (db->host_addr[0]) { + if (offset_end <=3D offset_page1) { + memcpy(dest, db->host_addr[0] + offset, len); + return true; + } + if (offset < offset_page1) { + size_t len0 =3D offset_page1 - offset; + memcpy(dest, db->host_addr[0] + offset, len0); + offset +=3D len0; + dest +=3D len0; + } + } + + /* Get any bytes from the second page. */ + if (db->host_addr[1] && offset >=3D offset_page1) { + memcpy(dest, db->host_addr[1] + (offset - offset_page1), + offset_end - offset); + return true; + } + } + + /* Else get recorded bytes. */ + if (db->record_len !=3D 0 && + offset >=3D db->record_start && + offset_end <=3D 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 --=20 2.34.1 From nobody Mon Nov 25 09:55:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715759775; cv=none; d=zohomail.com; s=zohoarc; b=mFam2Efe444XHO8Sp1O2RUegVXQeAjC/ku05UuNJkWhvUhu+5PkFvz+QIcK0VA+0m+7EXtZuxGoJ/9e4BPE5pEE2g1tTVfLCFqWuASPYdz/cGSJ2W1ORTjHVzJVw4cCXgto8bt8mmPLBOzstEprydPPnIEQC03bmroRmmMfunCE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715759775; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=GBtVDB/HuYfnJ/hMo9HZFYBFCYQzVqAd1rDtPXWhcLA=; b=H7ajtPecbBeFyYRbGMamZ0sGi8mtWhemqfWJEIXz0dvYn1GIv38ros+gIVNsB373zaY4whhT3sbBjLnFSdrlwX957KG3iSi47AlZPsyjqryH3xwPCANGNPz23Lyr4iamF9uIrmttcImyExDoMhIWT0xHDHky2IWtK7xl4Qe8BQE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715759775801510.99411791256875; Wed, 15 May 2024 00:56:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79Rt-0004Ic-94; Wed, 15 May 2024 03:53:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s79Ro-0004FW-Fd for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:13 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s79Ra-0001Zc-Bh for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:09 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-4200ee78e56so27942295e9.3 for ; Wed, 15 May 2024 00:52:57 -0700 (PDT) Received: from stoup.. ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm222611855e9.37.2024.05.15.00.52.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:52:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715759577; x=1716364377; 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=GBtVDB/HuYfnJ/hMo9HZFYBFCYQzVqAd1rDtPXWhcLA=; b=fUBy/HMM3UtB5cEwi/FmHGe3nMPn1dseEIiOA+ZouOgwnoy93a7kb8/WXS6dRXbOb0 KGEY/ZmmZICqwWYkQzEbXt0tc4i0pFR7hKpW/MTXgptWHrW6Otiuz2mQ8Z5BkKSe1EyB kh9NkCKT6+m1QRaey8ovjpKBz9OoIk38+aOxfi+hZOoG7cYKgvtTgTlWbO6OcLeZWYac mEFHDPXYENTlwMBi8+4oIvT+sY26Awar4aOZyXOiE13mYXDIoOeBll4dRwUyL24MBipF 2jUa/mvYRk5Fk19inPzaezgEXSMrauZaAzoWfG+FVHF7qbLCjXvuPHsFqCZngVYu6UEu spRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759577; x=1716364377; 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=GBtVDB/HuYfnJ/hMo9HZFYBFCYQzVqAd1rDtPXWhcLA=; b=tL+XOTob98OUDIqZAzxxdNF0JnjyTGK8CgK3o9XFjPIgnGSqjgHq8+g29Kik5AmWgm L9nNNL7qD5sWjsOALECIJdIHyVLXu1JGVQOt0OnPmKUVklfs+YfOdsWnSzWhi2g8cO+g ya4+pibbSpAJP+RE+GMO2f6dmUpAGWC8u3M+O6R6L143X1xXcc9NAHfG9PkcQ/Uegl4O l0ocr695Di2fbJ8im2NuM3Li5HO40rLgfCb20ojx+7cdpnFEC1vq5HrHQ6Yr/PQMka48 gk878frbbGiDWV43pICBeB0l76zSq/K+OWvjXFCN1MXvdPKs1A4V7daWbmWJ7hEyj3C5 KVeA== X-Gm-Message-State: AOJu0YwXLF29124vk0/RMfldqf/rrfibgPee7rjsMoKJT4ZhcdItDk89 Ffn1LRsLoDgPyRW32e2S5Ynppu65XcXqyY2mCMZkfijZ3yBMG1fF8d4I/CrL3mKajbt14B6dFKp scsA= X-Google-Smtp-Source: AGHT+IEX6mGm03RJUFTJH1L46JupByRTBwMubvHEBxkSnhdqFi0aqwCnXmF6DGSOUQd9pRra6QMv6Q== X-Received: by 2002:a05:600c:1914:b0:420:112e:6c1 with SMTP id 5b1f17b1804b1-420112e06d1mr80027025e9.13.1715759576979; Wed, 15 May 2024 00:52:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 11/34] plugins: Use translator_st for qemu_plugin_insn_data Date: Wed, 15 May 2024 09:52:24 +0200 Message-Id: <20240515075247.68024-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075247.68024-1-richard.henderson@linaro.org> References: <20240515075247.68024-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32d.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715759777269100003 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. Reviewed-by: Philippe Mathieu-Daud=C3=A9 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 b535bfd5de..c8dd2c42fa 100644 --- a/include/qemu/plugin.h +++ b/include/qemu/plugin.h @@ -98,11 +98,11 @@ struct qemu_plugin_dyn_cb { =20 /* 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; =20 /* if set, the instruction calls helpers that might access guest memor= y */ @@ -117,18 +117,6 @@ struct qemu_plugin_scoreboard { QLIST_ENTRY(qemu_plugin_scoreboard) entry; }; =20 -/* - * 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 =3D (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 842da97204..716c8ec753 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 DisasC= ontextBase *db) ptb->n =3D n; if (n <=3D ptb->insns->len) { insn =3D g_ptr_array_index(ptb->insns, n - 1); - g_byte_array_set_size(insn->data, 0); } else { assert(n - 1 =3D=3D ptb->insns->len); insn =3D g_new0(struct qemu_plugin_insn, 1); - insn->data =3D g_byte_array_sized_new(4); g_ptr_array_add(ptb->insns, insn); } =20 @@ -389,6 +387,11 @@ void plugin_gen_insn_start(CPUState *cpu, const DisasC= ontextBase *db) =20 void plugin_gen_insn_end(void) { + const DisasContextBase *db =3D tcg_ctx->plugin_db; + struct qemu_plugin_insn *pinsn =3D tcg_ctx->plugin_insn; + + pinsn->len =3D db->fake_insn ? db->record_len : db->pc_next - pinsn->v= addr; + tcg_gen_plugin_cb(PLUGIN_GEN_AFTER_INSN); } =20 diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 01e1f0977b..986045154c 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -409,27 +409,6 @@ bool translator_st(const DisasContextBase *db, void *d= est, return false; } =20 -static void plugin_insn_append(vaddr pc, const void *from, size_t size) -{ -#ifdef CONFIG_PLUGIN - struct qemu_plugin_insn *insn =3D tcg_ctx->plugin_insn; - size_t off; - - if (insn =3D=3D NULL) { - return; - } - off =3D 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 =3D g_byte_array_append(insn->data, from, size); -#endif -} - uint8_t translator_ldub(CPUArchState *env, DisasContextBase *db, vaddr pc) { uint8_t raw; @@ -438,7 +417,6 @@ uint8_t translator_ldub(CPUArchState *env, DisasContext= Base *db, vaddr pc) raw =3D cpu_ldub_code(env, pc); record_save(db, pc, &raw, sizeof(raw)); } - plugin_insn_append(pc, &raw, sizeof(raw)); return raw; } =20 @@ -453,7 +431,6 @@ uint16_t translator_lduw(CPUArchState *env, DisasContex= tBase *db, vaddr pc) raw =3D tswap16(tgt); record_save(db, pc, &raw, sizeof(raw)); } - plugin_insn_append(pc, &raw, sizeof(raw)); return tgt; } =20 @@ -468,7 +445,6 @@ uint32_t translator_ldl(CPUArchState *env, DisasContext= Base *db, vaddr pc) raw =3D tswap32(tgt); record_save(db, pc, &raw, sizeof(raw)); } - plugin_insn_append(pc, &raw, sizeof(raw)); return tgt; } =20 @@ -483,7 +459,6 @@ uint64_t translator_ldq(CPUArchState *env, DisasContext= Base *db, vaddr pc) raw =3D tswap64(tgt); record_save(db, pc, &raw, sizeof(raw)); } - plugin_insn_append(pc, &raw, sizeof(raw)); return tgt; } =20 @@ -492,5 +467,4 @@ void translator_fake_ldb(DisasContextBase *db, vaddr pc= , uint8_t insn8) assert(pc >=3D db->pc_first); db->fake_insn =3D 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 5ff4e9d325..15467acdfd 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -42,6 +42,7 @@ #include "tcg/tcg.h" #include "exec/exec-all.h" #include "exec/gdbstub.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 =3D MIN(len, insn->data->len); - memcpy(dest, insn->data->data, len); - return len; + const DisasContextBase *db =3D tcg_ctx->plugin_db; + + len =3D MIN(len, insn->len); + return translator_st(db, dest, insn->vaddr, len) ? len : 0; } =20 size_t qemu_plugin_insn_size(const struct qemu_plugin_insn *insn) { - return insn->data->len; + return insn->len; } =20 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_i= nsn *insn) char *qemu_plugin_insn_disas(const struct qemu_plugin_insn *insn) { CPUState *cpu =3D current_cpu; - return plugin_disas(cpu, insn->vaddr, insn->data->len); + return plugin_disas(cpu, insn->vaddr, insn->len); } =20 const char *qemu_plugin_insn_symbol(const struct qemu_plugin_insn *insn) diff --git a/tcg/tcg.c b/tcg/tcg.c index d827c6d431..71daa5d268 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 =3D g_new0(struct qemu_plugin_tb, 1); - s->plugin_tb->insns =3D - g_ptr_array_new_with_free_func(qemu_plugin_insn_cleanup_fn); + s->plugin_tb->insns =3D g_ptr_array_new(); #endif } =20 --=20 2.34.1 From nobody Mon Nov 25 09:55:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715759818; cv=none; d=zohomail.com; s=zohoarc; b=QhtRRxLr790EEac3h7oJxvNtQr9/f7zIquHg/OEKOqooBohjRM5P30lINXGhXkIx/Po/ymuKRZv4u3U9L3CcSynKUvfBB1eymDhUuGnVg0fpIq5FgeW74027SSbDhAjOQp/e+n1X0qhKflQLkpmhaG5mIndCdodnmP85vyPdc/M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715759818; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=XkVl83KsOOTJGy2FEx65OPALX7XGIVav7feQhODj4vs=; b=XnHRmf6RQJznnH+pkUeb+ji33rBqG80r/w/hbxRFQNccqoBBvz1ORLL3+KNjJSQf9Wml/fSCuqXoTRMdlmwUcCFoOHCCfD2sB8kXUaW1bUji+f0yHiVRBgKfHfQIu+AYraPcydXWOun4c4OPUBdnYncmq1TNP0DtEBj4VZEAUOE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715759818153293.03519384166725; Wed, 15 May 2024 00:56:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79Rg-000483-BO; Wed, 15 May 2024 03:53:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s79Rd-00046U-IS for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:01 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450: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 1s79Ra-0001Zi-Vm for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:01 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-41dc9c83e57so42159555e9.0 for ; Wed, 15 May 2024 00:52:58 -0700 (PDT) Received: from stoup.. ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm222611855e9.37.2024.05.15.00.52.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:52:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715759577; x=1716364377; 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=XkVl83KsOOTJGy2FEx65OPALX7XGIVav7feQhODj4vs=; b=sPv4zHSI0UDmJOO23daDvuX6i6g+XeTZ40oD/2ejRmjvuwueeYsgmrDtDvVblQWKso Z26xFx0x74UNzb2eMJAu2FeuKs8nLsumaVI8QAOKJ+b8qLIi9KBjmVRx72YSIikHNaJM dNgTB0GA7sx52uQBZJ7l8MBIdeZ47QaN9XTrsIGgscSU0gCKmzX5pLHpUfD70T5UvbuU EPv8uCzHTYARk3wNYNUrTeksnQZEhU5yt5ucVn+xOwXNaT43RE8oTpAEUcryeCLbz69+ NxBLjygod/8tKn27ELcZxaNEfyGEzNZvMGqL6PMK3nF6Q3SOpFPGoiidTNpUd+nqlxyR aL4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759577; x=1716364377; 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=XkVl83KsOOTJGy2FEx65OPALX7XGIVav7feQhODj4vs=; b=WHHfAKOmRrq2xPRAY6dWoHRPpzDyZHusJT8ZVYGvXYKaCQ9LEYef6en+fBs3j8yOSN EyQBBputQVTvIFH2HRsLdn1i8DzG4dYDCyMrsK3F0Uvx7T8Vi53thvUs8RextNcRXmCM rmLgepdmz8ipFrmD5WsIkitczDpTkqtmI2H5IzYCH4dlNSPmK41SnSa32oSxVntUs6oG pKMJN9L8jmmjU7A6LIn+8dFl5G2ERtxvYnCaepRtZcX7dct1/eRWLLQxeJkUVZblhDp1 2S6kqsnWi2bZJbDKrU1lujHf5FtnBA+mN/SMG5KwtwGST08Jgtd/XO3EPASqPLt0vn8V 5CUA== X-Gm-Message-State: AOJu0YyX7bCvqhJ85M152ainz3rIrjJn6W5KKdxBqDehrAoqbelG8qiH 2HhjiUxIRAXeZUWg6rHBfsHKvN9doCd1ZHGfQio+Ez+k80d4jsCsZBU9w2Mxp94mOclTgAlRQpW xE/0= X-Google-Smtp-Source: AGHT+IHFSlAoAFaswa1ww372Yo6XPiu+bS4QFvM80s/7F0diyiUYXHZx8aW9xHAxtaHV8nwXgHfvkw== X-Received: by 2002:a05:600c:4f06:b0:418:2981:c70f with SMTP id 5b1f17b1804b1-41fbcfb8473mr160848025e9.19.1715759577586; Wed, 15 May 2024 00:52:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 12/34] plugins: Read mem_only directly from TB cflags Date: Wed, 15 May 2024 09:52:25 +0200 Message-Id: <20240515075247.68024-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075247.68024-1-richard.henderson@linaro.org> References: <20240515075247.68024-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715759819588100003 Do not pass around a boolean between multiple structures, just read it from the TranslationBlock in the TCGContext. Reviewed-by: Philippe Mathieu-Daud=C3=A9 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; =20 #ifdef CONFIG_PLUGIN =20 -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 *d= b); void plugin_gen_insn_end(void); @@ -28,8 +27,8 @@ void plugin_gen_disable_mem_helpers(void); =20 #else /* !CONFIG_PLUGIN */ =20 -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 c8dd2c42fa..c28d0ca31c 100644 --- a/include/qemu/plugin.h +++ b/include/qemu/plugin.h @@ -107,8 +107,6 @@ struct qemu_plugin_insn { =20 /* if set, the instruction calls helpers that might access guest memor= y */ bool mem_helper; - - bool mem_only; }; =20 /* A scoreboard is an array of values, indexed by vcpu_index */ @@ -125,7 +123,6 @@ struct qemu_plugin_tb { uint64_t vaddr2; void *haddr1; void *haddr2; - bool mem_only; =20 /* 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 716c8ec753..2aa1e08c17 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 *pl= ugin_tb) } } =20 -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 =3D false; =20 @@ -323,7 +322,6 @@ bool plugin_gen_tb_start(CPUState *cpu, const DisasCont= extBase *db, ptb->vaddr2 =3D -1; ptb->haddr1 =3D db->host_addr[0]; ptb->haddr2 =3D NULL; - ptb->mem_only =3D mem_only; ptb->mem_helper =3D false; =20 tcg_gen_plugin_cb(PLUGIN_GEN_FROM_TB); diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 986045154c..157b447810 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -144,7 +144,7 @@ void translator_loop(CPUState *cpu, TranslationBlock *t= b, int *max_insns, ops->tb_start(db, cpu); tcg_debug_assert(db->is_jmp =3D=3D DISAS_NEXT); /* no early exit */ =20 - plugin_enabled =3D plugin_gen_tb_start(cpu, db, cflags & CF_MEMI_ONLY); + plugin_enabled =3D plugin_gen_tb_start(cpu, db); db->plugin_enabled =3D plugin_enabled; =20 while (true) { diff --git a/plugins/api.c b/plugins/api.c index 15467acdfd..9e4aa9d2d9 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); } =20 +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 flag= s, 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_vcp= u( 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 =3D g_ptr_array_index(tb->insns, idx); - insn->mem_only =3D tb->mem_only; return insn; } =20 --=20 2.34.1 From nobody Mon Nov 25 09:55:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715759727; cv=none; d=zohomail.com; s=zohoarc; b=MgRWeUkRdk5x7NmZo4E450v1nLFYb6+0fPduw7zWRT3C3WRCMXUrhDjnhy1Bw83K1ZiPJnLBiaHkM1HBN/+5VLSbWTAfqBuVpTL1A1SE8eThCGx9Vx/RLn5QrKQbRDhtHgLARFu1acbJtDI56dWDcM8UttLB+DfrpzIoFhmUxt8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715759727; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=NHmxyaHJvfTQV6eJCp+0w5/I7rCSGxf4lZPvvgw/PM4=; b=betnmXqxDchsnHfYYodva/jFvliwyTWNtoitGj2dz/CqlbKlBp8VJ+yTyrFRuo6Jgvx2jJu64xZhxR4w3wZRWiyqNZubOy1SvAWOPJcSojBbzKEkkOrz19lKv6zB8WNP201eq0A039y+pk3nABuQhhzgbLk8KPKOEo8uNIK1aCw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715759727346664.9774981660546; Wed, 15 May 2024 00:55:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79Ri-00048u-75; Wed, 15 May 2024 03:53:06 -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 1s79Rd-00046Y-Op for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:01 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s79Rb-0001Zq-DK for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:01 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-41ffad2426eso48854145e9.3 for ; Wed, 15 May 2024 00:52:58 -0700 (PDT) Received: from stoup.. ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm222611855e9.37.2024.05.15.00.52.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:52:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715759578; x=1716364378; 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=NHmxyaHJvfTQV6eJCp+0w5/I7rCSGxf4lZPvvgw/PM4=; b=c1fFZEoZQE131nGH/6H3/4+xJj0Dc750RMzM+AWRkM16s13X0mTdrDCPT/sGHLFXx4 n7H3vvEBpV/yw4XYbbSPrdImo93O/DawUW4vbkyyHsCQEnPm1JHWPobNsu4kLhN+Yu1F RW+R2hxNWTi/5JeuMCMXCtiCnzbNtOpl38rdNiqfma5m0+8yT3EubfY7CPSROb9GWlOy FlxhWI26pVUVn9xlZCsiKc3Gd+jFAJdz/kBrU9q4Bvgevm1a+fKYX00rO72p1q8S4nff M8O4MWdRYjphvR3EVuYl3dv75hxN6G3ErRfBwXRQH5tr70EO/+FoISofilpUbUb30gYz 4F1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759578; x=1716364378; 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=NHmxyaHJvfTQV6eJCp+0w5/I7rCSGxf4lZPvvgw/PM4=; b=c6P07/8CmWKg7ZzfVawyx/lcBBudUzYSVIJVtR+7TcdqYfQcgxs/eSNelNXutKMWCR /ya4QhLqdsOgv7iP7qrjPiTQKyZDG10DbuWcj+8Sy5/tmtY1YiDQO1II+3kJLTgtAuxO 2xx35pSNR6C/a2dvXclI+v7tvfNRRjOdOpuefmCoFckME1Fm1Yua87jpwHqS6tNSKbrZ WExp59LddwiRkG5GWfDiYfhpFQNBNe/1SzeYWY4Wq1/71z15vuR1UZnw7Mii0uT14G0j ujh7awnIChxq3MgtBwRGyOB9XWsA9nuLLPhE6U5tKHrwcdnG9ATdxzxOwNW5Uu4RsRaj r58w== X-Gm-Message-State: AOJu0YwooE6fsqyfd9eelaMA65Ub3J/ZrEcPP+Arjqog5Mi3iIWq2ZCm 1aXTwj3vuqW13JCwRlg9+Rd4vxwRbeVYJID3haAXgX3HpIgJQUPWbRB7Yrza/H8tOvOgznRke44 UYKE= X-Google-Smtp-Source: AGHT+IG0tNk9txYPfj6BPVHxCdb9l+S8B3q1bBM2VCG6HkqqlGqSzG/3t69mtklzATlrXWCN03GO2g== X-Received: by 2002:a05:600c:3548:b0:41a:6edd:6c1d with SMTP id 5b1f17b1804b1-41feac55e10mr130103785e9.32.1715759578121; Wed, 15 May 2024 00:52:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PULL 13/34] plugins: Use DisasContextBase for qemu_plugin_insn_haddr Date: Wed, 15 May 2024 09:52:26 +0200 Message-Id: <20240515075247.68024-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075247.68024-1-richard.henderson@linaro.org> References: <20240515075247.68024-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32d.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715759729099100016 Content-Type: text/plain; charset="utf-8" We can delay the computation of haddr until the plugin actually requests it. Reviewed-by: Pierrick Bouvier 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 c28d0ca31c..da0f37e269 100644 --- a/include/qemu/plugin.h +++ b/include/qemu/plugin.h @@ -99,7 +99,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; @@ -120,9 +119,6 @@ struct qemu_plugin_tb { GPtrArray *insns; size_t n; uint64_t vaddr; - uint64_t vaddr2; - void *haddr1; - void *haddr2; =20 /* 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 2aa1e08c17..c36632e8df 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 DisasCont= extBase *db) ret =3D true; =20 ptb->vaddr =3D db->pc_first; - ptb->vaddr2 =3D -1; - ptb->haddr1 =3D db->host_addr[0]; - ptb->haddr2 =3D NULL; ptb->mem_helper =3D false; =20 tcg_gen_plugin_cb(PLUGIN_GEN_FROM_TB); @@ -363,23 +360,6 @@ void plugin_gen_insn_start(CPUState *cpu, const DisasC= ontextBase *db) pc =3D db->pc_next; insn->vaddr =3D pc; =20 - /* - * Detect page crossing to get the new host address. - * Note that we skip this when haddr1 =3D=3D NULL, e.g. when we're - * fetching instructions from a region not backed by RAM. - */ - if (ptb->haddr1 =3D=3D NULL) { - insn->haddr =3D NULL; - } else if (is_same_page(db, db->pc_next)) { - insn->haddr =3D ptb->haddr1 + pc - ptb->vaddr; - } else { - if (ptb->vaddr2 =3D=3D -1) { - ptb->vaddr2 =3D TARGET_PAGE_ALIGN(db->pc_first); - get_page_addr_code_hostp(cpu_env(cpu), ptb->vaddr2, &ptb->hadd= r2); - } - insn->haddr =3D ptb->haddr2 + pc - ptb->vaddr2; - } - tcg_gen_plugin_cb(PLUGIN_GEN_FROM_INSN); } =20 diff --git a/plugins/api.c b/plugins/api.c index 9e4aa9d2d9..0ae19774df 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -242,7 +242,30 @@ uint64_t qemu_plugin_insn_vaddr(const struct qemu_plug= in_insn *insn) =20 void *qemu_plugin_insn_haddr(const struct qemu_plugin_insn *insn) { - return insn->haddr; + const DisasContextBase *db =3D tcg_ctx->plugin_db; + vaddr page0_last =3D 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 <=3D page0_last) { + if (db->host_addr[0] =3D=3D NULL) { + return NULL; + } + return db->host_addr[0] + insn->vaddr - db->pc_first; + } else { + if (db->host_addr[1] =3D=3D NULL) { + return NULL; + } + return db->host_addr[1] + insn->vaddr - (page0_last + 1); + } } =20 char *qemu_plugin_insn_disas(const struct qemu_plugin_insn *insn) --=20 2.34.1 From nobody Mon Nov 25 09:55:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715759859; cv=none; d=zohomail.com; s=zohoarc; b=i2HM9JHLDFExVgQLPZV7GWp682H5GidGNdgpcuznRCjyLW5JsqCi9JYppXy7axDmQFymqlGx9IU25OJRdbvjdwI+Jj/x+fu1ALskivOGvsptEnXgQFwsYJUviAnA8KqOILTFev91hYtApHK57gQ6ZqJ+4UevP8lW6NepcrZ1bks= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715759859; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=nAVbhs+RqNvGH8rJ76ZP56RL9rwGY3Fja1sdqAVH2vU=; b=g8tc/FxXFGnmLo9O0fEFIjxsQw2+hYCuYzBiILKlcFcmiKVgYcp/Kl/KdiZkuAwVucBVg3KlIX2BVA0BouIRFnCBFQAKfXjI9v5HHo+cf12qbKWo64XJls65i5toGBQGA+vA8zHMi4cicdkXQwnl1OJH9L+/cyHUJAfoxab+7jI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715759859906230.82599243594302; Wed, 15 May 2024 00:57:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79Rj-0004Ay-LQ; Wed, 15 May 2024 03:53:07 -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 1s79Re-00047S-Ov for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:02 -0400 Received: from mail-lj1-x22c.google.com ([2a00:1450: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 1s79Rc-0001aB-9z for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:02 -0400 Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2e27277d2c1so87258511fa.2 for ; Wed, 15 May 2024 00:52:59 -0700 (PDT) Received: from stoup.. ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm222611855e9.37.2024.05.15.00.52.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:52:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715759578; x=1716364378; 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=nAVbhs+RqNvGH8rJ76ZP56RL9rwGY3Fja1sdqAVH2vU=; b=ZqU1SAMb72a2nrqKSrweOxm3I8zg1bPTw8TYNOS8U7IT3662bPrIiMKfUSMYk4dzS+ a3P6B16cp0VXWzx0Sh1glFQgBMXA+oybipod081YalNVN6mMUqsX8qEJM5uY42f5nrlZ Q3fpINdDFQ2JxBDwc8JoXBVLvRLh4nzHo8saQyxcvMQ7y9q0g4cCGvmLGkO13LfvTCe0 Q+i/2YXuHB3ODx7gTEjx84iD/s7FthsBv54FOHHE+zGHKdbU8w8lE8rKBsQW4Qj56lnw o4SCIbvBmHvMiDfZdoKKF5PHCUdVPT5AyM3neGKAShCJIvVeQwv2WBsO4+qRxPvS2OT6 PkLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759578; x=1716364378; 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=nAVbhs+RqNvGH8rJ76ZP56RL9rwGY3Fja1sdqAVH2vU=; b=YfieW+WscxLIeBIzB9UAmY6ucho+tiiZZt7mMAuyfaGxb3uFNxAi/Duv0TSx3z//8m PeyQnrQvoW0t/QEVnxUIPRKPA28s6gx1JKyGElGHi71Ddfg531RuAkwe/2QECVcaoWKg lbN0toM20UYLcLlCs5aLPBy/88LrRwCyXGkpUxtucB2Fm33AyCw2A+S65yjqX2LOF5YE 5t4cZM+yqkU+SGxR0AuhywQrXp5gYQa3yQzT3P3JFwJaiqjKONd1c9S5tFf91j2x+E3z FkExvyRF/jK/hR3Wx4TXJC8f7hGhXNICvFfHS72St8rOnF5TDfaDmJuwitXburFiMODR LPlA== X-Gm-Message-State: AOJu0Yyv5kJGB46WoJ8dL0PqBCIwPKfG3HTQjnuQXmeW7jUrtvNFPTHD CCFdm7mC4gtwhjZavxL/RWrGOwhX4PRPjO06r0bvl10xfdHOSKV0UY/NdqstaUGfx2BHsk5Wohk JD8w= X-Google-Smtp-Source: AGHT+IG7mcS/uvkhCxXKpUA23tYHaP4Ag0Y/Ym0ofG5+1RkYGaNLPkPYDSKrEgKxBGDQdMVZe/ilhw== X-Received: by 2002:a2e:2a82:0:b0:2d4:3e82:117e with SMTP id 38308e7fff4ca-2e5203a4a9cmr97733391fa.32.1715759578722; Wed, 15 May 2024 00:52:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 14/34] plugins: Use DisasContextBase for qemu_plugin_tb_vaddr Date: Wed, 15 May 2024 09:52:27 +0200 Message-Id: <20240515075247.68024-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075247.68024-1-richard.henderson@linaro.org> References: <20240515075247.68024-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::22c; envelope-from=richard.henderson@linaro.org; helo=mail-lj1-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715759861646100006 We do not need to separately record the start of the TB. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- include/qemu/plugin.h | 1 - accel/tcg/plugin-gen.c | 3 +-- plugins/api.c | 3 ++- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/include/qemu/plugin.h b/include/qemu/plugin.h index da0f37e269..7fda6ef126 100644 --- a/include/qemu/plugin.h +++ b/include/qemu/plugin.h @@ -118,7 +118,6 @@ struct qemu_plugin_scoreboard { struct qemu_plugin_tb { GPtrArray *insns; size_t n; - uint64_t vaddr; =20 /* 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 c36632e8df..b54494712a 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 *pl= ugin_tb) int insn_idx =3D -1; =20 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 =3D qemu_log_trylock(); if (logfile) { fprintf(logfile, "OP before plugin injection:\n"); @@ -318,7 +318,6 @@ bool plugin_gen_tb_start(CPUState *cpu, const DisasCont= extBase *db) =20 ret =3D true; =20 - ptb->vaddr =3D db->pc_first; ptb->mem_helper =3D false; =20 tcg_gen_plugin_cb(PLUGIN_GEN_FROM_TB); diff --git a/plugins/api.c b/plugins/api.c index 0ae19774df..02014d4c6e 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) =20 uint64_t qemu_plugin_tb_vaddr(const struct qemu_plugin_tb *tb) { - return tb->vaddr; + const DisasContextBase *db =3D tcg_ctx->plugin_db; + return db->pc_first; } =20 struct qemu_plugin_insn * --=20 2.34.1 From nobody Mon Nov 25 09:55:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715759611; cv=none; d=zohomail.com; s=zohoarc; b=HNFSH/pzBAaxh0srPBES1OK52fECvLbA8RbS9I5GyS6vLlwHZc1rvrxILn26sNSUavLTVFUesKmhNPV3W+dykK0JArOMcmDYRJQ8cPx+uAh+qvNtWitNBkQhsfadqbrKGJDvQjBZ0Z2lkg7z85IeFokFJdZkvZ/7SeaNybh7R/A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715759611; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=+l6G3m8cadQ7WYYi4wJCHAd6krJgJAZNy2Yqel8DyXU=; b=ElPlz5yGFpXKtM5bxGIV8aBqfsPwPCohMFCGbpZqU0rd+RuYBrl9yEJ4Up+O9CU8QaAzH4zOcO4kYpgIqQB9zlbpSfdQu6PjfSRf7U9wQBWOEARoG6SCBpCoWu86q/JjE0q3MiCLkz+ZzzJ6icU2eGMaXcqULVsVGgNJ4SWk6/g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715759611970311.4298307009874; Wed, 15 May 2024 00:53:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79Rl-0004BG-Q5; Wed, 15 May 2024 03:53:10 -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 1s79Rf-00047c-2B for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:03 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s79Rc-0001aT-OS for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:02 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-41fc53252ceso45478685e9.0 for ; Wed, 15 May 2024 00:53:00 -0700 (PDT) Received: from stoup.. ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm222611855e9.37.2024.05.15.00.52.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:52:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715759579; x=1716364379; 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=+l6G3m8cadQ7WYYi4wJCHAd6krJgJAZNy2Yqel8DyXU=; b=F0cFWyU5ns3IO7WNAir0D79+zuBBm4SmC8z7APXwfAcMqFILVO68TSuL6IClGYPUUA 2l7b8241YefEkmLhvjQYz/+Ol4QJVeO9zJH87EwVYf47rpDGNE8fM1OytMnrkFTU33zA dwAoOdvFFN7LwWb1rY5t/Kz/B7N3cuUGQ6Rk/mqkc8aiHQX/gdvgGbc8eAgNk06FbqzG flzlQ6wZpDIDSaYmOqw116LV0+N6x3BWidQd/GorbtN5/HryKRvT2PskM7pz2ZlXMU+B E/ofZXbwBky3LB+34zK6GChsoukJ0c4/fIU6VAAdGdRPtET3Hm6hyYqhXTNFdZ+fAEVH BzNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759579; x=1716364379; 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=+l6G3m8cadQ7WYYi4wJCHAd6krJgJAZNy2Yqel8DyXU=; b=IVKxy2hr/V9BYk811jpzZf0xVjxLaJDAFRQlDJAV3ngFOXPec3n4ZJRtYK6W9TmAzp kd24P7RE4tgiZWIVXYRGk2M639mmcTpEvP3YC20UpgZo9TVgVR3Tx3ThN4QxdQM81LEw JlQrlvCuIu3Pa8xFGuDVhW7jYYhLa1U2UHH7ssgk8M9fXpaomrFLGdr7M3NdDNMRhRP8 ClWn6mrP1IyubDL54PM2fKcOledhmcSWfiUjGwb6c2uAN+vU1alkGQkB2zfaiLCQH1Ws ZkEuR38rMbzCrl/nS1aaYa47eUQK4NPJ4Ofufn1mRCtvDLUqT7guQg0pcTqbAQup1dUg hNeA== X-Gm-Message-State: AOJu0YwCgNMH6v0Smua9FuH/24ftzdoAqHyyk1PxEep8+kz1fGTAYcY/ jSjoXO2mWplhZYe9NOC0uIdpsWmlOL5qljKN+0VuG/v6Uk9svjAoPFIfBqKiG/4kJoLo8iZUvGk 1t4o= X-Google-Smtp-Source: AGHT+IG3/qUZoGRC/O0keLBWwyrTKOPzY6M6kMYhKO0VuoSqQmlTAYaxSMWHmDqVfpzBGSif8jElXQ== X-Received: by 2002:a05:600c:a46:b0:41f:f144:5623 with SMTP id 5b1f17b1804b1-41ff1445732mr117845125e9.14.1715759579343; Wed, 15 May 2024 00:52:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 15/34] plugins: Merge alloc_tcg_plugin_context into plugin_gen_tb_start Date: Wed, 15 May 2024 09:52:28 +0200 Message-Id: <20240515075247.68024-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075247.68024-1-richard.henderson@linaro.org> References: <20240515075247.68024-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x334.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715759612581100001 We don't need to allocate plugin context at startup, we can wait until we actually use it. Reviewed-by: Philippe Mathieu-Daud=C3=A9 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 b54494712a..54b08ffc9e 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) =20 bool plugin_gen_tb_start(CPUState *cpu, const DisasContextBase *db) { - bool ret =3D false; + struct qemu_plugin_tb *ptb; =20 - if (test_bit(QEMU_PLUGIN_EV_VCPU_TB_TRANS, cpu->plugin_state->event_ma= sk)) { - struct qemu_plugin_tb *ptb =3D tcg_ctx->plugin_tb; - - /* reset callbacks */ - if (ptb->cbs) { - g_array_set_size(ptb->cbs, 0); - } - ptb->n =3D 0; - - ret =3D true; - - ptb->mem_helper =3D 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; } =20 tcg_ctx->plugin_db =3D db; tcg_ctx->plugin_insn =3D NULL; + ptb =3D tcg_ctx->plugin_tb; =20 - return ret; + if (ptb) { + /* Reset callbacks */ + if (ptb->cbs) { + g_array_set_size(ptb->cbs, 0); + } + ptb->n =3D 0; + ptb->mem_helper =3D false; + } else { + ptb =3D g_new0(struct qemu_plugin_tb, 1); + tcg_ctx->plugin_tb =3D ptb; + ptb->insns =3D g_ptr_array_new(); + } + + tcg_gen_plugin_cb(PLUGIN_GEN_FROM_TB); + return true; } =20 void plugin_gen_insn_start(CPUState *cpu, const DisasContextBase *db) diff --git a/tcg/tcg.c b/tcg/tcg.c index 71daa5d268..34e3056380 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -761,14 +761,6 @@ QEMU_BUILD_BUG_ON((int)(offsetof(CPUNegativeOffsetStat= e, tlb.f[0]) - < MIN_TLB_MASK_TABLE_OFS); #endif =20 -static void alloc_tcg_plugin_context(TCGContext *s) -{ -#ifdef CONFIG_PLUGIN - s->plugin_tb =3D g_new0(struct qemu_plugin_tb, 1); - s->plugin_tb->insns =3D 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 functi= on @@ -813,7 +805,6 @@ void tcg_register_thread(void) qatomic_set(&tcg_ctxs[n], s); =20 if (n > 0) { - alloc_tcg_plugin_context(s); tcg_region_initial_alloc(s); } =20 @@ -1360,8 +1351,6 @@ static void tcg_context_init(unsigned max_cpus) indirect_reg_alloc_order[i] =3D tcg_target_reg_alloc_order[i]; } =20 - alloc_tcg_plugin_context(s); - tcg_ctx =3D s; /* * In user-mode we simply share the init context among threads, since = we --=20 2.34.1 From nobody Mon Nov 25 09:55:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715760012; cv=none; d=zohomail.com; s=zohoarc; b=mgB7/68ViugAV2mrjv+LqtV7G4uaa6HXSTH2ZP4oTPLQ5fX9DOYNcOwPAwggV+7HrpzPbpnaEMbBesl2kmeJ3D+xF+aJn+ye+SThSLzESJqOGn5RAklOc+MZsRYLQqjGHh7BFI6/5YdpUdZUO47Pc3sBb8HRsCQQBbkqL8aQgrI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715760012; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ed4EkfWXBrfCLsx83mIxp0LwZk/NBO19akBhz76SUNk=; b=d7+DGCvswgNu4jny1XdU+pxZqiqPe26sG60u9qMo0MtNC5HQ19pPQkrnvITJwuXWalfZoTILYGX7TJ6VD4X+rCdFYJ3XjW6KbDbshmwd3KmPk/HhbmqNTKXeuFsRusMX2zL6SnKwAAvsn/UHDdbwich3bzStmzjGKy/yBWIaZMg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715760012101213.70150020984; Wed, 15 May 2024 01:00:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79Rp-0004Fg-Ki; Wed, 15 May 2024 03:53:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s79Ri-00048f-Qc for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:07 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s79Rd-0001av-KO for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:05 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-420180b59b7so19011295e9.0 for ; Wed, 15 May 2024 00:53:01 -0700 (PDT) Received: from stoup.. ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm222611855e9.37.2024.05.15.00.52.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:52:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715759580; x=1716364380; 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=ed4EkfWXBrfCLsx83mIxp0LwZk/NBO19akBhz76SUNk=; b=mOpgVblHnrZeXRkCZ6G7D9jW58+BWNO3Ga2gh9O32j/fik3MbLG3kEbRAkO1RqMQpz B5Pkrbmq4+OlUI5Ra8H5CcKx2eKUzaN4PHwxTPTw4gDbIgtmSa6Zc6ncv2NCKOMcNifE JccHUJd8ljFPNglCDODDWdDs4iZl7+0KTVnL6o5FUPzmOz9kO4JqF3nnlq7zhNp+nXZ4 xTE6CUwQISwK3Cb7JAJVfBYxpurioK5pcD624owKfeZSSVtOLxMTKByWDEVvRPEOWcaP ITqFPYv0vHQQMY2doWie2CI10Z+P9Yzy9TOf6ZlDhYdt12tLnNvKCDbrREIDLGd0TPYU auJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759580; x=1716364380; 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=ed4EkfWXBrfCLsx83mIxp0LwZk/NBO19akBhz76SUNk=; b=Sm2OWbDxjucTMtsQlz/FRYSgUgjgaemnlseLubcRS8k0kB2e3UpAeLkGct6kRVz35Z CgJWeeAJwL2kJOZ6yfnYOemCnR/lMgJhtaRiTk5GYonPjHWG1PEJMa2KIVZS3PM7rPtG YEO9b7PHSD5pgxFY6dsTYNITus94P99LwnVaEKbLYWe3iafV35Y7D9eFCEweuxtXfTFs JOMc6IgSD6b6H07ccWeZjsbdlC7VG2TNPT087UQePeDLq0OmkodYhNThld81KIbZCltq Tjm1+PauAVRvJeQcQ7ap6zRSaN1JoGlQDCvw5M9qmY5b10yR54/922btjw5sn24OG0JB MMdw== X-Gm-Message-State: AOJu0YwrVkQxfKiwE517pE3qaq4QhKVrCdXSs/tSVwGquori+Vwkg6R9 wiAHMgxHon93bt32hA1xFksdn+tl9FNVyvXsBK6qHMJbC0TaTmgrL3XvsBQ70UxWDkM4WhzgB6N veXY= X-Google-Smtp-Source: AGHT+IHSmlYkMUd727fEYhpF2cHVI9KUkie5f2pmmLhJP4Ej3BAg6oSOLQTb7EZJ1hwjX15RwNiz9Q== X-Received: by 2002:a05:600c:1389:b0:41f:f053:edb4 with SMTP id 5b1f17b1804b1-41ff053ef30mr106600105e9.23.1715759580027; Wed, 15 May 2024 00:53:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 16/34] accel/tcg: Provide default implementation of disas_log Date: Wed, 15 May 2024 09:52:29 +0200 Message-Id: <20240515075247.68024-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075247.68024-1-richard.henderson@linaro.org> References: <20240515075247.68024-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32b.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715760014299100007 Almost all of the disas_log implementations are identical. Unify them within translator_loop. Drop extra Priv/Virt logging from target/riscv. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- accel/tcg/translator.c | 9 ++++++++- target/alpha/translate.c | 9 --------- target/arm/tcg/translate-a64.c | 11 ----------- target/arm/tcg/translate.c | 12 ------------ target/avr/translate.c | 8 -------- target/cris/translate.c | 11 ----------- target/hexagon/translate.c | 9 --------- target/hppa/translate.c | 6 ++++-- target/i386/tcg/translate.c | 11 ----------- target/loongarch/tcg/translate.c | 8 -------- target/m68k/translate.c | 9 --------- target/microblaze/translate.c | 9 --------- target/mips/tcg/translate.c | 9 --------- target/openrisc/translate.c | 11 ----------- target/ppc/translate.c | 9 --------- target/riscv/translate.c | 18 ------------------ target/rx/translate.c | 8 -------- target/sh4/translate.c | 9 --------- target/sparc/translate.c | 9 --------- target/tricore/translate.c | 9 --------- target/xtensa/translate.c | 9 --------- 21 files changed, 12 insertions(+), 191 deletions(-) diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 157b447810..98d2500c53 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -17,6 +17,7 @@ #include "exec/cpu_ldst.h" #include "tcg/tcg-op-common.h" #include "internal-target.h" +#include "disas/disas.h" =20 static void set_can_do_io(DisasContextBase *db, bool val) { @@ -226,7 +227,13 @@ void translator_loop(CPUState *cpu, TranslationBlock *= tb, int *max_insns, FILE *logfile =3D 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 db847e7a23..fb6cac4b53 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" @@ -2947,20 +2946,12 @@ static void alpha_tr_tb_stop(DisasContextBase *dcba= se, CPUState *cpu) } } =20 -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 =3D { .init_disas_context =3D alpha_tr_init_disas_context, .tb_start =3D alpha_tr_tb_start, .insn_start =3D alpha_tr_insn_start, .translate_insn =3D alpha_tr_translate_insn, .tb_stop =3D alpha_tr_tb_stop, - .disas_log =3D alpha_tr_disas_log, }; =20 void gen_intermediate_code(CPUState *cpu, TranslationBlock *tb, int *max_i= nsns, diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 976094a5c8..4126aaa27e 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" @@ -14382,20 +14381,10 @@ static void aarch64_tr_tb_stop(DisasContextBase *= dcbase, CPUState *cpu) } } =20 -static void aarch64_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cpu, FILE *logfile) -{ - DisasContext *dc =3D 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 =3D { .init_disas_context =3D aarch64_tr_init_disas_context, .tb_start =3D aarch64_tr_tb_start, .insn_start =3D aarch64_tr_insn_start, .translate_insn =3D aarch64_tr_translate_insn, .tb_stop =3D aarch64_tr_tb_stop, - .disas_log =3D aarch64_tr_disas_log, }; diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c index dc49a8d806..d605e10f11 100644 --- a/target/arm/tcg/translate.c +++ b/target/arm/tcg/translate.c @@ -23,7 +23,6 @@ #include "translate.h" #include "translate-a32.h" #include "qemu/log.h" -#include "disas/disas.h" #include "arm_ldst.h" #include "semihosting/semihost.h" #include "cpregs.h" @@ -9663,22 +9662,12 @@ static void arm_tr_tb_stop(DisasContextBase *dcbase= , CPUState *cpu) } } =20 -static void arm_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cpu, FILE *logfile) -{ - DisasContext *dc =3D 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 =3D { .init_disas_context =3D arm_tr_init_disas_context, .tb_start =3D arm_tr_tb_start, .insn_start =3D arm_tr_insn_start, .translate_insn =3D arm_tr_translate_insn, .tb_stop =3D arm_tr_tb_stop, - .disas_log =3D arm_tr_disas_log, }; =20 static const TranslatorOps thumb_translator_ops =3D { @@ -9687,7 +9676,6 @@ static const TranslatorOps thumb_translator_ops =3D { .insn_start =3D arm_tr_insn_start, .translate_insn =3D thumb_tr_translate_insn, .tb_stop =3D arm_tr_tb_stop, - .disas_log =3D arm_tr_disas_log, }; =20 /* 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) } } =20 -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 =3D { .init_disas_context =3D avr_tr_init_disas_context, .tb_start =3D avr_tr_tb_start, .insn_start =3D avr_tr_insn_start, .translate_insn =3D avr_tr_translate_insn, .tb_stop =3D avr_tr_tb_stop, - .disas_log =3D avr_tr_disas_log, }; =20 void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_in= sns, 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 @@ =20 #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 *dcbas= e, CPUState *cpu) } } =20 -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 =3D { .init_disas_context =3D cris_tr_init_disas_context, .tb_start =3D cris_tr_tb_start, .insn_start =3D cris_tr_insn_start, .translate_insn =3D cris_tr_translate_insn, .tb_stop =3D cris_tr_tb_stop, - .disas_log =3D cris_tr_disas_log, }; =20 void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_in= sns, diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c index fcba82f7dc..61302d4f46 100644 --- a/target/hexagon/translate.c +++ b/target/hexagon/translate.c @@ -1076,21 +1076,12 @@ static void hexagon_tr_tb_stop(DisasContextBase *dc= base, CPUState *cpu) } } =20 -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 =3D { .init_disas_context =3D hexagon_tr_init_disas_context, .tb_start =3D hexagon_tr_tb_start, .insn_start =3D hexagon_tr_insn_start, .translate_insn =3D hexagon_tr_translate_packet, .tb_stop =3D hexagon_tr_tb_stop, - .disas_log =3D hexagon_tr_disas_log, }; =20 void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_in= sns, diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 6d45611888..1a806a9d09 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -4816,12 +4816,12 @@ static void hppa_tr_tb_stop(DisasContextBase *dcbas= e, CPUState *cs) } } =20 +#ifdef CONFIG_USER_ONLY static void hppa_tr_disas_log(const DisasContextBase *dcbase, CPUState *cs, FILE *logfile) { target_ulong pc =3D dcbase->pc_first; =20 -#ifdef CONFIG_USER_ONLY switch (pc) { case 0x00: fprintf(logfile, "IN:\n0x00000000: (null)\n"); @@ -4836,11 +4836,11 @@ static void hppa_tr_disas_log(const DisasContextBas= e *dcbase, fprintf(logfile, "IN:\n0x00000100: syscall\n"); return; } -#endif =20 fprintf(logfile, "IN: %s\n", lookup_symbol(pc)); target_disas(logfile, cs, pc, dcbase->tb->size); } +#endif =20 static const TranslatorOps hppa_tr_ops =3D { .init_disas_context =3D hppa_tr_init_disas_context, @@ -4848,7 +4848,9 @@ static const TranslatorOps hppa_tr_ops =3D { .insn_start =3D hppa_tr_insn_start, .translate_insn =3D hppa_tr_translate_insn, .tb_stop =3D hppa_tr_tb_stop, +#ifdef CONFIG_USER_ONLY .disas_log =3D hppa_tr_disas_log, +#endif }; =20 void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_in= sns, diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index de87775016..ed601474a9 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -20,7 +20,6 @@ =20 #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" @@ -4798,22 +4797,12 @@ static void i386_tr_tb_stop(DisasContextBase *dcbas= e, CPUState *cpu) } } =20 -static void i386_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cpu, FILE *logfile) -{ - DisasContext *dc =3D 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 =3D { .init_disas_context =3D i386_tr_init_disas_context, .tb_start =3D i386_tr_tb_start, .insn_start =3D i386_tr_insn_start, .translate_insn =3D i386_tr_translate_insn, .tb_stop =3D i386_tr_tb_stop, - .disas_log =3D i386_tr_disas_log, }; =20 /* generate intermediate code for basic block 'tb'. */ diff --git a/target/loongarch/tcg/translate.c b/target/loongarch/tcg/transl= ate.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 *dc= base, CPUState *cs) } } =20 -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 =3D { .init_disas_context =3D loongarch_tr_init_disas_context, .tb_start =3D loongarch_tr_tb_start, .insn_start =3D loongarch_tr_insn_start, .translate_insn =3D loongarch_tr_translate_insn, .tb_stop =3D loongarch_tr_tb_stop, - .disas_log =3D loongarch_tr_disas_log, }; =20 void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_in= sns, diff --git a/target/m68k/translate.c b/target/m68k/translate.c index 169927552a..445966fb6a 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -20,7 +20,6 @@ =20 #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" @@ -6105,20 +6104,12 @@ static void m68k_tr_tb_stop(DisasContextBase *dcbas= e, CPUState *cpu) } } =20 -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 =3D { .init_disas_context =3D m68k_tr_init_disas_context, .tb_start =3D m68k_tr_tb_start, .insn_start =3D m68k_tr_insn_start, .translate_insn =3D m68k_tr_translate_insn, .tb_stop =3D m68k_tr_tb_stop, - .disas_log =3D m68k_tr_disas_log, }; =20 void gen_intermediate_code(CPUState *cpu, TranslationBlock *tb, int *max_i= nsns, diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index 84cca04962..9746a6d479 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -20,7 +20,6 @@ =20 #include "qemu/osdep.h" #include "cpu.h" -#include "disas/disas.h" #include "exec/exec-all.h" #include "exec/cpu_ldst.h" #include "tcg/tcg-op.h" @@ -1772,20 +1771,12 @@ static void mb_tr_tb_stop(DisasContextBase *dcb, CP= UState *cs) } } =20 -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 =3D { .init_disas_context =3D mb_tr_init_disas_context, .tb_start =3D mb_tr_tb_start, .insn_start =3D mb_tr_insn_start, .translate_insn =3D mb_tr_translate_insn, .tb_stop =3D mb_tr_tb_stop, - .disas_log =3D mb_tr_disas_log, }; =20 void gen_intermediate_code(CPUState *cpu, TranslationBlock *tb, int *max_i= nsns, 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" =20 #define HELPER_H "helper.h" @@ -15475,20 +15474,12 @@ static void mips_tr_tb_stop(DisasContextBase *dcb= ase, CPUState *cs) } } =20 -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 =3D { .init_disas_context =3D mips_tr_init_disas_context, .tb_start =3D mips_tr_tb_start, .insn_start =3D mips_tr_insn_start, .translate_insn =3D mips_tr_translate_insn, .tb_stop =3D mips_tr_tb_stop, - .disas_log =3D mips_tr_disas_log, }; =20 void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_in= sns, 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 *d= cbase, CPUState *cs) } } =20 -static void openrisc_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cs, FILE *logfile) -{ - DisasContext *s =3D 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 =3D { .init_disas_context =3D openrisc_tr_init_disas_context, .tb_start =3D openrisc_tr_tb_start, .insn_start =3D openrisc_tr_insn_start, .translate_insn =3D openrisc_tr_translate_insn, .tb_stop =3D openrisc_tr_tb_stop, - .disas_log =3D openrisc_tr_disas_log, }; =20 void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_in= sns, 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) } } =20 -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 =3D { .init_disas_context =3D ppc_tr_init_disas_context, .tb_start =3D ppc_tr_tb_start, .insn_start =3D ppc_tr_insn_start, .translate_insn =3D ppc_tr_translate_insn, .tb_stop =3D ppc_tr_tb_stop, - .disas_log =3D ppc_tr_disas_log, }; =20 void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_in= sns, diff --git a/target/riscv/translate.c b/target/riscv/translate.c index 9ff09ebdb6..c999e942e1 100644 --- a/target/riscv/translate.c +++ b/target/riscv/translate.c @@ -20,7 +20,6 @@ #include "qemu/log.h" #include "cpu.h" #include "tcg/tcg-op.h" -#include "disas/disas.h" #include "exec/cpu_ldst.h" #include "exec/exec-all.h" #include "exec/helper-proto.h" @@ -1270,29 +1269,12 @@ static void riscv_tr_tb_stop(DisasContextBase *dcba= se, CPUState *cpu) } } =20 -static void riscv_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cpu, FILE *logfile) -{ -#ifndef CONFIG_USER_ONLY - RISCVCPU *rvcpu =3D RISCV_CPU(cpu); - CPURISCVState *env =3D &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 =3D { .init_disas_context =3D riscv_tr_init_disas_context, .tb_start =3D riscv_tr_tb_start, .insn_start =3D riscv_tr_insn_start, .translate_insn =3D riscv_tr_translate_insn, .tb_stop =3D riscv_tr_tb_stop, - .disas_log =3D riscv_tr_disas_log, }; =20 void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_in= sns, 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) } } =20 -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 =3D { .init_disas_context =3D rx_tr_init_disas_context, .tb_start =3D rx_tr_tb_start, .insn_start =3D rx_tr_insn_start, .translate_insn =3D rx_tr_translate_insn, .tb_stop =3D rx_tr_tb_stop, - .disas_log =3D rx_tr_disas_log, }; =20 void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_in= sns, diff --git a/target/sh4/translate.c b/target/sh4/translate.c index b3282f3ac7..53b092175d 100644 --- a/target/sh4/translate.c +++ b/target/sh4/translate.c @@ -19,7 +19,6 @@ =20 #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" @@ -2310,20 +2309,12 @@ static void sh4_tr_tb_stop(DisasContextBase *dcbase= , CPUState *cs) } } =20 -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 =3D { .init_disas_context =3D sh4_tr_init_disas_context, .tb_start =3D sh4_tr_tb_start, .insn_start =3D sh4_tr_insn_start, .translate_insn =3D sh4_tr_translate_insn, .tb_stop =3D sh4_tr_tb_stop, - .disas_log =3D sh4_tr_disas_log, }; =20 void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_in= sns, diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 99c6f3cc72..dca072888a 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -21,7 +21,6 @@ #include "qemu/osdep.h" =20 #include "cpu.h" -#include "disas/disas.h" #include "exec/helper-proto.h" #include "exec/exec-all.h" #include "tcg/tcg-op.h" @@ -5149,20 +5148,12 @@ static void sparc_tr_tb_stop(DisasContextBase *dcba= se, CPUState *cs) } } =20 -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 =3D { .init_disas_context =3D sparc_tr_init_disas_context, .tb_start =3D sparc_tr_tb_start, .insn_start =3D sparc_tr_insn_start, .translate_insn =3D sparc_tr_translate_insn, .tb_stop =3D sparc_tr_tb_stop, - .disas_log =3D sparc_tr_disas_log, }; =20 void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_in= sns, 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 @@ =20 #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 *dc= base, CPUState *cpu) } } =20 -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 =3D { .init_disas_context =3D tricore_tr_init_disas_context, .tb_start =3D tricore_tr_tb_start, .insn_start =3D tricore_tr_insn_start, .translate_insn =3D tricore_tr_translate_insn, .tb_stop =3D tricore_tr_tb_stop, - .disas_log =3D tricore_tr_disas_log, }; =20 =20 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 @@ =20 #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 *dcb= ase, CPUState *cpu) } } =20 -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 =3D { .init_disas_context =3D xtensa_tr_init_disas_context, .tb_start =3D xtensa_tr_tb_start, .insn_start =3D xtensa_tr_insn_start, .translate_insn =3D xtensa_tr_translate_insn, .tb_stop =3D xtensa_tr_tb_stop, - .disas_log =3D xtensa_tr_disas_log, }; =20 void gen_intermediate_code(CPUState *cpu, TranslationBlock *tb, int *max_i= nsns, --=20 2.34.1 From nobody Mon Nov 25 09:55:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715760196; cv=none; d=zohomail.com; s=zohoarc; b=R2I15CZ6xAcplfT9P2ZisVTTS9Xl6ta9d58WCE3IEo0bCd/5qmWDBeFWBX9m7fpE8PuGcAixysFRlXOIuKSsajZHVDwmV1O8mrtgYsTeu1+4pGCvQPlFxBglFBE+qXrUeVnuTWWjfZ8kT3NUY5zTQ3kAzBvszn8u64IqOcpakhI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715760196; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=YMLriNtzm2n+Yau1lbyLPe0VCMn1fshh8b//AyQSKv8=; b=dzH/FdIWBJAEJvamrabyTu6bxaOWGHH4lvyQbybOIKyS6sMJRH6EM22qUxZfi8Fk8LKHNmPwrtHW886bmrMeEiNh4No67EP3szTMjd96HW+jzhIIkdfXa3DGjuIyP5n1Fc8yyoZlF2jIL8jb0uXaAEo4OB6F4X0Z4PvJI2qMBUA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715760196859588.5427965107818; Wed, 15 May 2024 01:03:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79Rn-0004D2-3r; Wed, 15 May 2024 03:53:11 -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 1s79Rg-000485-DV for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:04 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s79Re-0001az-2H for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:04 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-420180b58c3so20617185e9.2 for ; Wed, 15 May 2024 00:53:01 -0700 (PDT) Received: from stoup.. ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm222611855e9.37.2024.05.15.00.53.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:53:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715759580; x=1716364380; 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=YMLriNtzm2n+Yau1lbyLPe0VCMn1fshh8b//AyQSKv8=; b=gbFQXnCuY4bpbtCifm07lLkJh5fSuaAVUWkfzK0G0AyKbsBA+Z7uMQ4OG5uHSm0xM8 RMkWC+3/H7lfsxVcMN2U1rispcIgsIcQDlZ75bfsGtPCbjQA3XmNlsC7HtVxmNY+F+fh Uxo1fKLRysV48kJ/we75N2tmQN2J4yun8O2MivxJ7LBkzJ5ROCc3lo4B2yJKbSSMprig 6EiCgN4vWe8z3ZqMsV2hGe2tdQjLcWBp/oSQ7lMwdGzs7yJiRxDs47zqda4LHAdyXyl5 SlF+o3yAqT+2tf8ntJddBSMvlnA1WiLw+Fg2AJBadssEBOTKvA2fhIAOxYXL920VURft pLag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759580; x=1716364380; 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=YMLriNtzm2n+Yau1lbyLPe0VCMn1fshh8b//AyQSKv8=; b=WLNc9Uk6eU1hJbbe/oiqqpoO9PQN3dAp59Jclz1QsOJeyHAp+qWTEvdKwpFkecbFLl 2q7qYbQss0gVN2Wlp5Y3J10PFCVpeszxj+OWgJRcqxufPoMcItH8x3Bn80rqoiJWxe3K XXtZZ3/y5JURVmrLC3sFS1qJvAXH75ZNCqX500PmOF9KKuOchsUIjVOF1x7aUQwZigYH JnhJvgAlR5Zgw3E5HBzOzioWhX+7ZrmhdX4FgizhRAiP79NpvDEbqf4GPKc+S/wBwt8o vdmW1j2flc2RXSWr33SHlU+iwVGmi1gHPRlTBx40rGWDoel6miOdQ8r9I2vdO4CK5CVK vXtw== X-Gm-Message-State: AOJu0YxHnyx9tMjZO8la8wltjW34ZdircRJgsDZaBCdOUoX3xMq76CE7 ZqStJM3775QOJ+9HECfjX3jqFUcwaq8IyHpGAAOVxj4Tjp5B802R+rY5PIBYQa5hiS4/EfeZ68T F8uU= X-Google-Smtp-Source: AGHT+IGblsUejkIR3mt3SoycRV0gh8rbXIx8l9RRS6MNhtqCxgqmieC9Lp3KfN/nxbxBc88f+4Mogw== X-Received: by 2002:a05:600c:4182:b0:41a:a5ff:ea3a with SMTP id 5b1f17b1804b1-41feaa390ffmr97941215e9.19.1715759580566; Wed, 15 May 2024 00:53:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 17/34] accel/tcg: Return bool from TranslatorOps.disas_log Date: Wed, 15 May 2024 09:52:30 +0200 Message-Id: <20240515075247.68024-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075247.68024-1-richard.henderson@linaro.org> References: <20240515075247.68024-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x335.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715760197195100004 We have eliminated most uses of this hook. Reduce further by allowing the hook to handle only the special cases, returning false for normal processing. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- include/exec/translator.h | 2 +- accel/tcg/translator.c | 5 ++--- target/hppa/translate.c | 15 ++++++--------- target/s390x/tcg/translate.c | 8 +++----- 4 files changed, 12 insertions(+), 18 deletions(-) diff --git a/include/exec/translator.h b/include/exec/translator.h index fff857a0cc..31c39ab63c 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -135,7 +135,7 @@ typedef struct TranslatorOps { void (*insn_start)(DisasContextBase *db, CPUState *cpu); void (*translate_insn)(DisasContextBase *db, CPUState *cpu); void (*tb_stop)(DisasContextBase *db, CPUState *cpu); - void (*disas_log)(const DisasContextBase *db, CPUState *cpu, FILE *f); + bool (*disas_log)(const DisasContextBase *db, CPUState *cpu, FILE *f); } TranslatorOps; =20 /** diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 98d2500c53..ccd22dcd95 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -228,9 +228,8 @@ void translator_loop(CPUState *cpu, TranslationBlock *t= b, int *max_insns, if (logfile) { fprintf(logfile, "----------------\n"); =20 - 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 1a806a9d09..7287e1debf 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -19,7 +19,6 @@ =20 #include "qemu/osdep.h" #include "cpu.h" -#include "disas/disas.h" #include "qemu/host-utils.h" #include "exec/exec-all.h" #include "exec/page-protection.h" @@ -4817,7 +4816,7 @@ static void hppa_tr_tb_stop(DisasContextBase *dcbase,= CPUState *cs) } =20 #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 =3D dcbase->pc_first; @@ -4825,20 +4824,18 @@ static void hppa_tr_disas_log(const DisasContextBas= e *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 =20 diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index 6d7f6e7064..d74939389a 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -31,7 +31,6 @@ #include "qemu/osdep.h" #include "cpu.h" #include "s390x-internal.h" -#include "disas/disas.h" #include "exec/exec-all.h" #include "tcg/tcg-op.h" #include "tcg/tcg-op-gvec.h" @@ -6520,7 +6519,7 @@ static void s390x_tr_tb_stop(DisasContextBase *dcbase= , CPUState *cs) } } =20 -static void s390x_tr_disas_log(const DisasContextBase *dcbase, +static bool s390x_tr_disas_log(const DisasContextBase *dcbase, CPUState *cs, FILE *logfile) { DisasContext *dc =3D container_of(dcbase, DisasContext, base); @@ -6528,10 +6527,9 @@ static void s390x_tr_disas_log(const DisasContextBas= e *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; } =20 static const TranslatorOps s390x_tr_ops =3D { --=20 2.34.1 From nobody Mon Nov 25 09:55:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715759859; cv=none; d=zohomail.com; s=zohoarc; b=ewYgJpKpLe5qUGDi5R70gH+QaulPiZAKnU27tEVjZQOipdOFcSDR7APr5Hp9k7Az8NKYzFAloc+FNalEQhN3g957M9i0uNWD3yB/jAYX6HYDNACThoiz6UiM/7WakhaXxpQLHoGlU7gyTRQGdT6wDRp9sNe8MNCjwkYnwMhxOuY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715759859; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Y61N3ZndsXj+OYnw5ixGVRN4k3cp76y9d3B3VVCvN+A=; b=IZ7r0zGaGZvE8+xz6Pw4hErsGY2OR8EcwkxqMH4cMup3cZhYJ8GVoNJtSR3wdcDsju9d9NtULEUJfbRAVjWMsrY9QahP8/5Uw7skLotYV4WrP3rS9LvlurrHBIolOGwrIc1dlAzICitUEiYvyGWLmPU2SoF/OzbqZMJOaNn21/4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715759859615163.34769956862726; Wed, 15 May 2024 00:57:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79Rq-0004GR-G2; Wed, 15 May 2024 03:53:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s79Rl-0004Bi-SQ for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:10 -0400 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s79Re-0001bI-VI for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:07 -0400 Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2df83058d48so83560941fa.1 for ; Wed, 15 May 2024 00:53:02 -0700 (PDT) Received: from stoup.. ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm222611855e9.37.2024.05.15.00.53.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:53:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715759581; x=1716364381; 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=Y61N3ZndsXj+OYnw5ixGVRN4k3cp76y9d3B3VVCvN+A=; b=R9BeCIgvGJ4Q1BvKFNVbDAlDHIm2crY3634p49SAk0rxzxW1WOzi0W4Wwf8ylkscDa rapflgYW4s3JEmvdC8hjczz0HUf4aGyPX0l8I6mu5leCkr9wJYmM9PKkyVLvtARqqwV9 5NgwlmnA4xNvMvdeKHZgYolPT3wIfrouHEN46lMq79xYQFrfK7P8O1K94FCxV5kcBIhc QGtzRQS9wRMyFl3wbH2d0QCrdwXBZqZH3SxeSmpbKwTs33HH1BN28FyUtIJELNVBooMy 2I6CULcp24+xglNmv+epTbqaVa+t2/u+ulAn8gSIcOZrvgrY3Eyxwk0d4jrvBjPMauWC i0uA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759581; x=1716364381; 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=Y61N3ZndsXj+OYnw5ixGVRN4k3cp76y9d3B3VVCvN+A=; b=uC+z4P1A0EDQBNTogDXtOdWsqcHQXwKoufSvtaJrbt/ciIBDRG+ad5ro0fgjX6lv0m vPe5vWsKwI0gKSHK7VYefu1XyRH0DE2zSzU1nCSTj89rPcRFfpCh82ghH3m+dOdNg1iT 5zWgAh55QVSRMNepZK9WTUqN+m9gPHqgUG1BRYllNvCWNLlvPZUfIkz6ojWOJh9law19 RlT9rV472zMPF2xBytkBtsE4D3KTCaKtFzfw7I9G5TfG82FCIKn8hlRDGA8bT6UuVSqZ yO2T79Z+yOQO+G/ombiORFf0xcwtdsQR5XQlkUMN0Rv6nCbGBcBuC9o+DgJWMmU7zjqf lXyg== X-Gm-Message-State: AOJu0YwW44zvkoEvRg7491gVO4nBi2mDxHfTzzRRQ8PNoCmU54uYHLcC O8xhAs6IZGeWgVOedvKOzOcl8rQDe4zTdISqyu30sEYn7e/Ec7O+L32QFS7U9su7kbYvaY33cPz jXKM= X-Google-Smtp-Source: AGHT+IHkdSwKHOg3LqV9A2PUsgpN3qdHttR+o9wm6rrUahMqpG6APM52JuG9N75OISJMATVU5sNeJg== X-Received: by 2002:a2e:b0db:0:b0:2de:7cc5:7a27 with SMTP id 38308e7fff4ca-2e51fc369a0mr102110581fa.5.1715759581154; Wed, 15 May 2024 00:53:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 18/34] disas: Split disas.c Date: Wed, 15 May 2024 09:52:31 +0200 Message-Id: <20240515075247.68024-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075247.68024-1-richard.henderson@linaro.org> References: <20240515075247.68024-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::22a; envelope-from=richard.henderson@linaro.org; helo=mail-lj1-x22a.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715759861680100008 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. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- disas/disas-internal.h | 4 + include/disas/disas.h | 4 + disas/disas-common.c | 118 ++++++++++++++ disas/disas-host.c | 129 ++++++++++++++++ disas/disas-target.c | 84 ++++++++++ disas/disas.c | 338 ----------------------------------------- disas/objdump.c | 37 +++++ disas/meson.build | 8 +- 8 files changed, 382 insertions(+), 340 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; =20 +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); =20 +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 =20 /* 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 =20 void monitor_disas(Monitor *mon, CPUState *cpu, uint64_t pc, int nb_insn, bool is_physical); =20 +#ifdef CONFIG_PLUGIN char *plugin_disas(CPUState *cpu, uint64_t addr, size_t size); +#endif =20 /* 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..ce9f82b711 --- /dev/null +++ b/disas/disas-common.c @@ -0,0 +1,118 @@ +/* + * 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/tswap.h" +#include "exec/memory.h" +#include "disas-internal.h" + + +/* Filled in by elfload.c. Simplistic, but will do for now. */ +struct syminfo *syminfos =3D 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 lengt= h, + struct disassemble_info *info) +{ + CPUDebug *s =3D container_of(info, CPUDebug, info); + int r =3D 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 !=3D 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 =3D bfd_arch_unknown; + s->info.cap_arch =3D -1; + s->info.cap_insn_unit =3D 4; + s->info.cap_insn_split =3D 4; + s->info.memory_error_func =3D perror_memory; + s->info.symbol_at_address_func =3D symbol_at_address; +} + +void disas_initialize_debug_target(CPUDebug *s, CPUState *cpu) +{ + disas_initialize_debug(s); + + s->cpu =3D cpu; + s->info.read_memory_func =3D target_read_memory; + s->info.print_address_func =3D print_address; + if (target_words_bigendian()) { + s->info.endian =3D BFD_ENDIAN_BIG; + } else { + s->info.endian =3D BFD_ENDIAN_LITTLE; + } + + CPUClass *cc =3D 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 =3D (GString *)stream; + int initial_len =3D 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 =3D ""; + struct syminfo *s; + + for (s =3D syminfos; s; s =3D s->next) { + symbol =3D s->lookup_symbol(s, orig_addr); + if (symbol[0] !=3D '\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 =3D host_read_memory; + s->info.print_address_func =3D host_print_address; +#if HOST_BIG_ENDIAN + s->info.endian =3D BFD_ENDIAN_BIG; +#else + s->info.endian =3D BFD_ENDIAN_LITTLE; +#endif +#if defined(CONFIG_TCG_INTERPRETER) + s->info.print_insn =3D print_insn_tci; +#elif defined(__i386__) + s->info.mach =3D bfd_mach_i386_i386; + s->info.cap_arch =3D CS_ARCH_X86; + s->info.cap_mode =3D CS_MODE_32; + s->info.cap_insn_unit =3D 1; + s->info.cap_insn_split =3D 8; +#elif defined(__x86_64__) + s->info.mach =3D bfd_mach_x86_64; + s->info.cap_arch =3D CS_ARCH_X86; + s->info.cap_mode =3D CS_MODE_64; + s->info.cap_insn_unit =3D 1; + s->info.cap_insn_split =3D 8; +#elif defined(_ARCH_PPC) + s->info.cap_arch =3D CS_ARCH_PPC; +# ifdef _ARCH_PPC64 + s->info.cap_mode =3D CS_MODE_64; +# endif +#elif defined(__riscv) +#if defined(_ILP32) || (__riscv_xlen =3D=3D 32) + s->info.print_insn =3D print_insn_riscv32; +#elif defined(_LP64) + s->info.print_insn =3D print_insn_riscv64; +#else +#error unsupported RISC-V ABI +#endif +#elif defined(__aarch64__) + s->info.cap_arch =3D CS_ARCH_ARM64; +#elif defined(__alpha__) + s->info.print_insn =3D print_insn_alpha; +#elif defined(__sparc__) + s->info.print_insn =3D print_insn_sparc; + s->info.mach =3D bfd_mach_sparc_v9b; +#elif defined(__arm__) + /* TCG only generates code for arm mode. */ + s->info.cap_arch =3D CS_ARCH_ARM; +#elif defined(__MIPSEB__) + s->info.print_insn =3D print_insn_big_mips; +#elif defined(__MIPSEL__) + s->info.print_insn =3D print_insn_little_mips; +#elif defined(__m68k__) + s->info.print_insn =3D print_insn_m68k; +#elif defined(__s390__) + s->info.cap_arch =3D CS_ARCH_SYSZ; + s->info.cap_insn_unit =3D 2; + s->info.cap_insn_split =3D 6; +#elif defined(__hppa__) + s->info.print_insn =3D print_insn_hppa; +#elif defined(__loongarch__) + s->info.print_insn =3D 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 =3D fprintf; + s.info.stream =3D out; + s.info.buffer =3D code; + s.info.buffer_vma =3D (uintptr_t)code; + s.info.buffer_length =3D size; + s.info.show_opcodes =3D true; + + if (s.info.cap_arch >=3D 0 && cap_disas_host(&s.info, code, size)) { + return; + } + + if (s.info.print_insn =3D=3D NULL) { + s.info.print_insn =3D print_insn_od_host; + } + for (pc =3D (uintptr_t)code; size > 0; pc +=3D count, size -=3D count)= { + fprintf(out, "0x%08" PRIxPTR ": ", pc); + count =3D 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 =3D fprintf; + s.info.stream =3D out; + s.info.buffer_vma =3D code; + s.info.buffer_length =3D size; + s.info.show_opcodes =3D true; + + if (s.info.cap_arch >=3D 0 && cap_disas_target(&s.info, code, size)) { + return; + } + + if (s.info.print_insn =3D=3D NULL) { + s.info.print_insn =3D print_insn_od_target; + } + + for (pc =3D code; size > 0; pc +=3D count, size -=3D count) { + fprintf(out, "0x%08" PRIx64 ": ", pc); + count =3D s.info.print_insn(pc, &s.info); + fprintf(out, "\n"); + if (count < 0) { + break; + } + if (size < count) { + fprintf(out, + "Disassembler disagrees with translator over instructi= on " + "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 *in= fo) +{ + /* 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 =3D g_string_new(NULL); + + disas_initialize_debug_target(&s, cpu); + s.info.fprintf_func =3D disas_gstring_printf; + s.info.stream =3D (FILE *)ds; /* abuse this slot */ + s.info.buffer_vma =3D addr; + s.info.buffer_length =3D size; + s.info.print_address_func =3D plugin_print_address; + + if (s.info.cap_arch >=3D 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 ec14715ecd..0000000000 --- a/disas/disas.c +++ /dev/null @@ -1,338 +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/tswap.h" -#include "exec/memory.h" - -/* Filled in by elfload.c. Simplistic, but will do for now. */ -struct syminfo *syminfos =3D 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 lengt= h, - struct disassemble_info *info) -{ - CPUDebug *s =3D container_of(info, CPUDebug, info); - int r =3D 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 !=3D 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 =3D info->buffer_length; - g_autofree uint8_t *buf =3D g_malloc(n); - - if (info->read_memory_func(pc, buf, n, info) =3D=3D 0) { - for (i =3D 0; i < n; ++i) { - if (i % 32 =3D=3D 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 =3D bfd_arch_unknown; - s->info.cap_arch =3D -1; - s->info.cap_insn_unit =3D 4; - s->info.cap_insn_split =3D 4; - s->info.memory_error_func =3D perror_memory; - s->info.symbol_at_address_func =3D symbol_at_address; -} - -void disas_initialize_debug_target(CPUDebug *s, CPUState *cpu) -{ - initialize_debug(s); - - s->cpu =3D cpu; - s->info.read_memory_func =3D target_read_memory; - s->info.print_address_func =3D print_address; - if (target_words_bigendian()) { - s->info.endian =3D BFD_ENDIAN_BIG; - } else { - s->info.endian =3D BFD_ENDIAN_LITTLE; - } - - CPUClass *cc =3D 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 =3D host_read_memory; - s->info.print_address_func =3D host_print_address; -#if HOST_BIG_ENDIAN - s->info.endian =3D BFD_ENDIAN_BIG; -#else - s->info.endian =3D BFD_ENDIAN_LITTLE; -#endif -#if defined(CONFIG_TCG_INTERPRETER) - s->info.print_insn =3D print_insn_tci; -#elif defined(__i386__) - s->info.mach =3D bfd_mach_i386_i386; - s->info.cap_arch =3D CS_ARCH_X86; - s->info.cap_mode =3D CS_MODE_32; - s->info.cap_insn_unit =3D 1; - s->info.cap_insn_split =3D 8; -#elif defined(__x86_64__) - s->info.mach =3D bfd_mach_x86_64; - s->info.cap_arch =3D CS_ARCH_X86; - s->info.cap_mode =3D CS_MODE_64; - s->info.cap_insn_unit =3D 1; - s->info.cap_insn_split =3D 8; -#elif defined(_ARCH_PPC) - s->info.cap_arch =3D CS_ARCH_PPC; -# ifdef _ARCH_PPC64 - s->info.cap_mode =3D CS_MODE_64; -# endif -#elif defined(__riscv) -#if defined(_ILP32) || (__riscv_xlen =3D=3D 32) - s->info.print_insn =3D print_insn_riscv32; -#elif defined(_LP64) - s->info.print_insn =3D print_insn_riscv64; -#else -#error unsupported RISC-V ABI -#endif -#elif defined(__aarch64__) - s->info.cap_arch =3D CS_ARCH_ARM64; -#elif defined(__alpha__) - s->info.print_insn =3D print_insn_alpha; -#elif defined(__sparc__) - s->info.print_insn =3D print_insn_sparc; - s->info.mach =3D bfd_mach_sparc_v9b; -#elif defined(__arm__) - /* TCG only generates code for arm mode. */ - s->info.cap_arch =3D CS_ARCH_ARM; -#elif defined(__MIPSEB__) - s->info.print_insn =3D print_insn_big_mips; -#elif defined(__MIPSEL__) - s->info.print_insn =3D print_insn_little_mips; -#elif defined(__m68k__) - s->info.print_insn =3D print_insn_m68k; -#elif defined(__s390__) - s->info.cap_arch =3D CS_ARCH_SYSZ; - s->info.cap_insn_unit =3D 2; - s->info.cap_insn_split =3D 6; -#elif defined(__hppa__) - s->info.print_insn =3D print_insn_hppa; -#elif defined(__loongarch__) - s->info.print_insn =3D 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 =3D fprintf; - s.info.stream =3D out; - s.info.buffer_vma =3D code; - s.info.buffer_length =3D size; - s.info.show_opcodes =3D true; - - if (s.info.cap_arch >=3D 0 && cap_disas_target(&s.info, code, size)) { - return; - } - - if (s.info.print_insn =3D=3D NULL) { - s.info.print_insn =3D print_insn_od_target; - } - - for (pc =3D code; size > 0; pc +=3D count, size -=3D count) { - fprintf(out, "0x%08" PRIx64 ": ", pc); - count =3D s.info.print_insn(pc, &s.info); - fprintf(out, "\n"); - if (count < 0) { - break; - } - if (size < count) { - fprintf(out, - "Disassembler disagrees with translator over instructi= on " - "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 =3D (GString *)stream; - int initial_len =3D 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 *in= fo) -{ - /* 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 =3D g_string_new(NULL); - - disas_initialize_debug_target(&s, cpu); - s.info.fprintf_func =3D disas_gstring_printf; - s.info.stream =3D (FILE *)ds; /* abuse this slot */ - s.info.buffer_vma =3D addr; - s.info.buffer_length =3D size; - s.info.print_address_func =3D plugin_print_address; - - if (s.info.cap_arch >=3D 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 =3D fprintf; - s.info.stream =3D out; - s.info.buffer =3D code; - s.info.buffer_vma =3D (uintptr_t)code; - s.info.buffer_length =3D size; - s.info.show_opcodes =3D true; - - if (s.info.cap_arch >=3D 0 && cap_disas_host(&s.info, code, size)) { - return; - } - - if (s.info.print_insn =3D=3D NULL) { - s.info.print_insn =3D print_insn_od_host; - } - for (pc =3D (uintptr_t)code; size > 0; pc +=3D count, size -=3D count)= { - fprintf(out, "0x%08" PRIxPTR ": ", pc); - count =3D 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 =3D ""; - struct syminfo *s; - - for (s =3D syminfos; s; s =3D s->next) { - symbol =3D s->lookup_symbol(s, orig_addr); - if (symbol[0] !=3D '\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 =3D info->buffer_length; + g_autofree uint8_t *buf =3D g_malloc(n); + + if (info->read_memory_func(pc, buf, n, info) =3D=3D 0) { + for (i =3D 0; i < n; ++i) { + if (i % 32 =3D=3D 0) { + info->fprintf_func(info->stream, "\n%s: ", prefix); + } + info->fprintf_func(info->stream, "%02x", buf[i]); + } + } else { + info->fprintf_func(info->stream, "unable to read memory"); + } + return n; +} + +int print_insn_od_host(bfd_vma pc, disassemble_info *info) +{ + return print_insn_objdump(pc, info, "OBJD-H"); +} + +int print_insn_od_target(bfd_vma pc, disassemble_info *info) +{ + return print_insn_objdump(pc, info, "OBJD-T"); +} diff --git a/disas/meson.build b/disas/meson.build index 5c8073beb3..20d6aef9a7 100644 --- a/disas/meson.build +++ b/disas/meson.build @@ -14,7 +14,11 @@ common_ss.add(when: 'CONFIG_SH4_DIS', if_true: files('sh= 4.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) --=20 2.34.1 From nobody Mon Nov 25 09:55:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715760015; cv=none; d=zohomail.com; s=zohoarc; b=X0jGQnlqhnd62k6juYAr5JXzZmuXXnOiO0Fj1G3trJlk2uF3huRCy7xyxk1gEo/zTpYQ3yvaAOnV0aHjuB0QPuPSFz4dJKlIOsEC5c+eiKOWj5hO0yyLcyYBNh72NwZKCKJ8jOmA1TBXHQpZby0O/NuYspwLiVbQRK3o5JfDocI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715760015; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=W3reNa+vlMnQNIk6cvUIcWGKHdlW1nVEiDXshCrKVtM=; b=Y5k7UgBt5OWLOWl9up8iEgbIWR7dKfpZSvblf/IMgKcoq1OLbi09tQ8gI8xybSvlda9amk+Rn6ThWptlMaXHNs7O5jj5na6lLF8kKc1D0WoyUR4gz/JpQoZBHQc08QBBNVowbOC5c4uamCR5/kQzq/AaCyGWwhcxWa3eA4qB5AY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715760015759224.005390268391; Wed, 15 May 2024 01:00:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79Rq-0004H2-VF; Wed, 15 May 2024 03:53:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s79Rm-0004C9-FL for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:10 -0400 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s79Rh-0001bS-6b for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:08 -0400 Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2e3fa13f018so80395531fa.3 for ; Wed, 15 May 2024 00:53:03 -0700 (PDT) Received: from stoup.. ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm222611855e9.37.2024.05.15.00.53.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:53:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715759582; x=1716364382; 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=W3reNa+vlMnQNIk6cvUIcWGKHdlW1nVEiDXshCrKVtM=; b=tZ9UboHwJO4FQLP0s4nziJAxOQlCbiv7ukwxKmNtRuvnpkatZRIu+BkFWjeEKb3n0T oUDpS+9ovY8r7RUifrLDK1uORS3AdVbNaP69Kr39QDyq5HeK5FMgvY4uWeAWx2N3Hr4b FZ9QYqR3EcO0Y/leEStzvRIVX/LiBuQfe4ilrvGE6B9yn5KidufWbt/7ooUuxPv+UL/j Z3kikX3ub2qKABPRFZDtafUbR0j5WqFWDnAbFi7etP3OPrz7ZhDNj8FsxxgjRUSrbWfq WF0phOwONTXATDZl83CXdK9WzJhZ7dEp14ttQ1TxEb0lXmRw0QRDQ47tIMuKaU3D5BBM RDNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759582; x=1716364382; 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=W3reNa+vlMnQNIk6cvUIcWGKHdlW1nVEiDXshCrKVtM=; b=QEQPlxt0UhPliD1LXPqb4rAXJ5DBXPK7wiyiuKRWmF870dvHRrz2Wojs9ULUD1gqIJ 5R/dnnF2H5kfQS53nECWtjiu54jTCnWjGksKSPbfNjCFAko2UoyvdPk8A5s2XMpd2Rkf e7DgCntmT4WK22azLTQ0l1CIeYAqzohV4Dx0HeqJ6mS77rkPQZoBXva6TGTYFHsQfzRE XPk6NbWc2+cE7EOxevVaEP2ZY81Vo3iXVPVMDeYNK99in+6e1jbWzTSgmE+8sciM+xJX kbL5F2Igb0uPGJtfbW5qaQof/7s8ts7wGnnh4J2I02APzv4ZJ1u33bRtTzk7QDuw41hm kbsQ== X-Gm-Message-State: AOJu0YwFQFT7UadMA9jAbekHtThVXldcE9X+eBGkGYWY+PHroNOd1ufG CrTi/fRQOTzVrCSgm9q/RLXw+sMv/SvJugabVTJO/2QvXFVWJK8nsrLuWSQUZxshxjwsIqPb0cF Govw= X-Google-Smtp-Source: AGHT+IH3ln/HSbye1S/1Fd4fkYo9PBmrIukRCVpuTIM0ukAxVhiqcYxVGkuTfAIeb06vN3Vr0Hvmvw== X-Received: by 2002:a2e:701:0:b0:2e5:374b:bf00 with SMTP id 38308e7fff4ca-2e5374bbf6fmr80675201fa.33.1715759581822; Wed, 15 May 2024 00:53:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 19/34] disas: Use translator_st to get disassembly data Date: Wed, 15 May 2024 09:52:32 +0200 Message-Id: <20240515075247.68024-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075247.68024-1-richard.henderson@linaro.org> References: <20240515075247.68024-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::22e; envelope-from=richard.henderson@linaro.org; helo=mail-lj1-x22e.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715760016304100013 Read from already translated pages, or saved mmio data. Reviewed-by: Philippe Mathieu-Daud=C3=A9 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 =20 void monitor_disas(Monitor *mon, CPUState *cpu, uint64_t pc, int nb_insn, bool is_physical); =20 #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 =20 /* Look up symbol for debugging purpose. Returns "" if unknown. */ diff --git a/include/exec/translator.h b/include/exec/translator.h index 31c39ab63c..411ce2b47e 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -79,7 +79,7 @@ typedef enum DisasJumpType { * * Architecture-agnostic disassembly context. */ -typedef struct DisasContextBase { +struct DisasContextBase { TranslationBlock *tb; vaddr pc_first; vaddr pc_next; @@ -103,7 +103,7 @@ typedef struct DisasContextBase { int record_start; int record_len; uint8_t record[32]; -} DisasContextBase; +}; =20 /** * TranslatorOps: diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h index b47e7179e2..9d222dc376 100644 --- a/include/qemu/typedefs.h +++ b/include/qemu/typedefs.h @@ -42,6 +42,7 @@ typedef struct CPUPluginState CPUPluginState; typedef struct CPUState CPUState; 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 ccd22dcd95..00322c6fd9 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -231,7 +231,7 @@ void translator_loop(CPUState *cpu, TranslationBlock *t= b, 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 ce9f82b711..de61f6d8a1 100644 --- a/disas/disas-common.c +++ b/disas/disas-common.c @@ -8,25 +8,12 @@ #include "disas/capstone.h" #include "hw/core/cpu.h" #include "exec/tswap.h" -#include "exec/memory.h" #include "disas-internal.h" =20 =20 /* Filled in by elfload.c. Simplistic, but will do for now. */ struct syminfo *syminfos =3D NULL; =20 -/* - * 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 lengt= h, - struct disassemble_info *info) -{ - CPUDebug *s =3D container_of(info, CPUDebug, info); - int r =3D 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. @@ -73,7 +60,6 @@ void disas_initialize_debug_target(CPUDebug *s, CPUState = *cpu) disas_initialize_debug(s); =20 s->cpu =3D cpu; - s->info.read_memory_func =3D target_read_memory; s->info.print_address_func =3D print_address; if (target_words_bigendian()) { s->info.endian =3D 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" =20 +/* + * 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 =3D container_of(info, CPUDebug, info); + int r =3D 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, =20 if (is_physical) { s.info.read_memory_func =3D physical_read_memory; + } else { + s.info.read_memory_func =3D virtual_read_memory; } s.info.buffer_vma =3D pc; =20 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" =20 =20 -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 *inf= o) { + const DisasContextBase *db =3D 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 =3D db->pc_first; + size_t size =3D translator_st_len(db); uint64_t pc; int count; CPUDebug s; =20 disas_initialize_debug_target(&s, cpu); + s.info.read_memory_func =3D translator_read_memory; + s.info.application_data =3D (void *)db; s.info.fprintf_func =3D fprintf; s.info.stream =3D out; s.info.buffer_vma =3D code; @@ -58,12 +70,15 @@ static void plugin_print_address(bfd_vma addr, struct d= isassemble_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 =3D g_string_new(NULL); =20 disas_initialize_debug_target(&s, cpu); + s.info.read_memory_func =3D translator_read_memory; + s.info.application_data =3D (void *)db; s.info.fprintf_func =3D disas_gstring_printf; s.info.stream =3D (FILE *)ds; /* abuse this slot */ s.info.buffer_vma =3D addr; diff --git a/plugins/api.c b/plugins/api.c index 02014d4c6e..b04c5e1928 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -271,8 +271,8 @@ void *qemu_plugin_insn_haddr(const struct qemu_plugin_i= nsn *insn) =20 char *qemu_plugin_insn_disas(const struct qemu_plugin_insn *insn) { - CPUState *cpu =3D current_cpu; - return plugin_disas(cpu, insn->vaddr, insn->len); + return plugin_disas(tcg_ctx->cpu, tcg_ctx->plugin_db, + insn->vaddr, insn->len); } =20 const char *qemu_plugin_insn_symbol(const struct qemu_plugin_insn *insn) --=20 2.34.1 From nobody Mon Nov 25 09:55:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715760206; cv=none; d=zohomail.com; s=zohoarc; b=e5H9+qecITypT7ougxfeRDaDtHISjv27ZRlhgMJOPOa9njVOm4pqrTDGMq5A6XO7Wjsp5jQ5yTx/ZMzu2dq6m6BpH41YEcKl2g2gVWfMExOFQ+X6S11N4hR5v5dXpAUeGQFTjMXIrj9KR3L6wj9x3bm55NYeqKLA+nrxw08nYfA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715760206; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=1nWXlcFf/ukN+q7QhzDqXIa8CiZT41OLDlcvMAkUxKU=; b=gGr6BbfB0WxLZT3uTruK7e4lMJ2v86iBFA3+5NjwaDrvxvDDULPCFiDK/q7eCnTBJKxA8wg4+VTGr9Bco1xAvgBM9NkMpVqDvoxjcOPndYbJeCJJTBgJIwZokYjeVlfV6sxVlY9DBryG8NenDHYJp1n69a7+hYsAwwlI3h2XB/g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715760206036425.2837618086136; Wed, 15 May 2024 01:03:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79Rr-0004Ho-Lh; Wed, 15 May 2024 03:53: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 1s79Ri-00048y-8y for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:06 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s79Rf-0001bh-ST for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:05 -0400 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-41ffad242c8so34399915e9.3 for ; Wed, 15 May 2024 00:53:03 -0700 (PDT) Received: from stoup.. ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm222611855e9.37.2024.05.15.00.53.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:53:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715759582; x=1716364382; 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=1nWXlcFf/ukN+q7QhzDqXIa8CiZT41OLDlcvMAkUxKU=; b=Owl7Idi+7wiWepcHO2p4+lD4wKLgH8tIeQ4gksJZbpHh8r59nvIrA84op+sF3e16pr 8uas5g+eyJnqsaarKUOnhtiM7KLOxOKcjwmDMqx6Ln9W0RWLWeC9WvKiJU7tyqEpNe7w 9bMdzTVQKTXzClyfcaF1InqzaThND0DIgXFdMNPPuUmCz2nqRkdYIgUyIchHNZHrjgIn 0/u1NW2ksn1CVpht7NjT5IquQFak4JJXrQylhuNgLgJAMkjkuOHu5/+VEsjjaeChYGUu kCzmaWeJL6B24W1X+3/6oZ6fSRhmVgbJMzoO583N/Ss+xX1OgOw43bpccC+1IVp8FlMI TtxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759582; x=1716364382; 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=1nWXlcFf/ukN+q7QhzDqXIa8CiZT41OLDlcvMAkUxKU=; b=ThClyNEZuwTkMGPtFn8nJGykICS0kQ8wTZzx9mQo/WkoJrtsa+L1yiGzwN4yjrDyXh C7PJ/o5k0Am0NWQcIbxVSQdlynNDy4PnBWVxaxWW+nbQ6fUohV5po4+2IYudWngrtNJU fZ8B3prtiTBNfUh4RzU0badon7Hh+egh3qYz9NEaobWeaELG6NCJL1qhkve4/Kbhx7/b 21PgiEGYSayxHRdXtXDF1k8ADizFH/OXxPpMVjcZV3d1iB1JlAo/OaeIoiNsRJZaBkUc /eQe8jvzfAfZfpdt3bVjUDE80KtleQ6D6oM4j9K8PRPrKDlmtcoPv3bWSJL8gz5a6TkE LgrQ== X-Gm-Message-State: AOJu0YyScalGK9EkbLYGaVAvcukXSYRs4D2+HzLsaVErIPJ+hg48yGMv DunhvEEzPZ2+LHcQpVcEYUk3D0wPz9XD8MujKGctdmgawYZ53thlPtfTgEF0KDx7B3DQX5szaqp jyng= X-Google-Smtp-Source: AGHT+IEBXBsdsOVUurlJskDFvZfci4VJNr7GGfOAVHe/3jNky1+oL3FfYoyhpOFZpydqSSrRIyGkPw== X-Received: by 2002:a05:600c:3ca3:b0:41a:908c:b841 with SMTP id 5b1f17b1804b1-41feac55671mr146826585e9.32.1715759582400; Wed, 15 May 2024 00:53:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 20/34] accel/tcg: Introduce translator_fake_ld Date: Wed, 15 May 2024 09:52:33 +0200 Message-Id: <20240515075247.68024-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075247.68024-1-richard.henderson@linaro.org> References: <20240515075247.68024-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x330.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715760207295100001 Replace translator_fake_ldb, which required multiple calls, with translator_fake_ld, which can take all data at once. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- include/exec/translator.h | 8 ++++---- accel/tcg/translator.c | 5 ++--- target/s390x/tcg/translate.c | 8 ++++---- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/include/exec/translator.h b/include/exec/translator.h index 411ce2b47e..25004dfb76 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -234,17 +234,17 @@ translator_ldq_swap(CPUArchState *env, DisasContextBa= se *db, } =20 /** - * 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= ); =20 /** * translator_st diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 00322c6fd9..c56967eecd 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -468,9 +468,8 @@ uint64_t translator_ldq(CPUArchState *env, DisasContext= Base *db, vaddr pc) return tgt; } =20 -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 >=3D db->pc_first); db->fake_insn =3D true; - record_save(db, pc, &insn8, sizeof(insn8)); + record_save(db, db->pc_first, data, len); } diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index d74939389a..2eb787e401 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -6191,6 +6191,8 @@ static const DisasInsn *extract_insn(CPUS390XState *e= nv, DisasContext *s) const DisasInsn *info; =20 if (unlikely(s->ex_value)) { + uint64_t be_insn; + /* Drop the EX data now, so that it's clear on exception paths. */ tcg_gen_st_i64(tcg_constant_i64(0), tcg_env, offsetof(CPUS390XState, ex_value)); @@ -6200,10 +6202,8 @@ static const DisasInsn *extract_insn(CPUS390XState *= env, DisasContext *s) ilen =3D s->ex_value & 0xf; =20 /* Register insn bytes with translator so plugins work. */ - for (int i =3D 0; i < ilen; i++) { - uint8_t byte =3D extract64(insn, 56 - (i * 8), 8); - translator_fake_ldb(&s->base, pc + i, byte); - } + be_insn =3D cpu_to_be64(insn); + translator_fake_ld(&s->base, &be_insn, ilen); op =3D insn >> 56; } else { insn =3D ld_code2(env, s, pc); --=20 2.34.1 From nobody Mon Nov 25 09:55:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715760017; cv=none; d=zohomail.com; s=zohoarc; b=QhIGiOoLieXxGBsW5Io+KtpSFrkodVPtKW3Nwb25OaRnYt15qk8BLD+v21vvP1l0mkDoV/Ehjtuuk9P20zyxN455KcG66bMYp0TWaHKTkqWJh9OuxCuRE4lW98TD2tKawf9olMkbddIlTkkx5uO5ZHO+/qr/YNNIkDy9/yS/2KM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715760017; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=zosCwfAqzS9tNL9GWtQRdlVeW1LGv2S9SgE5WNHpqQg=; b=m1Yjynn8gI/Mm673xVsWjxukL+neA1ZuosipfhcWtsOb/InnIFSlOGuWFzIOCJrXdSG5/3MW+rteiTGF+VeXx8h/6RGVDXjE5Wp1wd5jlH4myMeRnA84LF5UhAwhbDin1OzPK9A5zLVcXogg1hqNhP/iWzu+UMDCOHPSjVw9Jvs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715760017421515.623118300839; Wed, 15 May 2024 01:00:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79Rs-0004Hs-64; Wed, 15 May 2024 03:53:16 -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 1s79Ro-0004FT-1f for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:12 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s79Rh-0001bv-J3 for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:09 -0400 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-41ffad2426eso48854755e9.3 for ; Wed, 15 May 2024 00:53:04 -0700 (PDT) Received: from stoup.. ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm222611855e9.37.2024.05.15.00.53.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:53:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715759583; x=1716364383; 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=zosCwfAqzS9tNL9GWtQRdlVeW1LGv2S9SgE5WNHpqQg=; b=I10h4EwdQtkrAtlww39UGGILScnSdxPxpMTK3U0WNrwwxc3Q0IDUpB13m+uwUVQGs2 ypXgsnbzrVtDEw6WrMWQUYPlkSj85z4yTd/Sh/wOtvyjUZ2dcRupxdek8B6xJLAghMjC tKnN1CMY67IT8OwrLGkgKHBOIN6VyhU5m6muMW/6+AtrMDMGgw+H7oLPPni8pGqQuM44 P5TjuCroEa510xXiZUsKcQ24Jx2lJJ5GOongi4vkYjbZmlU1+AwEiZl6NNirV5IKzpw/ JynfIKIz7mx7etl8/k1dQlgtfR1Uj5DcGGZYhQEWKZveayJa2OFO3h82Stlm4gqmWtrI lA4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759583; x=1716364383; 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=zosCwfAqzS9tNL9GWtQRdlVeW1LGv2S9SgE5WNHpqQg=; b=UMCFfJU6Ue7hJjRDFBMTJRNyq05RhyRWqu5LbhFvJldfciXSG3oRvR7/BYuilvwtsi PnV8UHfoTMdOFoWahIm7vY+dzA3bGGRBxex6eNGS9VVr9Lr/yZIEuIvkZGIOPrv9lKzr tyi62AEfh18t8mU1x0z5YMaho5TY8Qpf2XSDZbIv6RdAdxdBYNVB++Zd9zgz2wzSdsIm 7AAumqci4ch98Dn4LKa+cdqTogex0zi+3Yxr35bxEmFMHWnxvmpZK0Ct/M7LmvDD5TWc 4NoW8Ua8x39jfKR+bOFGXujiWr5TuBvjHUhGn+f9Ov+JzojbdjymIJnvnO/59Qw/bay+ zklA== X-Gm-Message-State: AOJu0YzTStEriDYlDjqZTEF9SQiNknH4hSL5KV5KETD2xoPtdp8cmP+P 75S/IZsIrH1P936Doda6l/fdtW723Ov9y9Oskbk3gXOjV7U3dCF/FYcgOTUNOnoVQhbmJ1BOnxB XS5M= X-Google-Smtp-Source: AGHT+IHeLsv6C9/Qldl9aXehZqLCiAVt2bXcitpSvM514HuFJ+EdhmMl2MWhO9XSmpURBYqb2Wvwsg== X-Received: by 2002:a05:600c:5601:b0:41a:adc3:f777 with SMTP id 5b1f17b1804b1-41feaa38ec7mr144269005e9.16.1715759583014; Wed, 15 May 2024 00:53:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 21/34] target/s390x: Fix translator_fake_ld length Date: Wed, 15 May 2024 09:52:34 +0200 Message-Id: <20240515075247.68024-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075247.68024-1-richard.henderson@linaro.org> References: <20240515075247.68024-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x331.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715760018240100017 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. Reviewed-by: Philippe Mathieu-Daud=C3=A9 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 2eb787e401..95d4d6ebc3 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -6200,11 +6200,11 @@ static const DisasInsn *extract_insn(CPUS390XState = *env, DisasContext *s) /* Extract the values saved by EXECUTE. */ insn =3D s->ex_value & 0xffffffffffff0000ull; ilen =3D s->ex_value & 0xf; + op =3D insn >> 56; =20 /* Register insn bytes with translator so plugins work. */ be_insn =3D cpu_to_be64(insn); - translator_fake_ld(&s->base, &be_insn, ilen); - op =3D insn >> 56; + translator_fake_ld(&s->base, &be_insn, get_ilen(op)); } else { insn =3D ld_code2(env, s, pc); op =3D (insn >> 8) & 0xff; --=20 2.34.1 From nobody Mon Nov 25 09:55:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715759695; cv=none; d=zohomail.com; s=zohoarc; b=acP/kyCTDLzFCwoeWP9bjRjkavchKgkKYzJsPaVGuEM8hUMuCxeAVa47lZn2gg0yY3pjzFsPobk+cIjUnQTnMk0zOPg1z++Chs76Rnirx767tYL1nRBRDorr/MbclRGd26l3eKGbM/6Zsa5AmPEdoiGvcTmFc7AU/TtRcbbaqJ4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715759695; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=43VCEYELAxrkckI6OKg065TP0NGfyWvRiJUBmPu7X2I=; b=BKSveLW1Lc8Uo2d4NYz6pA48UW6LRppDKMWxjCC7BDGMeBuaNnJ77FJ+70ZGG4Rez6SL6ji2YOv/2rBBRP+NJJlVPTOMe+aZRNZsyrJrXO/MMCwns6dfaV2/oBRgaH2M5Eb1OGtLzXriLkkkjFuXlzOUigXk4Z7x7nZH+ltJbBI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715759695425192.3823499258649; Wed, 15 May 2024 00:54:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79SE-0005A2-OD; Wed, 15 May 2024 03:53: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 1s79Rz-0004eN-RX for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:23 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450: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 1s79Rh-0001c3-7n for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:21 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-420104e5390so38425355e9.1 for ; Wed, 15 May 2024 00:53:04 -0700 (PDT) Received: from stoup.. ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm222611855e9.37.2024.05.15.00.53.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:53:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715759583; x=1716364383; 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=43VCEYELAxrkckI6OKg065TP0NGfyWvRiJUBmPu7X2I=; b=CfItn7JY1qh78aeiNtG/V9EYg7a+CCwaHLgOxZwCd2AlP38JH2J/nnqlTszZI0bqgM xH4vdTB2PIgHN/8Qma1r3reeByT/1GdG4F676hPCKNxtdnw1fr+NJ+bUW6zAPp37ymXG KKpvrgo33nizWO7BdevC/VSit5rJGZeI2lOM9LUpJAImQL+UkPiqG2P2OZydZcD6NM0R fmXMFjcXe7mu06xo59qaic0nvaJoxOZUCh73CBTcWEPt1X1f+ZpDJ5LBY0/x+mc1VF5t On+CNCYPxKDVAiurwCJ6Y1bKh+qoAwPbD7tTFeAFETa6R3w7FJPo2UTo02fOcyocuS6w rFbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759583; x=1716364383; 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=43VCEYELAxrkckI6OKg065TP0NGfyWvRiJUBmPu7X2I=; b=SpJdaLaqD1d8KRO1mm1ELAV/CZe9ieZzbxk6DUCAr0PQRrvtfZCTrdhp8J7eljR5QY Yr4zIJza8vJpzx0TdbVZngjVbCqmo5q1WfruVmQyWHFA1UUiyOopL86gB3bmcnwxwLJZ wkOBtlkf6HUrQZlqbIaDX3zc3mJHdgx6FLYQLyNkAt3ZiCwUt8gD06TWbw47oqB/nNlY QlKuuz7isQCaXuhshhKb0+XMYCeS8ZTLhkfykN8YkUi2KtMzUEZlNeaiO/26eOEUT8Bu 70fdINySAq/l64V/7aebUX3u6Z/mnxFzYUnCNCBfxs/tnQwKtIWkZlcbHcURLTzZpmzL RQjw== X-Gm-Message-State: AOJu0Yxm6bAnmriHetaAwXhhuyoDJwC2ga1K5RcYC3Yq8Qywb/q4S3u7 JrvHPnjI+voboAqyHnbvOKADW2Ak3zctAXbxbZT4TSwlb7/vAk4qVbZWsrQ6LJ4QzTWTBTEyh2s 7Mfo= X-Google-Smtp-Source: AGHT+IHVp11SrtDALob74MSW09TBemqyEDquHwG+aUpNHhUcPPfU6Us9Breavb80XpthzVx/Kz9eSg== X-Received: by 2002:a05:600c:4707:b0:41b:edf4:4071 with SMTP id 5b1f17b1804b1-41fead64731mr137083725e9.35.1715759583648; Wed, 15 May 2024 00:53:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 22/34] target/s390x: Disassemble EXECUTEd instructions Date: Wed, 15 May 2024 09:52:35 +0200 Message-Id: <20240515075247.68024-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075247.68024-1-richard.henderson@linaro.org> References: <20240515075247.68024-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-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, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715759696930100003 Reviewed-by: Philippe Mathieu-Daud=C3=A9 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 95d4d6ebc3..bac033c63c 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -6525,8 +6525,9 @@ static bool s390x_tr_disas_log(const DisasContextBase= *dcbase, DisasContext *dc =3D container_of(dcbase, DisasContext, base); =20 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; --=20 2.34.1 From nobody Mon Nov 25 09:55:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715760165; cv=none; d=zohomail.com; s=zohoarc; b=I0AdIsXBO+OlR26YE8PcnQ/MMEAl1/eFS01a3oi0hEgfALbeNiY6zfhgTqt34aOYyn/dDbXV2NWxYz6odpyKpff3IjOdhg6G5iF42VIB7QontaOE+GmI1jpi4jRB02gctU294+kifY533y3iycBG26rALxhNQVPNbOggaRi175g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715760165; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=JIimXBciSNwwzH7l+M6cptiwOdaQNdn1djFTj7g5Tr8=; b=mgcaeeJ4aR573ec3QozOUIOeIyplm07UgGEH+ClvI9ZNlJLsj2zy5hZfomf4jtn59JLJmWMopjMrh2VdrbZKdXJibEgwJOnkLeUiXbH+zHOTvr3r6yaehS+AQrg+aRKbpPgVFkUOzCxwHpSCgc5oaO1zy1eugArlKjuEkYCM9Bw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 171576016563013.457748285012599; Wed, 15 May 2024 01:02:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79Rr-0004HO-30; Wed, 15 May 2024 03:53: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 1s79Rl-0004Bk-T3 for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:10 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s79Rh-0001cM-Qk for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:07 -0400 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-41fd5dc0480so40696285e9.1 for ; Wed, 15 May 2024 00:53:05 -0700 (PDT) Received: from stoup.. ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm222611855e9.37.2024.05.15.00.53.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:53:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715759584; x=1716364384; 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=JIimXBciSNwwzH7l+M6cptiwOdaQNdn1djFTj7g5Tr8=; b=i7l63MY8knV0mvfj7TkMh8nap6zU1+rYqVQJgXH14P2VxwG9OI/6fCLoighK/nEC5P 3J8rlxhK70Q8f6p7l/zbsg/cQ4QfK85B666vkMDwvebcgKLGXZdHrrEe09SRQHuDXOOt 9iS5aQLLOxHJPBts38O1avdSUo7gBwBkSnWLWHO+va62hxZbK4yYM3fwlG1xPSUj2X8r +1kFQ4l5odYVdazROcducMrotEUowK4LquJEgWCKXFEmubX0eD2EZAnfO7mpZtUVhiHh SDGuGmwfBJ4uKdIhe5HgrNIeDxUEQNUcLZzZzz9BG1krCXnpYuRkSwfW9KjYHR80Nk5v sXrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759584; x=1716364384; 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=JIimXBciSNwwzH7l+M6cptiwOdaQNdn1djFTj7g5Tr8=; b=fapwd0yeAQJ+cUR/ac6xTW8616jB0rzp+0b6TelMt12OslA5P2LkvkfgqFZnfeV+Mt pinmomA61jK6kvDj+cNcNTpPoZSWz8PEyyBm0yqm9YeT6dOVDIwkVr9Gifz6qwyB6Zqe kwawq0CcD+zrr+U+GJfZj3aKnGG/NW6Pv6zsmgtY9sfSFkg5jl2y2jY4gq1cNkg6ykW4 wEJn8csF8wqYsFFgwqsUANWQwARXXjD/hp6pPUwwGWAqkiGoqe4VtuTYBNfXEIIafVEn imxNrrtBRm8ODltWJUaBYNRTp4lk5dcpe3DiR4BOneIhGybkCXTg9BA9yWVC9OdP0GQf ye2w== X-Gm-Message-State: AOJu0YyDkSd4H4xyBKbmYzeZyFt/RNLFUjbSD/5/nmAYd6+Tb/yCT/hj VVRNVRAgoTVL6cpJoZxh2+dMT+aSP4vgCU9tPvuB7mGHWt11a9RIbYzOl9q0/QlMpDnISxYg/py z+yg= X-Google-Smtp-Source: AGHT+IELfxbKtSpQASuFe4lO1A0rLcvtcLuyLwXMKL7FHymyr8QPzLj/dlGGt2whZfWTruVHP7KWdw== X-Received: by 2002:a05:600c:4f42:b0:41b:a670:a9f1 with SMTP id 5b1f17b1804b1-41feaa2f409mr95686345e9.7.1715759584328; Wed, 15 May 2024 00:53:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 23/34] target/hexagon: Use translator_ldl in pkt_crosses_page Date: Wed, 15 May 2024 09:52:36 +0200 Message-Id: <20240515075247.68024-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075247.68024-1-richard.henderson@linaro.org> References: <20240515075247.68024-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x330.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715760167004100003 Reviewed-by: Philippe Mathieu-Daud=C3=A9 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 61302d4f46..4b1bee3c6d 100644 --- a/target/hexagon/translate.c +++ b/target/hexagon/translate.c @@ -25,7 +25,6 @@ #include "exec/translation-block.h" #include "exec/cpu_ldst.h" #include "exec/log.h" -#include "exec/cpu_ldst.h" #include "internal.h" #include "attribs.h" #include "insn.h" @@ -1023,7 +1022,7 @@ static bool pkt_crosses_page(CPUHexagonState *env, Di= sasContext *ctx) int nwords; =20 for (nwords =3D 0; !found_end && nwords < PACKET_WORDS_MAX; nwords++) { - uint32_t word =3D cpu_ldl_code(env, + uint32_t word =3D translator_ldl(env, &ctx->base, ctx->base.pc_next + nwords * sizeof(uint32_t)); found_end =3D is_packet_end(word); } --=20 2.34.1 From nobody Mon Nov 25 09:55:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715759645; cv=none; d=zohomail.com; s=zohoarc; b=BbvdaTQKJVVkm5DaB6bYOrKO4zUePApGhM8Kg6DzmmnRaol5Wu/an86osHJpK2P6f3oFnuTkqttIrW6+l0OXESqCtN4nviJqhaWG4GKtVeQ/kZteYosdvLim8cEO8OzVuVMvr+UQtTfIA2FZtxBehHxLaA3rCNc/nlSoV6ZExXY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715759645; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Buz2rJGX38jbC3oBTd0wt7g7ce1h+CXiegaHhEfcdIs=; b=nS0Oo8tw+DIe9lXyxX5SkmBEX3BUNo/tqAAjyE8OfUPb8N0vIdrD2J3xBbwPQhgAC1RrjGBZxjNAWkQlthvXQqM0sD7hNdDoaIXiuz5iKw9Agg9CmxCWmRs8h49bQfztKQqggHep7+j7gMWefNJRvNqYru23QagVk5LOAWIEdXw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715759645173877.5565725164477; Wed, 15 May 2024 00:54:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79S8-0004zC-Vk; Wed, 15 May 2024 03:53: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 1s79S2-0004fI-54 for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:27 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s79Rj-0001cY-F3 for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:24 -0400 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-420157ee56cso23482175e9.2 for ; Wed, 15 May 2024 00:53:05 -0700 (PDT) Received: from stoup.. ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm222611855e9.37.2024.05.15.00.53.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:53:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715759585; x=1716364385; 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=Buz2rJGX38jbC3oBTd0wt7g7ce1h+CXiegaHhEfcdIs=; b=fi+UYFtRn992lcx7VFcftWDW8cgUimkL+lkoLOFEoQESPB+8Mi/Op+dIifBH//yYTP 6WzUknvzYVEq2SC1aEUNJl8rolvEp2g7j8WIgSmwdJ91Zx6ZFRou5s7cYRVm+v/gJDzI kjz6fgXY2rGsAgGQpboaysbIvl8oxtC66gckGOmCp8MOCe67UnF2GMstUC3bEpDF3WYu KM8ABOYOV8xHgfGyp4lTh1sUvA/BjoBduec0kczWJcjpci/SWNEDfNvwQIWLCQbLkpL9 Uo3lTtzkU5u/SltG9RwPaJMx3ue4PogaMc3rK4GAmN2GeCoyZjIAwO/p9jDQlX/scYk9 gJHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759585; x=1716364385; 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=Buz2rJGX38jbC3oBTd0wt7g7ce1h+CXiegaHhEfcdIs=; b=mA7b5SV4LD2MIogkJcxeZcz90a1S/9kAcVrE53oJQmww/JMSv/wpqHr4u7RZDDKNZW hgEYmrHQd3q6jVhyg83li9rHNTp5w2LdPWnq+xvfHwhLOAJi51DYDuJqGFNgcYtFSPj2 HAUwmTtNwm69IOpvYA4BPg1awk7Vx2/gjhM/4diid3T6trJe9+NI15NlYg+b4gyCDJKN EeYJWXNnPTgsLBQ38MLewXdRiBOMQ7eEl8johS8zP74LoodhMLwh0nKGrzFM/hLHMu3/ pYGoXBWzp3/WwWTWFb603D3YVJy6O5Fm7Id149Z6Hy6HIYJ/tBSM49X2QnJH2MkxFz2u 5AcQ== X-Gm-Message-State: AOJu0YxlAf7ZUx9NWq795ZZ2k9VTNfCQflcx3xteLwrjUjmYpK7BiltQ BKRotqgYCfym3Mbyh9s9m9a18jIRwrI2qIhENS+Jq8XUVXKta4DpfBi8210tERTXMkkS2ojzFdW 0i6w= X-Google-Smtp-Source: AGHT+IEvG6KUX9ZYs3fUnzYjoltUOmqG0CyWAdl/z0IbAxaD4I8bbCYOGEv6KD1evtjs1EHrnHd25w== X-Received: by 2002:a05:600c:3c85:b0:41a:1b3f:b465 with SMTP id 5b1f17b1804b1-41feac55fb9mr114327895e9.26.1715759584963; Wed, 15 May 2024 00:53:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: "Edgar E . Iglesias" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 24/34] target/microblaze: Use translator_ldl Date: Wed, 15 May 2024 09:52:37 +0200 Message-Id: <20240515075247.68024-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075247.68024-1-richard.henderson@linaro.org> References: <20240515075247.68024-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x333.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, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715759646712100003 Reviewed-by: Edgar E. Iglesias Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/microblaze/translate.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index 9746a6d479..4beaf69e76 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -25,7 +25,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" =20 @@ -1637,7 +1636,7 @@ static void mb_tr_translate_insn(DisasContextBase *dc= b, CPUState *cs) =20 dc->tb_flags_to_set =3D 0; =20 - ir =3D cpu_ldl_code(cpu_env(cs), dc->base.pc_next); + ir =3D translator_ldl(cpu_env(cs), &dc->base, dc->base.pc_next); if (!decode(dc, ir)) { trap_illegal(dc, true); } --=20 2.34.1 From nobody Mon Nov 25 09:55:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715760023; cv=none; d=zohomail.com; s=zohoarc; b=HfoqQsL9MCPhPF8KVizQlBT+IXG7dgNDPy2cQSnlIQi3hRgQCyxtzunphVkSH7qg0GYk96tMpxB/fBLa+MhYipZFxnkAVeup2lRRIZRoRMIP+uumyoIueGzpT+cpvMIcuXEOXmG2w3lh3FY6T3cuIfavRPsta8a01f+qaRvFaBo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715760023; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=w1Iksx0xg6rkS7/ro1+ykm+RdeutCXftoxj1EQCWqvE=; b=DhC9VsOvNYgLPRPcpiLhmQ1iTd0tdbFITheVnWwn/WyYw2+VKVMbO+mtIcMHPw+SV2RS9BxsYifjWxytWVYYJchfG94hrxJdU36gdT9WiWrH/xn+gi3PZsfykXSl2OPw/IB1p/+NLU31h3Ow/FkNLBkZFsq54cBYm9Hu0Oe3xJY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715760023492280.5028471175784; Wed, 15 May 2024 01:00:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79Rw-0004Z3-VN; Wed, 15 May 2024 03:53: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 1s79Rt-0004Iw-Dt for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:17 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s79Rn-0001cl-9M for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:15 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-420180b5898so18898685e9.2 for ; Wed, 15 May 2024 00:53:06 -0700 (PDT) Received: from stoup.. ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm222611855e9.37.2024.05.15.00.53.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:53:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715759585; x=1716364385; 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=w1Iksx0xg6rkS7/ro1+ykm+RdeutCXftoxj1EQCWqvE=; b=AcTCks7ZXlrRoD6k9NYRDtlSlg4MJxXVO3AE/H59mRhvEDIgPu5n+9MGsYjVYfxdsp 8zPPO12HemaNvjg7iLr6zsfIjdiRL7CUpTxiVzSBeFKHl0UDOitEKBki56KZ1hEfPjzd MNWpVcpQA3UIfExMUqozfkrDqKypCLoxrJdXe/p0ZwNq+lksnchkRTEm5BeMUavGjwap cJJYzSKxDBIAFcyfLcoyG68otni5AdFvN1gATRIpuGnhzAbR8XBYH/adX2E+SiOdKwVD 71aBhDQbkxMhGyDX89UVJsXb4VVzVTjgWcDXtwCuWHHVbIAB80SiDUTbLA+BHvDJLLZD K1tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759585; x=1716364385; 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=w1Iksx0xg6rkS7/ro1+ykm+RdeutCXftoxj1EQCWqvE=; b=L2OgMa/AE0NC+1OzQdNQJ81N+g9vKT3DjhLZ14hXYJ4LilD8JsmCCK/Z4MOD6g97aP gMZtrNhDwz+6G42mAxsqibBATyF2fmppy5VUixYlGkpvAmaGPDAEuWNMYZ4SQker1HSr RPNXBbpbCTCYCy2co7i5gR2QABNUIC6GyZQMN+aAwyTUEYo7r+dy3krknjFmBTCb2lye M1HY8L+c3FF2RDmXwomlA82fvzbONlipdM1pEnmj/hitI0Y5ThpZVj7PFzvLEszUfYPD 5iwFcRZrLAUjRJwMofJBm9Wf+9+AtjWpiQZftA6cuNkV7Rbr0dpc1bUmyDjTtmFsJLZ4 rVgw== X-Gm-Message-State: AOJu0YzAa7xMfk0E1y+fYKCvldFZOqZIFiGOO7UPFmuFupYMmRK5mRG+ ZltoUQRVr8excnnA2DAI2cVsNxLJoSFHqtQQg5FtG4jGsxLgBeRZGh91BWNWAIyS2RSLGGG1uhi alhM= X-Google-Smtp-Source: AGHT+IEBpIyLlO16pgWXieYAbkU6dvgAstujjFoyknlqICADJ2UeirTJikohJBuI2D+1s/YmT4fG8Q== X-Received: by 2002:a05:600c:3582:b0:418:29d4:1964 with SMTP id 5b1f17b1804b1-41fea539b5amr109852045e9.0.1715759585480; Wed, 15 May 2024 00:53:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 25/34] target/i386: Use translator_ldub for everything Date: Wed, 15 May 2024 09:52:38 +0200 Message-Id: <20240515075247.68024-26-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075247.68024-1-richard.henderson@linaro.org> References: <20240515075247.68024-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32b.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715760024266100001 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/i386/tcg/translate.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index ed601474a9..76be742580 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" =20 @@ -1579,9 +1578,8 @@ static uint64_t advance_pc(CPUX86State *env, DisasCon= text *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 =3D - 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); } @@ -2177,7 +2175,7 @@ static void gen_unknown_opcode(CPUX86State *env, Disa= sContext *s) =20 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, p= c)); } fprintf(logfile, "\n"); qemu_log_unlock(logfile); --=20 2.34.1 From nobody Mon Nov 25 09:55:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715760047; cv=none; d=zohomail.com; s=zohoarc; b=RwL5c6AOBLdoDf5NSAt77heIKpMvGbgVvSdV3yjSj8/bWiampVrxA/ohvbyEjdMvmvRx1RP5XgHSyo8g6RmhOzC+P2qtENhyT7pmV5Uo73wgQUCkEvGhxIQ1r5aBg5FOATez9E4yXpnq5a0FskOLrzdeGBu7wHp5XKqxikMxHQ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715760047; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Ku4i14FBhF0AsxG1wJUIaWCeb9p5uUrtgrDPrlUkN+c=; b=AsNh6O4yQwAL0xbKCG7F9BLytffAQOT3PJhy6p/eHhnNtmi5s+hrIpXy34na7A944qXZzPgNfKxYlgJhqR+SbalBQToTAZIpJSj73pGCaGZuPmBgSmcoQgCO6mzYJIdbpv6RJ5O5BGQlYcAimwQfaHGhpS9Yc1r5rSh1GOvcCYw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715760047447515.0614670526414; Wed, 15 May 2024 01:00:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79Rw-0004Vy-0W; Wed, 15 May 2024 03:53: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 1s79Rq-0004Gj-FA for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:14 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s79Rk-0001d8-Jl for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:11 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-42011507a4eso25417035e9.0 for ; Wed, 15 May 2024 00:53:06 -0700 (PDT) Received: from stoup.. ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm222611855e9.37.2024.05.15.00.53.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:53:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715759586; x=1716364386; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Ku4i14FBhF0AsxG1wJUIaWCeb9p5uUrtgrDPrlUkN+c=; b=zPnvyqIzRU+0khccIslBlZteWGSRtXlbDfusDw7cBW+AWJn33DAdlGBmcIM9cAD2hP rjnQNfY6qMeqShcbYCMa2qiA2kMgahCWmt2tfkLNcET/oJqU+rusBs6LvBGGs/Xy0XhM ig46lqb1omcgfxII39ZkLa9sk47H73AR3mLQ6QSxO4HkXU+S9GCPsBM9b5H5nVVeMhxS PgBNTgvuhX335eXlh+sa6jZWiMkZ3AnzZoUjNJOzqEJXgp0GjlKwuaKoszbkjfWvRe37 GooNAkJScv2D0lZygkEY+QOJ/mJlCCp38z4vhSzCxdJXDZcaOMlf8SYRjdztlPXLbRk8 3geA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759586; x=1716364386; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ku4i14FBhF0AsxG1wJUIaWCeb9p5uUrtgrDPrlUkN+c=; b=qBBqy14AS4wC/5fp5TsZqt2yffnmVIzUbChEp77xEQbX1te6BeikcQa4nQ+gekeMja NDnjCZEfASni6drlNYx9qksmRej/fyaP3C6ohQbW1rwPq4gITzDUVBMmEZKtPFf6H6iK t+G3bC2mxazr9fIVSC7jAi+EucSEK2KHNh+JlbBSjl2qFIjG3JXlKbrS1lh8Ag49VNa7 FZbRf+RfCoFdbA51R6lwucFTt3QxRoiiSZTCjAHvILc1VLCsOAnp9bJPmYmWCBWfYpbo 9Wx1ii1AJuEpidnoRjiikIl8idpLnR4Pk/G2OqcIHLCtfH6ravnJOJrGx29qnFgBTjHc Uh/A== X-Gm-Message-State: AOJu0YyrSjU7dEM2GqdONST+PFw5FOeMrabldTywjO+qWwPAKE1D+1WD l4c2CbdkgsDmaSGC8f7tzY1doFQ8A1TfmNsLgO5Ie5Xni7kRxvZPuPh/8Pc34oEHAwFZ3hXTQYH aldk= X-Google-Smtp-Source: AGHT+IE7Bb3zterA9QR8RBkRFovf3Cx3hT8E5GYmlAKrxCjMWHadLQV/V0ovDwt+gavKcmmOZEHilA== X-Received: by 2002:a05:600c:3baa:b0:418:6138:6777 with SMTP id 5b1f17b1804b1-41feac5a42emr122834705e9.31.1715759586025; Wed, 15 May 2024 00:53:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 26/34] target/avr: Use translator_lduw Date: Wed, 15 May 2024 09:52:39 +0200 Message-Id: <20240515075247.68024-27-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075247.68024-1-richard.henderson@linaro.org> References: <20240515075247.68024-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x329.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715760048382100001 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/avr/translate.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/avr/translate.c b/target/avr/translate.c index 6df93d4c77..2d51892115 100644 --- a/target/avr/translate.c +++ b/target/avr/translate.c @@ -24,7 +24,6 @@ #include "cpu.h" #include "exec/exec-all.h" #include "tcg/tcg-op.h" -#include "exec/cpu_ldst.h" #include "exec/helper-proto.h" #include "exec/helper-gen.h" #include "exec/log.h" @@ -173,7 +172,7 @@ static int to_regs_00_30_by_two(DisasContext *ctx, int = indx) =20 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); } =20 static int append_16(DisasContext *ctx, int x) --=20 2.34.1 From nobody Mon Nov 25 09:55:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715760013; cv=none; d=zohomail.com; s=zohoarc; b=BvUmUvRJ+kD7kQV4EWblyoKIhAazW/7TCtzKUuOLi53jjSetlDFwesU1vdQx/F3DVHbPFMNQ3URcabdOOH+AzzEFsW25QzU8Z1z7YJYQf3x4nSy7fVt1Fcw5FkcgM8yqQhUtlojzFLO0PwPSiF+8R33IC+3NbMr854JoRrGUrpA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715760013; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=LFwVHeO0xdQZE4q/p0sWN9ZrSqg0kbbJP7VPGYxlODk=; b=W62QRvzsx4dGMMgh8B3oryK8iCXFjn6QSDLQBbCBNU5UR74iQEMgwaZucbSjoHwkpj0z1bwscikCBcU1M3BMoJrK97B6l5JlUi84wXLKlzGT9wkBD4PJ3+K1dNY07n615z2fU+aef4hz/yd0Y5EyKDtnupJadhw/EXjVdrZp0Ow= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715760013608691.6531566888578; Wed, 15 May 2024 01:00:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79Ru-0004QN-Re; Wed, 15 May 2024 03:53: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 1s79Rq-0004Gd-Dp for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:14 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s79Rl-0001dI-Ul for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:13 -0400 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-420104e5390so38425885e9.1 for ; Wed, 15 May 2024 00:53:07 -0700 (PDT) Received: from stoup.. ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm222611855e9.37.2024.05.15.00.53.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:53:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715759586; x=1716364386; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LFwVHeO0xdQZE4q/p0sWN9ZrSqg0kbbJP7VPGYxlODk=; b=XRQJUHcVK4WDZvmB7IUyCpsvozkpcvk8sLigeUhJFdBjepKS3GbVH4CLImPvxLsqSp fcpmETKVP0z3D1ZTRjMz+OPvV+WfABIWwif51FxxjuR1sXGUFO4/qCC5/ex+ICf/Nj0C R7Wh2fftRKhf5n85f4q6XiEMlXJ7iItHMFar/33JdnV9UB/ArsH0IOiAlPqu7El5mfR1 u2mvyf0Ic+XxLBOa2vchx0EIoz9yiG8k6GclGGl5i8OyRu4A9UlJsnJsb4aDakLmqYjZ POchqwsJoGxYwxgGm9y2aD+aq1aE0w3QFJgVlG47ZwT99XcdEHIKA7wQQFuvju7OQqR2 pufQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759586; x=1716364386; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LFwVHeO0xdQZE4q/p0sWN9ZrSqg0kbbJP7VPGYxlODk=; b=nGjAhUoMF26QDBuKFYtP6PYZlZ1+8MBzIGa3EG8lDGaX4ZDkO9WqLeuxY8IvGvIMXV BB+Cr7on9qfgUa18Ua0Ly8WzuTY4e/+VuwJy7Rakw2JegdoDSQtLeJnVcY2HAe3WpLli lX226T3DUnFvHQFDInqfiINEj2TKRDSuWeNd887rbr+pA3VejV2qvVMag0NWaHuVN983 HqFxNLnXaG/HdnFSbBNzzYN7q7fKAmfLMMrRRIeVdrLcdnx7wsAoA8AknZ2hdLOXcXQO VksNUwQqZ+Mc+oVvEWWCj4dMoiqVvn1S550Tnpo/ov4LQc05C8fBPw9JLXKIoqRFmstE uOKw== X-Gm-Message-State: AOJu0Yw0AJbIkIyisw1W8qYBTcf2gyrrk4To1QU0v3xXaAWs0eOnL4c3 OiRK29YrFV3W5fc1Tg5X44/dL4Ni+/BrrW10HYc4/i8pHAt4BHMbkV9/yip3s4eJH7LB/BDdxYk BSxM= X-Google-Smtp-Source: AGHT+IGOETvF3LQAfb1YTNsF0Y25Xv8dhD7jMHwTl+3Hkv7dpl8zzP4fXV2Z+k/j1NWJQqbcmW0Zkg== X-Received: by 2002:a05:600c:19c8:b0:417:e60b:91f6 with SMTP id 5b1f17b1804b1-41fea9324d9mr164134675e9.4.1715759586628; Wed, 15 May 2024 00:53:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: "Edgar E . Iglesias" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 27/34] target/cris: Use translator_ld* in cris_fetch Date: Wed, 15 May 2024 09:52:40 +0200 Message-Id: <20240515075247.68024-28-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075247.68024-1-richard.henderson@linaro.org> References: <20240515075247.68024-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x333.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715760014219100003 Reviewed-by: Edgar E. Iglesias Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/cris/translate.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/target/cris/translate.c b/target/cris/translate.c index b5410189d4..bb2d6612ba 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -222,37 +222,28 @@ static int sign_extend(unsigned int val, unsigned int= width) } =20 static int cris_fetch(CPUCRISState *env, DisasContext *dc, uint32_t addr, - unsigned int size, unsigned int sign) + unsigned int size, bool sign) { int r; =20 switch (size) { case 4: - { - r =3D cpu_ldl_code(env, addr); + r =3D translator_ldl(env, &dc->base, addr); break; - } case 2: - { + r =3D translator_lduw(env, &dc->base, addr); if (sign) { - r =3D cpu_ldsw_code(env, addr); - } else { - r =3D cpu_lduw_code(env, addr); + r =3D (int16_t)r; } break; - } case 1: - { + r =3D translator_ldub(env, &dc->base, addr); if (sign) { - r =3D cpu_ldsb_code(env, addr); - } else { - r =3D cpu_ldub_code(env, addr); + r =3D (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; =20 /* Load a halfword onto the instruction register. */ - dc->ir =3D cris_fetch(env, dc, dc->pc, 2, 0); + dc->ir =3D cris_fetch(env, dc, dc->pc, 2, 0); =20 /* Now decode it. */ dc->opcode =3D EXTRACT_FIELD(dc->ir, 4, 11); --=20 2.34.1 From nobody Mon Nov 25 09:55:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715759708; cv=none; d=zohomail.com; s=zohoarc; b=cczCXSAu8m+HGamriqyNCIVHfxLz6WVdCRCmGee+yH3FLLr4cpxWCBM3Tv5/W4SMCjnCykS60x/iNDkvDzAeyQNre1L61DIsYlfpSRBbmVzr+XRqM0WUBHCIIUEcgnpejdK9C51PhmBLzZ5n7l+zBdz0IK496+AqFScTnIzAIl0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715759708; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=eL11UZGpeVEq4VOMmX63mOyK3p1fvPoFDCh9Izq0OCE=; b=WrCt531YPJgNTJkYEOJxEQT1PQ57Wcl8E+LpmLNpHwyBcLCSawutTfhpQkihw3Mz//PVVEA/R8Mw6x5vdQ9auDleFGuaLnD7F++LchCUGUNzcFxFtywjtkV9ssbFJRsgU7D60yn8eBkSa+QQJTkeDuLhyFUke2vybCbDAuJKNCo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715759708572270.71487375004494; Wed, 15 May 2024 00:55:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79SH-0005EV-Be; Wed, 15 May 2024 03:53: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 1s79S9-0004zk-02 for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:33 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s79Rq-0001dX-3N for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:29 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-41ffad2426eso48855545e9.3 for ; Wed, 15 May 2024 00:53:09 -0700 (PDT) Received: from stoup.. ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm222611855e9.37.2024.05.15.00.53.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:53:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715759587; x=1716364387; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eL11UZGpeVEq4VOMmX63mOyK3p1fvPoFDCh9Izq0OCE=; b=YqW1ne0wbfEmTAQ6YGipyOh40h3jYChNGgRhu+GhMQRvEpTVQDW2mxy/8hxYmmZNKf 11ysBKHCwSLo3rkiuEN1/gh8jhOZSlCUM+OLtbck4Fpasoi2d+OqQlLwUPB2PPmyU6fK 1jWrr8G5WtIuyWiZ3GvaLZq+e1BUOnfyOIF8+dAlqgOTLgBrYFRn4D4KUM7HSu3I1t1t p7isAXYXhtU2rpULsw1hhoi5bRWZQnjkN01OUwKOeiMifqZZqM/xSuQk44kXpH7DlfI6 aW1KDhpnbDNVtf560UXXl+ivVuNLOIXaf1Tw1i1I9i86MgdN220dlSvGR7ZCgUCiLTk6 AATA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759587; x=1716364387; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eL11UZGpeVEq4VOMmX63mOyK3p1fvPoFDCh9Izq0OCE=; b=D02rpOmMD86Pp6pnvmlil87dWm/9tNVFRFeSAYwbDArYdx/8R1VSVcOVBUiahQnQG6 N6zoOVdhNx5+3b+JiKC/a3gL0uFd/UVfzgr2atH/8rIjbx2F30vHi98LILBbOVfq3TLP SZhooZYwLK9yMrtagByO8glmPnaJBAIID8e3QYJoQPaClc2oWKzRwZ/U5V6HHN6gb0UO D/NXGePrI6b4gFZXI+foHRarwFxKcJs0ScVsgkorpJE/2t1IEsV7kg4MlBph/aNV1bo5 7gRlKZqkDI1qW2WAucUaomFCA0DuIX9bfqJ0UaPTidtt6tvH6K3gieof4ig55hfnagth L1rQ== X-Gm-Message-State: AOJu0Yzh8QEPJNxrli1+F+J7OyDXWwQvKiKZAZwK3GKRdVqL2vznRAMJ tniluRRKtP1gNkW+XJ7MJXHp23mwsmk1Pvk6i3Ic990u/pAc1+StYTpj88fvj5EPJWwmRAnaaeg 3abI= X-Google-Smtp-Source: AGHT+IFWfjLXa9LYDR5qQr8r+P6kEXiByx6F3yXEGMlFhXPunmGheVa47iBiiQ8Xmr+FcQDvAyd7yA== X-Received: by 2002:a7b:cbc2:0:b0:41a:225f:becc with SMTP id 5b1f17b1804b1-41feaa44406mr139063775e9.21.1715759587325; Wed, 15 May 2024 00:53:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: "Edgar E . Iglesias" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 28/34] target/cris: Use cris_fetch in translate_v10.c.inc Date: Wed, 15 May 2024 09:52:41 +0200 Message-Id: <20240515075247.68024-29-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075247.68024-1-richard.henderson@linaro.org> References: <20240515075247.68024-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x336.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, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715759709145100001 Reviewed-by: Edgar E. Iglesias Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/cris/translate.c | 1 - target/cris/translate_v10.c.inc | 30 +++++++++--------------------- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/target/cris/translate.c b/target/cris/translate.c index bb2d6612ba..a30c67eb07 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -29,7 +29,6 @@ #include "tcg/tcg-op.h" #include "exec/helper-proto.h" #include "mmu.h" -#include "exec/cpu_ldst.h" #include "exec/translator.h" #include "crisv32-decode.h" #include "qemu/qemu-print.h" diff --git a/target/cris/translate_v10.c.inc b/target/cris/translate_v10.c.= inc index 73fc27c15d..c15ff47505 100644 --- a/target/cris/translate_v10.c.inc +++ b/target/cris/translate_v10.c.inc @@ -165,20 +165,7 @@ static int dec10_prep_move_m(CPUCRISState *env, DisasC= ontext *dc, =20 /* Load [$rs] onto T1. */ if (is_imm) { - if (memsize !=3D 4) { - if (s_ext) { - if (memsize =3D=3D 1) - imm =3D cpu_ldsb_code(env, dc->pc + 2); - else - imm =3D cpu_ldsw_code(env, dc->pc + 2); - } else { - if (memsize =3D=3D 1) - imm =3D cpu_ldub_code(env, dc->pc + 2); - else - imm =3D cpu_lduw_code(env, dc->pc + 2); - } - } else - imm =3D cpu_ldl_code(env, dc->pc + 2); + imm =3D cris_fetch(env, dc, dc->pc + 2, memsize, s_ext); =20 tcg_gen_movi_tl(dst, imm); =20 @@ -929,10 +916,11 @@ static int dec10_dip(CPUCRISState *env, DisasContext = *dc) LOG_DIS("dip pc=3D%x opcode=3D%d r%d r%d\n", dc->pc, dc->opcode, dc->src, dc->dst); if (dc->src =3D=3D 15) { - imm =3D cpu_ldl_code(env, dc->pc + 2); + imm =3D 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 +=3D 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, Di= sasContext *dc) if (dc->src =3D=3D 15) { LOG_DIS("jump.%d %d r%d r%d direct\n", size, dc->opcode, dc->src, dc->dst); - imm =3D cpu_ldl_code(env, dc->pc + 2); - if (dc->mode =3D=3D CRISV10_MODE_AUTOINC) + imm =3D cris_fetch(env, dc, dc->pc + 2, size, 0); + if (dc->mode =3D=3D CRISV10_MODE_AUTOINC) { insn_len +=3D size; - + } c =3D tcg_constant_tl(dc->pc + insn_len); t_gen_mov_preg_TN(dc, dc->dst, c); dc->jmp_pc =3D imm; @@ -1164,7 +1152,7 @@ static unsigned int dec10_ind(CPUCRISState *env, Disa= sContext *dc) case CRISV10_IND_BCC_M: =20 cris_cc_mask(dc, 0); - simm =3D cpu_ldsw_code(env, dc->pc + 2); + simm =3D cris_fetch(env, dc, dc->pc + 2, 2, 1); simm +=3D 4; =20 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 =3D 2; =20 /* Load a halfword onto the instruction register. */ - dc->ir =3D cpu_lduw_code(env, dc->pc); + dc->ir =3D cris_fetch(env, dc, dc->pc, 2, 0); =20 /* Now decode it. */ dc->opcode =3D EXTRACT_FIELD(dc->ir, 6, 9); --=20 2.34.1 From nobody Mon Nov 25 09:55:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715760017; cv=none; d=zohomail.com; s=zohoarc; b=SKBP/MW41fJ5FVVheAZIuqIq0zXFSRQB2WmyqU7+OHwd6W99l4REz+DspiiR1vhPzAK56nRQx/Pk6kJIa7wznfn99mvaqGgDn19pkEhvhElCw74oJ/KghFtl51sMnHdMGTkoQU/uRX/XjmaaqiEdXHzv/2HVQOuIacFDLmHrEDM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715760017; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=+OfPp6+r7Zf3NKTXpMRuMvIJCtMgZRIBNwDS9FcnyZQ=; b=Lx5V9urliUDYv2apm0hINzOs2uj03COB4JUIlzavSerUPrQk4MJql6K75P6LWuMiT9N6j6MeHJiekUWJC2W94zm6T3zuuYsWry3h84yqz8m50NkCRmBOO0dMWyigc9itbY+UTj5ajk7vR5/RoQPwkMHkBqrGfc7HVnoMqKdWTTU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715760017517527.512124434428; Wed, 15 May 2024 01:00:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79S0-0004eg-4K; Wed, 15 May 2024 03:53: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 1s79Rv-0004Ty-HM for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:19 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s79Rq-0001de-4Q for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:16 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-41fd5dc04e2so39976405e9.3 for ; Wed, 15 May 2024 00:53:08 -0700 (PDT) Received: from stoup.. ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm222611855e9.37.2024.05.15.00.53.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:53:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715759588; x=1716364388; 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=+OfPp6+r7Zf3NKTXpMRuMvIJCtMgZRIBNwDS9FcnyZQ=; b=WMqI9hQGNOVFL0sLwB/CM+TcgedPegvmOgyjvW/8qhuYztSmSuLSSC79zMPbxf1Qmn 7TOOrl7uUOFEMVOQpOpJEq0YHqd3cTppBi+CGu0IjDtrk9R26hkYO1PDAyc9Dp6lVlMf VvN3gT4bQ5TzMr8M4QH1gNnBltFNkacVELe6gQVUuEBb4SL1s3mKLMVKVA1lj7cKEtbX F6pSM2dP1YA10eMaPUE3IN7brdjwBTDomMwsXV7ZKfROnDohbRSI0QlSlkbgzR2mIU5S R0FK1m0Ae4u30e44CfnKAsGKBtJbewHuar5FBheCNqtcvr/xXN39WtnEitFfp7sxLk7+ XxRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759588; x=1716364388; 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=+OfPp6+r7Zf3NKTXpMRuMvIJCtMgZRIBNwDS9FcnyZQ=; b=f/Rz2o+e7z2eoAAbVFFb55D7b0cSY89YRGI3va45JXYoHF5l8EZ6jSnn9mUF0zyEMj K2LG9az3yZ1SoKdFBTtoKXLMe7Byeug0QJ+sUyBDwBnvkAm0hgD3iJOM/yUptIgXNUDZ nDIY60HvnjCWOp0U/UvEUej8pBXHcDQspum2JEO2m2R/nWjblB72N2JXGxefB9IVWWJf /dS3Yj7Xd2q/vMRx8kRB8mW5nA9l2zsJiq0R+7C2hBkqhG1LWLo0JDrhE2kVB6fvBJuu qQ9rWVXE5dy+JwUKTU2kVaotNee1qgdnZa494/9e52rqb5Y9/NKizdg1c9BajqY/e6KI FilQ== X-Gm-Message-State: AOJu0Ywq8SV8/3RHOvhbsCHYP1pEOjP6hw8fuAcCLau4Idua7Y/KH1WN cb9dyfAgUV/osSxcnNbVLsnQ7P6LAxMKzy3OvQr+PIvgT2KuSoJ9WHFE91M5/GEotlJ2MHp/G/M luzc= X-Google-Smtp-Source: AGHT+IEQlDkr5WuAu1lurJV8ROi5DlydtsypbGiyYlSDnqLyo52JUi9WmuPvuwcqZPD0Q2Z3sdWiHA== X-Received: by 2002:a05:600c:5718:b0:41b:3c4c:211b with SMTP id 5b1f17b1804b1-41feab42a67mr102889535e9.22.1715759587870; Wed, 15 May 2024 00:53:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Alistair Francis , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 29/34] target/riscv: Use translator_ld* for everything Date: Wed, 15 May 2024 09:52:42 +0200 Message-Id: <20240515075247.68024-30-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075247.68024-1-richard.henderson@linaro.org> References: <20240515075247.68024-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x336.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715760018267100018 Reviewed-by: Alistair Francis Reviewed-by: Philippe Mathieu-Daud=C3=A9 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 c999e942e1..2c27fd4ce1 100644 --- a/target/riscv/translate.c +++ b/target/riscv/translate.c @@ -20,7 +20,6 @@ #include "qemu/log.h" #include "cpu.h" #include "tcg/tcg-op.h" -#include "exec/cpu_ldst.h" #include "exec/exec-all.h" #include "exec/helper-proto.h" #include "exec/helper-gen.h" @@ -1082,7 +1081,7 @@ static uint32_t opcode_at(DisasContextBase *dcbase, t= arget_ulong pc) CPUState *cpu =3D ctx->cs; CPURISCVState *env =3D cpu_env(cpu); =20 - return cpu_ldl_code(env, pc); + return translator_ldl(env, &ctx->base, pc); } =20 /* Include insn module translation function */ @@ -1243,7 +1242,8 @@ static void riscv_tr_translate_insn(DisasContextBase = *dcbase, CPUState *cpu) unsigned page_ofs =3D ctx->base.pc_next & ~TARGET_PAGE_MASK; =20 if (page_ofs > TARGET_PAGE_SIZE - MAX_INSN_LEN) { - uint16_t next_insn =3D cpu_lduw_code(env, ctx->base.pc_nex= t); + uint16_t next_insn =3D + translator_lduw(env, &ctx->base, ctx->base.pc_next); int len =3D insn_len(next_insn); =20 if (!is_same_page(&ctx->base, ctx->base.pc_next + len - 1)= ) { --=20 2.34.1 From nobody Mon Nov 25 09:55:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715759631; cv=none; d=zohomail.com; s=zohoarc; b=G+7xtgQuCy8MZLiHkcPrQ+1TN/AfXyof4wWM+78qFCUVkDw6F4OriTc13R7CTRZYVKpOcxVOcDiobnAbp+zKSbd26B+gOb/aztZUBtI+lMj3mPaP/EoX2dwhSRxTEXo52lU+rJDOVkByCYoIGOhnXvQxDqBuHpKXRHf60ipva9g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715759631; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=abuDTzJtuHQkleQ2JIJcQY+Wz/0ibhtmXe6lLhOCiLw=; b=KqTmz3kL7KcFFXcoa8TajGTuwB6NkD3m26R63LofCbKQG29DFj4dqvAvFZG/mtfzdWZWYydxfQm9TSWmftDdiW0SyYgevazcQMaEOahw/QN+eCt1GUyYuwlbq0YzSI95JFGsbCu8e3EE2rAgewzln2FM/GNtx83O13eZl9ZaJng= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17157596316831001.9899609724102; Wed, 15 May 2024 00:53:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79Ry-0004c2-32; Wed, 15 May 2024 03:53:22 -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 1s79Rv-0004V7-RD for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:19 -0400 Received: from mail-lj1-x22f.google.com ([2a00:1450:4864:20::22f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s79Rq-0001dn-5B for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:18 -0400 Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2e0a34b2899so97515561fa.3 for ; Wed, 15 May 2024 00:53:10 -0700 (PDT) Received: from stoup.. ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm222611855e9.37.2024.05.15.00.53.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:53:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715759588; x=1716364388; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=abuDTzJtuHQkleQ2JIJcQY+Wz/0ibhtmXe6lLhOCiLw=; b=i8fhWAB7/rX0k49UD5yYoZIPvYo+6JF1n74FzxcGOverPqNbrpsSe0ovChgDY93s4l FilXeHi/20SKR2F2qBKrXLGGpfGCncqYOv2H8L3vBxBismPpkz/9UCKaMJY1LeK5uP75 R6byzLwpCFSTJFDjwsjiZ8zoaU24TGL3BFVFQ8K69GLf8bQ8wUCjIAsR8V5sGa52onrk FDyquwuKizSCsv64AYAHg1SiqkGVvLzzPPRnUL12jcamoKnEesczytnV4Qrwuidt0n0w 1nF1YbZorfMcV4dxT4y7nh6/8gydseQq/kkKbA80kqgfZBORttC/drG60yhxFqx9I6TD OXjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759588; x=1716364388; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=abuDTzJtuHQkleQ2JIJcQY+Wz/0ibhtmXe6lLhOCiLw=; b=mx9lf2a3/oOKfrke6FCouFgKzbLF4RnpVL6EsaI3SlkWrrCRfR5PrnkYLlOLd1YW4z l3gMx4ppLZ+kUJZmmH2/gUgkNOp6++EH1dFEmY91nyH+03ByouLs9Jlur34ZlsAbvOBU XSqFxGscAiAV7xBVdEVHcuyu/I9AXVbAEZRsFdZN8ydoB8XKZBPqs2FX0Sf0iPpGUajz 66dN45cXvjK+763PfSEwm1DovoSi3rm68x3bBtaGj9mRaCRva1IDFlpl7dLxFWwK//1e 5IOAwI5a6ENPcUjUk5dBc6AgGcqEBBbeohC9vF5D9x5ziW9+BgyLGPqDpJoHuIpDBB0h e4jQ== X-Gm-Message-State: AOJu0Yy95NDpALtwdq7mcn+6mI4rq1XZPR8PTftzaYIGA3cBp9K7ysBk ur5GLDox/EKZG+/H/S47oR0SmpHEYngLXJHJ0Vs96r5dX77auA3f+trFc6M7LEMeqaV08Fx/Rv5 aM/c= X-Google-Smtp-Source: AGHT+IECnMss/1y9Z+0guqvKFeu/hxn8gS4VK1E99y8JSPGaKlkazWaT14GhgFvN9hMw+P33CV5e3A== X-Received: by 2002:a2e:9e19:0:b0:2e6:f7f7:772b with SMTP id 38308e7fff4ca-2e6f7f779d3mr10487091fa.37.1715759588492; Wed, 15 May 2024 00:53:08 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Yoshinori Sato , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 30/34] target/rx: Use translator_ld* Date: Wed, 15 May 2024 09:52:43 +0200 Message-Id: <20240515075247.68024-31-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075247.68024-1-richard.henderson@linaro.org> References: <20240515075247.68024-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::22f; envelope-from=richard.henderson@linaro.org; helo=mail-lj1-x22f.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715759632724100003 Reviewed-by: Yoshinori Sato Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/rx/translate.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/target/rx/translate.c b/target/rx/translate.c index 92fb2b43ad..9b81cf20b3 100644 --- a/target/rx/translate.c +++ b/target/rx/translate.c @@ -22,7 +22,6 @@ #include "cpu.h" #include "exec/exec-all.h" #include "tcg/tcg-op.h" -#include "exec/cpu_ldst.h" #include "exec/helper-proto.h" #include "exec/helper-gen.h" #include "exec/translator.h" @@ -75,10 +74,10 @@ static TCGv_i64 cpu_acc; =20 /* decoder helper */ static uint32_t decode_load_bytes(DisasContext *ctx, uint32_t insn, - int i, int n) + int i, int n) { while (++i <=3D n) { - uint8_t b =3D cpu_ldub_code(ctx->env, ctx->base.pc_next++); + uint8_t b =3D translator_ldub(ctx->env, &ctx->base, ctx->base.pc_n= ext++); insn |=3D b << (32 - i * 8); } return insn; @@ -90,22 +89,24 @@ static uint32_t li(DisasContext *ctx, int sz) CPURXState *env =3D ctx->env; addr =3D ctx->base.pc_next; =20 - tcg_debug_assert(sz < 4); switch (sz) { case 1: ctx->base.pc_next +=3D 1; - return cpu_ldsb_code(env, addr); + return (int8_t)translator_ldub(env, &ctx->base, addr); case 2: ctx->base.pc_next +=3D 2; - return cpu_ldsw_code(env, addr); + return (int16_t)translator_lduw(env, &ctx->base, addr); case 3: ctx->base.pc_next +=3D 3; - tmp =3D cpu_ldsb_code(env, addr + 2) << 16; - tmp |=3D cpu_lduw_code(env, addr) & 0xffff; + tmp =3D (int8_t)translator_ldub(env, &ctx->base, addr + 2); + tmp <<=3D 16; + tmp |=3D translator_lduw(env, &ctx->base, addr); return tmp; case 0: ctx->base.pc_next +=3D 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, T= CGv mem, { uint32_t dsp; =20 - tcg_debug_assert(ld < 3); switch (ld) { case 0: return cpu_regs[reg]; case 1: - dsp =3D cpu_ldub_code(ctx->env, ctx->base.pc_next) << size; + dsp =3D translator_ldub(ctx->env, &ctx->base, ctx->base.pc_next) <= < size; tcg_gen_addi_i32(mem, cpu_regs[reg], dsp); ctx->base.pc_next +=3D 1; return mem; case 2: - dsp =3D cpu_lduw_code(ctx->env, ctx->base.pc_next) << size; + dsp =3D translator_lduw(ctx->env, &ctx->base, ctx->base.pc_next) <= < size; tcg_gen_addi_i32(mem, cpu_regs[reg], dsp); ctx->base.pc_next +=3D 2; return mem; + default: + g_assert_not_reached(); } - return NULL; } =20 static inline MemOp mi_to_mop(unsigned mi) --=20 2.34.1 From nobody Mon Nov 25 09:55:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715759726; cv=none; d=zohomail.com; s=zohoarc; b=hqa1IVZuRT9/FnLVEhGhBm1lRRd8wCIp8A7XhEonYqe7VWmIiFWtQfwtZ6/sleW7zwBLT1rnm0qzqo4S9YVH85Ref9P8phAsVG2Jr8sxong8SbNkSmPeF8RHqKDxKhDelUMo1riSKZxM2CrBaYzzqLDs2NrdyvyE6efFQPBUpJk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715759726; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=QiNkoAsgvTetR5YHMAeB2w6OV5e9o48b6mfaDP+sgJw=; b=mL07Kpxx8x6mo8/Pkef4o0a+Riop1lq6sEWRQewz8vm4Dw4FNBeDufztsZnZ3zTmVW7d/+v+xLLbK4xp8x24sYQdwIDu9V6ZhSMcKX6LNeCfu9c0u9nzoRGZLfgsHz3EWLdzZvLXd0lnR3cnaeJLbnf9gUEwqeEsZS6kud3L638= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715759726620836.8480948365241; Wed, 15 May 2024 00:55:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79S7-0004hx-QO; Wed, 15 May 2024 03:53: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 1s79Rv-0004SK-6f for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:19 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s79Rq-0001dw-4Z for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:16 -0400 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-34dc9065606so3632448f8f.1 for ; Wed, 15 May 2024 00:53:10 -0700 (PDT) Received: from stoup.. ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm222611855e9.37.2024.05.15.00.53.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:53:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715759589; x=1716364389; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QiNkoAsgvTetR5YHMAeB2w6OV5e9o48b6mfaDP+sgJw=; b=bH4iHFd0WylPXXm7lSk2zxin8zZ+RH2Va+pcmE90CUEF/iY6FCxYYW+uci8U4M/UJd 3zW0+3MQdYzxlBq3dhb7/P8/xazgfeZbVUDyS4+F+t4TPOYiMzT7EtYTnuNU+HMtLT5P bg/aPPaaUfkcMrVwOZcLMh9XBcH41ImlFPke6/GXSl47djkZhpQfcwwBGzgEQBzcGQbr KaqfJ0sf1BYaa8GAKw9wgXY37lTMRPKYCsc4LoZ0k81LpSoxlvo+F98iiC89H/CZJaKY nMUTlrFag44uVe0Hk0jUqVlPCDsMumIDLCa8s7eRHIYqlSdtOdNgBTSAdQMPlAUCFQC1 DKwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759589; x=1716364389; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QiNkoAsgvTetR5YHMAeB2w6OV5e9o48b6mfaDP+sgJw=; b=hKSfkl9HCk7AO9EKoYpL7rn7RPj4cIt/sR+Xu01+azN5Fl+JBdNfhVPCCRSXQYHds2 6O0UwpbvRYpCo8JnRMSHvPaKf4DQMZdwED9KYFP7qjIKhOnghN2sIGwHvReOdrDRc/sW aLmj5zNmAhG6s2wApldlZsOipAeIZiqxAk2MuWR/dIUamvHp7D3aba1//OQ27SD1sFkg pYZWPA/mHr3wW8isCsVDEX1GQiCU2nUsHdoH/03K4mO3hXPOSdaFkNU87TeFN3NY+R2H ixGEJbzKEhR+sNJ0ILmJF1/aSdxHbUJoTSAlHqEltZ1I+nMa00TBlrO2eW6HjJiJMQd7 /mQQ== X-Gm-Message-State: AOJu0Yw3QvDcuM4VPECdXCP55ly48KWx9CCuAkwP7bGUFnpJvlpTnya3 16hHJilmr9dXPO51dEKxEPt5QX8BXMD8PyEkKlsOOBrHUm9oxBlpq9/MJRDYhWYJ0fNuX7o8Tgt Uus0= X-Google-Smtp-Source: AGHT+IFa5lz+aJFWzWdeNPo+a5lDnJVmqL8ykEb3fgQsqSUOGsekZ4nBrfV2SOvDaRcS0FgBjTO5rg== X-Received: by 2002:adf:e256:0:b0:34e:3d3a:e144 with SMTP id ffacd0b85a97d-35017fe1ed2mr14763582f8f.2.1715759589089; Wed, 15 May 2024 00:53:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 31/34] target/xtensa: Use translator_ldub in xtensa_insn_len Date: Wed, 15 May 2024 09:52:44 +0200 Message-Id: <20240515075247.68024-32-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075247.68024-1-richard.henderson@linaro.org> References: <20240515075247.68024-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x434.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715759727063100002 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/xtensa/translate.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index 42109d33ad..75b7bfda4c 100644 --- a/target/xtensa/translate.c +++ b/target/xtensa/translate.c @@ -35,7 +35,6 @@ #include "tcg/tcg-op.h" #include "qemu/log.h" #include "qemu/qemu-print.h" -#include "exec/cpu_ldst.h" #include "semihosting/semihost.h" #include "exec/translator.h" =20 @@ -1118,7 +1117,7 @@ static void disas_xtensa_insn(CPUXtensaState *env, Di= sasContext *dc) =20 static inline unsigned xtensa_insn_len(CPUXtensaState *env, DisasContext *= dc) { - uint8_t b0 =3D cpu_ldub_code(env, dc->pc); + uint8_t b0 =3D translator_ldub(env, &dc->base, dc->pc); return xtensa_op0_insn_len(dc, b0); } =20 --=20 2.34.1 From nobody Mon Nov 25 09:55:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715759648; cv=none; d=zohomail.com; s=zohoarc; b=Kv+2ArkofkpKEdShKHuefnx8RKWxaJJBl0GPq17e5n6j91I17EhVVAlF04z3iaqdkJ75rLOb73OquZmkdGv8WtwStRqJw7avjjAB7umXrCDtMUYsLrs8McVA3XEMDlL1cqPHbVaP9kFCcre6+ql5DbVwwkTf12bqP9VnkFu3qSk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715759648; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=SjyMRvjnIaY+m73p3izMShXRE/INt2PJeY5RjBYNjA4=; b=C587h2nXTH2ag61CiVT8LJDDqvI2DHs0QddQ1x+JSR3Ck9djaG/+3FAn6Yt/6HmgT4MJisQef1572PoCN2heG2xWYRE8rJSrJ4mt7gOO4A/5Fs+C/qa5r3ZCbeoaBUZ3Pa3g9sTep6B2JH6Vi50B05KRlBzE0JlCJvT0Bh56x8o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715759648398817.924386163911; Wed, 15 May 2024 00:54:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79S9-0004rf-9k; Wed, 15 May 2024 03:53: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 1s79S0-0004eO-TB for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:24 -0400 Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s79Rw-0001kl-IX for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:22 -0400 Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-51ef64d051bso7635232e87.1 for ; Wed, 15 May 2024 00:53:20 -0700 (PDT) Received: from stoup.. ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm222611855e9.37.2024.05.15.00.53.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:53:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715759599; x=1716364399; 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=SjyMRvjnIaY+m73p3izMShXRE/INt2PJeY5RjBYNjA4=; b=mwkZkJ1Is7ordOGTJs9GTt3CSKhggvUCxWl2qdS5CRKaYJj4gi7lszzoWxUgq5YIOt yu5NK3su8cT8VilFhYxFp5/+wCeGDvzEqrWC9vH1jrmJxOtXeaZqKw1Qv7t9wEvuFh1d VoMpk3tZiqUiEJudVXcwDewt1p+xWz7GtW20zVfxBLOZPonjz+e3H8b4xEb+T+XZO5cH ZuK2+eYghdBfmljKl38bhpskohGWP1R3AqWIrDH/BcCZxQES3+Ki2rfnOeZm7q56i0eA NY33d/xhS+u7I0W9uN3xWDBi/wI57B5rImWFDXyKhlNvuzl8iMpDVIuX5Ce9kK9XxAZV xpUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759599; x=1716364399; 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=SjyMRvjnIaY+m73p3izMShXRE/INt2PJeY5RjBYNjA4=; b=WjbtRLuX+aR6X3Xo62Fjh0bFhfqNw8ZBylhCbUxkJ/GiAGQ8HzRKhQtlEmlJwQ1bgP ONQ4L7Go5oQlxE5yvEliK2dTn24HkWJSTA8asinyOAS/SU4XBqLwlkzFwnXv3M/Y46Fd oZNnud9B6gA1T/vHaeVJfjUONysh75mTjxYXI7DzVdjoAs4ATxCmzZetPmVj44wuu+YR M06GG+sASSEsCqUeZ9n4MMmWHDDzHB9WPNCLs2DhYKfDfgFIA60bHU1h2JDbOcV9pdlf tJb3fRfVt/kbuEVMvadPvSHpQzlJ76nPlITe9Tmsb2ZOQEVDlMmJc+3PzrpvFVmPTbUP KC9g== X-Gm-Message-State: AOJu0Yy1OUxaD0Knh5S0uxcpmjPA7NaTyOjbUfbERmEdK12skj6dfKrZ WwFyCTl3OpYhApU0DLdfwCcDhkAxcIAtQggGqYvey9fIqP1TOTdNRDd6aCVYzwo8pJC/4gBzBvf JCvk= X-Google-Smtp-Source: AGHT+IGWd5DiXNIzD2An7mlb3hVLEPP7xH8/7s50yGf7sxaWHk0Iqj8JOir3lCjNDHWKtTahQSyCfw== X-Received: by 2002:a05:6512:3b86:b0:51f:3f6c:7466 with SMTP id 2adb3069b0e04-5220fe79356mr12985913e87.48.1715759589724; Wed, 15 May 2024 00:53:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 32/34] target/s390x: Use translator_lduw in get_next_pc Date: Wed, 15 May 2024 09:52:45 +0200 Message-Id: <20240515075247.68024-33-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075247.68024-1-richard.henderson@linaro.org> References: <20240515075247.68024-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::12c; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x12c.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715759648724100005 Reviewed-by: Philippe Mathieu-Daud=C3=A9 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 bac033c63c..ebd96abe6c 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -36,7 +36,6 @@ #include "tcg/tcg-op-gvec.h" #include "qemu/log.h" #include "qemu/host-utils.h" -#include "exec/cpu_ldst.h" #include "exec/helper-proto.h" #include "exec/helper-gen.h" =20 @@ -6471,7 +6470,7 @@ static void s390x_tr_insn_start(DisasContextBase *dcb= ase, CPUState *cs) static target_ulong get_next_pc(CPUS390XState *env, DisasContext *s, uint64_t pc) { - uint64_t insn =3D cpu_lduw_code(env, pc); + uint64_t insn =3D translator_lduw(env, &s->base, pc); =20 return pc + get_ilen((insn >> 8) & 0xff); } --=20 2.34.1 From nobody Mon Nov 25 09:55:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1715759733; cv=none; d=zohomail.com; s=zohoarc; b=i3epfwGAKEfiz+bBTNpAnQZN8DPz1gOW4uIy3u/RGFuZFGjaVuIT0BWNI1oyr6JBmbZLVNdU4P/LD//4/KaTGh0dfCEYdGeWx1fkhN2gmnIYGJbhr262ARIdK1fvxx5mAliVp9noLhixg6LT28BZoZyLQaGy/qkcJaOCVEzvxRw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715759733; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=WSsZfxq/88RzELsWEja85iYyfeFnMRpyB3iR3ue9fiM=; b=iM2hGQGx5Inz61gAhPp2Tf6u50GHkB4IoC+uZJSxZsxIov72cDm/fwIbwMNF0B7XlYjwlBK2zS6pbZ5rY8i2mmpnMSXDvGJEwhOJ0g0zF6V7FaDMGuV6JlQLTvvaz2ktWW8zZVaKCk5Os7Xfhf/ZYUAr+5jMIrmqe47oH4YWECo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715759733565160.84931972655; Wed, 15 May 2024 00:55:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79Rx-0004Yv-V1; Wed, 15 May 2024 03:53: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 1s79Rv-0004Tz-HD for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:19 -0400 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s79Rq-0001gh-4H for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:18 -0400 Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-52232d0e5ceso5661761e87.0 for ; Wed, 15 May 2024 00:53:13 -0700 (PDT) Received: from stoup.. ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm222611855e9.37.2024.05.15.00.53.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:53:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715759592; x=1716364392; 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=WSsZfxq/88RzELsWEja85iYyfeFnMRpyB3iR3ue9fiM=; b=pdzSkBZ0LYzyBr54fTxhWlgPgVSONkjLEtue0kzXyQTDQ+jmVi/Bm90H/np88nldf/ MLZT/CFwWWXVYRneU0g7M+6KTlvqfXjl31LqZzrLl27eZVNkP1uvk+FyQAGYT850Zih/ ZlJS86RPlTFV8ly1IF42zgG0G5oH3nofbpJLeHM7ZRyC4OySGIsEGZnd/oFXRd8C8jbb aH6psb/u1boMknUtwOzbgA0zAlEPhPTqvBdDBueu3kyQlvzInYpC3rH7cU/r4ZkG0euj HadHhGu3MKdZmimi5Amd/I9e9KYOPGzcaA0xoCXOPIMaQw6ffNGp+0o5LCaHTXsI3aNT YIeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759592; x=1716364392; 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=WSsZfxq/88RzELsWEja85iYyfeFnMRpyB3iR3ue9fiM=; b=CeK1JWlyrgN+qmjCoqrSW1CAVRe7s2uEoXaUIgkBW1+PwK3WopnsA+wFvMPwse/nrX sUumbyxAax/Rvnc/vf4ma519uNjMgq4eCUQeTplw1480U7Ipsv8bP5EGEbSGwOpsJwD9 olVX47bW2E387O3wMd98dZfKj+9ZljMHgY8TLlVlSCu0NZgyLQ1b1v6e7X3v5OVPz4M8 mMQg35WUaquTFuCTyGebF7iSptdFyO11LW3oPa+GYWNo2SSMRXOypiLLuQPJX5ccTZK2 2FVbJNBFVX4CzdW0AyEjP7sULYB9DFXwSpTjcEgg8hjJDNNtXR/Vl/NCJwpTxd5rPZWJ pH2w== X-Gm-Message-State: AOJu0YwGIh752tSONPcTSAAKXDnCfXrsmAp3+uI08mivSLRLSyrZ6CDn z0bnwo78H1wu+ITqw/m5sAue7OusLwd1htaGDEqZWv1blJjoHQM4gcIF3At6qCjYby0zF2p3OVB g9mw= X-Google-Smtp-Source: AGHT+IHAfYevWIF5gfrAkN8JVKdE0qnkv81sPd0hw/jWoJvrBX+3j6fPxbLp7+sEqoyDfcCIhpZOXQ== X-Received: by 2002:a2e:bb8e:0:b0:2d8:df61:9c6c with SMTP id 38308e7fff4ca-2e51ff66898mr82080741fa.20.1715759592234; Wed, 15 May 2024 00:53:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 33/34] accel/tcg: Remove cpu_ldsb_code / cpu_ldsw_code Date: Wed, 15 May 2024 09:52:46 +0200 Message-Id: <20240515075247.68024-34-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075247.68024-1-richard.henderson@linaro.org> References: <20240515075247.68024-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::129; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x129.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715759735082100003 From: Philippe Mathieu-Daud=C3=A9 Previous commits replaced them by translator_ld* calls. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20240405131532.40913-1-philmd@linaro.org> Signed-off-by: Richard Henderson --- include/exec/cpu_ldst.h | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h index 11ba3778ba..71009f84f5 100644 --- a/include/exec/cpu_ldst.h +++ b/include/exec/cpu_ldst.h @@ -355,16 +355,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); =20 -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 --=20 2.34.1 From nobody Mon Nov 25 09:55:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715759657896311.36155565807167; Wed, 15 May 2024 00:54:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79SB-00052v-5I; Wed, 15 May 2024 03:53: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 1s79Rx-0004YM-N6 for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:21 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s79Rq-0001gv-Eu for qemu-devel@nongnu.org; Wed, 15 May 2024 03:53:19 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-420180b58c3so20618575e9.2 for ; Wed, 15 May 2024 00:53:13 -0700 (PDT) Received: from stoup.. ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm222611855e9.37.2024.05.15.00.53.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:53:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715759593; x=1716364393; 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=cTgwDkKTKvYMYNq8Uet4oTtWVQWuFqOkSWxaQArY+XQ=; b=Xk7gApZQVT/s981qYPLZYzXcApwprz71yHEuOKuhHh25m+NtaIipJskodOjhfLX7zZ M1KfW9dvz/vjk9D7tT/8TsMDVOKZpDkQPK8vlNQZj16il3jKFcuV6MLkRuG9xALFv4h1 YMftibV9tSa9aBfdkzf9eGr0pmlelW5RKSifzNnYP3TlPY/PrDRYuD/nDVhZwWpRGpBn wcbxAw3tBbq16Ue2NEL83oO4yP1RMaUlphGReOioIf8G3GASzRpvo6kVfAPqpigS5X0U nfGyx7YwdGHmPps6LbHZ/xm060VuGTXdlWi+bwFRBfdczf1wqQSnNt9I42OcXEW6TWaR CPfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759593; x=1716364393; 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=cTgwDkKTKvYMYNq8Uet4oTtWVQWuFqOkSWxaQArY+XQ=; b=KCqrff5hXEWEAtPfE4O8KGae9tqs9PqCOlVzoCeh0skEl5oQxCFi59xzsY3z9N1+Cn 266rcVmWDEI5+RDpayaqZUPOtE7XOYpgxO8JlIu23tvb4d2OB83K6St6Swn5UJMLm5OQ AIIrArd0R4xJfxlD5X52bLVXaNB0M87eweiRv7dBAAjYQzREzCbztTDC/73cDL5DKH9I CdQ2RdY1kbKMWPIUE7lefsskO6BZ00ssltf1aenDa0gtBWKu9yVc87NY+0LbQVdVND0m sAnLhr/C5cVMg7N1hooU0hleSk+JSelxFQZcnWRKFn2WUz46gbYQZudYHUAjC8/PxLcV cvAA== X-Gm-Message-State: AOJu0Yyc4zACiP7BAD/++I0Lophc24mV2DIrChLn+lATyCwxIoMKjreH xre7raiXDmr2C1c/PCCNhblR7+R1RZ1Fngrf1Gj1y+P2lyZFsp4nwcHNFeqtPJuzPhmPt/waXM/ HMgo= X-Google-Smtp-Source: AGHT+IG1IHyaS3pCmocit0fsBEC59lIXAGawYVGH3BJd6HRaXYGG0cEDZEtaxvr6PFrx6IymH4oMfw== X-Received: by 2002:a05:600c:4f83:b0:41f:b0e7:f299 with SMTP id 5b1f17b1804b1-41fea93a3cemr114580065e9.9.1715759592918; Wed, 15 May 2024 00:53:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Song Gao Subject: [PULL 34/34] tcg/loongarch64: Fill out tcg_out_{ld, st} for vector regs Date: Wed, 15 May 2024 09:52:47 +0200 Message-Id: <20240515075247.68024-35-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075247.68024-1-richard.henderson@linaro.org> References: <20240515075247.68024-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32d.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1715759659202100001 Content-Type: text/plain; charset="utf-8" TCG register spill/fill uses tcg_out_ld/st with all types, not necessarily going through INDEX_op_{ld,st}_vec. Cc: qemu-stable@nongnu.org Fixes: 16288ded944 ("tcg/loongarch64: Lower basic tcg vec ops to LSX") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2336 Signed-off-by: Richard Henderson Reviewed-by: Song Gao Tested-by: Song Gao --- tcg/loongarch64/tcg-target.c.inc | 103 ++++++++++++++++++++++++------- 1 file changed, 80 insertions(+), 23 deletions(-) diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.= c.inc index 69c5b8ac4f..06ca1ab11c 100644 --- a/tcg/loongarch64/tcg-target.c.inc +++ b/tcg/loongarch64/tcg-target.c.inc @@ -808,18 +808,88 @@ static void tcg_out_ldst(TCGContext *s, LoongArchInsn= opc, TCGReg data, } } =20 -static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg arg, - TCGReg arg1, intptr_t arg2) +static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg dest, + TCGReg base, intptr_t offset) { - bool is_32bit =3D type =3D=3D TCG_TYPE_I32; - tcg_out_ldst(s, is_32bit ? OPC_LD_W : OPC_LD_D, arg, arg1, arg2); + switch (type) { + case TCG_TYPE_I32: + if (dest < TCG_REG_V0) { + tcg_out_ldst(s, OPC_LD_W, dest, base, offset); + } else { + tcg_out_dupm_vec(s, TCG_TYPE_I128, MO_32, dest, base, offset); + } + break; + case TCG_TYPE_I64: + if (dest < TCG_REG_V0) { + tcg_out_ldst(s, OPC_LD_D, dest, base, offset); + } else { + tcg_out_dupm_vec(s, TCG_TYPE_I128, MO_64, dest, base, offset); + } + break; + case TCG_TYPE_V128: + if (-0x800 <=3D offset && offset <=3D 0x7ff) { + tcg_out_opc_vld(s, dest, base, offset); + } else { + tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_TMP0, offset); + tcg_out_opc_vldx(s, dest, base, TCG_REG_TMP0); + } + break; + default: + g_assert_not_reached(); + } } =20 -static void tcg_out_st(TCGContext *s, TCGType type, TCGReg arg, - TCGReg arg1, intptr_t arg2) +static void tcg_out_st(TCGContext *s, TCGType type, TCGReg src, + TCGReg base, intptr_t offset) { - bool is_32bit =3D type =3D=3D TCG_TYPE_I32; - tcg_out_ldst(s, is_32bit ? OPC_ST_W : OPC_ST_D, arg, arg1, arg2); + switch (type) { + case TCG_TYPE_I32: + if (src < TCG_REG_V0) { + tcg_out_ldst(s, OPC_ST_W, src, base, offset); + } else { + /* TODO: Could use fst_s, fstx_s */ + if (offset < -0x100 || offset > 0xff || (offset & 3)) { + if (-0x800 <=3D offset && offset <=3D 0x7ff) { + tcg_out_opc_addi_d(s, TCG_REG_TMP0, base, offset); + } else { + tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_TMP0, offset); + tcg_out_opc_add_d(s, TCG_REG_TMP0, TCG_REG_TMP0, base); + } + base =3D TCG_REG_TMP0; + offset =3D 0; + } + tcg_out_opc_vstelm_w(s, src, base, offset, 0); + } + break; + case TCG_TYPE_I64: + if (src < TCG_REG_V0) { + tcg_out_ldst(s, OPC_ST_D, src, base, offset); + } else { + /* TODO: Could use fst_d, fstx_d */ + if (offset < -0x100 || offset > 0xff || (offset & 7)) { + if (-0x800 <=3D offset && offset <=3D 0x7ff) { + tcg_out_opc_addi_d(s, TCG_REG_TMP0, base, offset); + } else { + tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_TMP0, offset); + tcg_out_opc_add_d(s, TCG_REG_TMP0, TCG_REG_TMP0, base); + } + base =3D TCG_REG_TMP0; + offset =3D 0; + } + tcg_out_opc_vstelm_d(s, src, base, offset, 0); + } + break; + case TCG_TYPE_V128: + if (-0x800 <=3D offset && offset <=3D 0x7ff) { + tcg_out_opc_vst(s, src, base, offset); + } else { + tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_TMP0, offset); + tcg_out_opc_vstx(s, src, base, TCG_REG_TMP0); + } + break; + default: + g_assert_not_reached(); + } } =20 static bool tcg_out_sti(TCGContext *s, TCGType type, TCGArg val, @@ -1740,7 +1810,6 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode o= pc, { TCGType type =3D vecl + TCG_TYPE_V64; TCGArg a0, a1, a2, a3; - TCGReg temp =3D TCG_REG_TMP0; TCGReg temp_vec =3D TCG_VEC_TMP0; =20 static const LoongArchInsn cmp_vec_insn[16][4] =3D { @@ -1820,22 +1889,10 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode= opc, =20 switch (opc) { case INDEX_op_st_vec: - /* Try to fit vst imm */ - if (-0x800 <=3D a2 && a2 <=3D 0x7ff) { - tcg_out_opc_vst(s, a0, a1, a2); - } else { - tcg_out_movi(s, TCG_TYPE_I64, temp, a2); - tcg_out_opc_vstx(s, a0, a1, temp); - } + tcg_out_st(s, type, a0, a1, a2); break; case INDEX_op_ld_vec: - /* Try to fit vld imm */ - if (-0x800 <=3D a2 && a2 <=3D 0x7ff) { - tcg_out_opc_vld(s, a0, a1, a2); - } else { - tcg_out_movi(s, TCG_TYPE_I64, temp, a2); - tcg_out_opc_vldx(s, a0, a1, temp); - } + tcg_out_ld(s, type, a0, a1, a2); break; case INDEX_op_and_vec: tcg_out_opc_vand_v(s, a0, a1, a2); --=20 2.34.1