From patchwork Wed May 15 07:52:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796901 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp2855501wra; Wed, 15 May 2024 01:00:17 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU1yXASdwlCFeH8tK278ZJrZGMjFctjV9tRc8coaCluuF8bIDlsfvsbxC52wu85QrNGw8PkIl5o31y7RTdBLqbb X-Google-Smtp-Source: AGHT+IHLJXrKdzyLGUxgP6gCA7IAkH0ZYZq5+RhDG5fknXTRqeTYUThqSHMyZTpnTn7dLge6NdBS X-Received: by 2002:a05:6214:2c09:b0:6a0:cc2b:dc03 with SMTP id 6a1803df08f44-6a16814637cmr183754146d6.1.1715760017535; Wed, 15 May 2024 01:00:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715760017; cv=none; d=google.com; s=arc-20160816; b=t7rlwueJ8JtYMBmLh7/WCltIrbMGtlwnmnXCg+l60k/+YKpQ6P0ZBTmlacGJkCBToT OUKUDf91rhaTCTDrkVKtrha/H7v8mZ9IC4iQcCsTzIut5JFt0sV4Hop3+U8u73Yg7kGZ vFXWcWlbEKxaELMAtfxFUQJQc/6+GoV8CyZX3wMyHWldiC9SRoNa80N1GO52Ns/0o8a0 rg9J0r7bPWvI+UcPpUeNyc0VcYob0/OwpaTHGAnm0MUlHbICTpT2m2+ZuytBID3xfbvW /9P2APQtlZm/v9MGWc+HZnFaWNy9M7ef3h0/9kIHy1wWXXBDWWTPpjjDvlhKTiEVnCik coUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QME3RTbGMfJpkg4v/+6E8q/97o230nz7+xr7hPnvphQ=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=r9xLeAKvm1f4P8lCDZ33sJ7dqDhPInfjdTaUEEoupnncIUNc8UYgtFZHJbT/VInDGT lTmAngutr126MqTqemWmWQ4vpWD0rY/OUlbio+MDlZqPWR02gLYevITxZD5NYJnFsaBz rlrFz2orLrDRC6zQ+cuwjkwplfmWiThr9dyaK2j6SLA9N+zPQ5d/m3WLTebPx2/XziGe 6gRVJSdVLWpncmnGMEYi3jBCbpfHl8vYAWWmv7EvoAN/mDAi5HXk1Cje/pjjQfcL4yo9 9Nd6GM1+qYdrcxfJjohJjVChVSTxwf8cErWNwxZRiZIZHMMwL2ASXBOeVrlor13QPy0T LOqw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XyJmGYik; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6a15f2f54e2si138765806d6.523.2024.05.15.01.00.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 01:00:17 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XyJmGYik; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- include/exec/translator.h | 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 @@ */ #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" /** * gen_intermediate_code @@ -185,14 +182,14 @@ bool translator_io_start(DisasContextBase *db); * the relevant information at translation time. */ -uint8_t translator_ldub(CPUArchState *env, DisasContextBase *db, abi_ptr pc); -uint16_t translator_lduw(CPUArchState *env, DisasContextBase *db, abi_ptr pc); -uint32_t translator_ldl(CPUArchState *env, DisasContextBase *db, abi_ptr pc); -uint64_t translator_ldq(CPUArchState *env, DisasContextBase *db, abi_ptr pc); +uint8_t translator_ldub(CPUArchState *env, DisasContextBase *db, vaddr pc); +uint16_t translator_lduw(CPUArchState *env, DisasContextBase *db, vaddr pc); +uint32_t translator_ldl(CPUArchState *env, DisasContextBase *db, vaddr pc); +uint64_t translator_ldq(CPUArchState *env, DisasContextBase *db, vaddr pc); static inline uint16_t translator_lduw_swap(CPUArchState *env, DisasContextBase *db, - abi_ptr pc, bool do_swap) + vaddr pc, bool do_swap) { uint16_t ret = translator_lduw(env, db, pc); if (do_swap) { @@ -203,7 +200,7 @@ translator_lduw_swap(CPUArchState *env, DisasContextBase *db, static inline uint32_t translator_ldl_swap(CPUArchState *env, DisasContextBase *db, - abi_ptr pc, bool do_swap) + vaddr pc, bool do_swap) { uint32_t ret = translator_ldl(env, db, pc); if (do_swap) { @@ -214,7 +211,7 @@ translator_ldl_swap(CPUArchState *env, DisasContextBase *db, static inline uint64_t translator_ldq_swap(CPUArchState *env, DisasContextBase *db, - abi_ptr pc, bool do_swap) + vaddr pc, bool do_swap) { uint64_t ret = translator_ldq(env, db, pc); if (do_swap) { @@ -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); /* * 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" @@ -294,11 +295,11 @@ static void *translator_access(CPUArchState *env, DisasContextBase *db, return host + (pc - base); } -static void plugin_insn_append(abi_ptr pc, const void *from, size_t size) +static void plugin_insn_append(vaddr pc, const void *from, size_t size) { #ifdef CONFIG_PLUGIN struct qemu_plugin_insn *insn = tcg_ctx->plugin_insn; - abi_ptr off; + size_t off; if (insn == NULL) { return; @@ -315,7 +316,7 @@ static void plugin_insn_append(abi_ptr pc, const void *from, size_t size) #endif } -uint8_t translator_ldub(CPUArchState *env, DisasContextBase *db, abi_ptr pc) +uint8_t translator_ldub(CPUArchState *env, DisasContextBase *db, vaddr pc) { uint8_t ret; void *p = translator_access(env, db, pc, sizeof(ret)); @@ -329,7 +330,7 @@ uint8_t translator_ldub(CPUArchState *env, DisasContextBase *db, abi_ptr pc) return ret; } -uint16_t translator_lduw(CPUArchState *env, DisasContextBase *db, abi_ptr pc) +uint16_t translator_lduw(CPUArchState *env, DisasContextBase *db, vaddr pc) { uint16_t ret, plug; void *p = translator_access(env, db, pc, sizeof(ret)); @@ -344,7 +345,7 @@ uint16_t translator_lduw(CPUArchState *env, DisasContextBase *db, abi_ptr pc) return ret; } -uint32_t translator_ldl(CPUArchState *env, DisasContextBase *db, abi_ptr pc) +uint32_t translator_ldl(CPUArchState *env, DisasContextBase *db, vaddr pc) { uint32_t ret, plug; void *p = translator_access(env, db, pc, sizeof(ret)); @@ -359,7 +360,7 @@ uint32_t translator_ldl(CPUArchState *env, DisasContextBase *db, abi_ptr pc) return ret; } -uint64_t translator_ldq(CPUArchState *env, DisasContextBase *db, abi_ptr pc) +uint64_t translator_ldq(CPUArchState *env, DisasContextBase *db, vaddr pc) { uint64_t ret, plug; void *p = translator_access(env, db, pc, sizeof(ret)); @@ -374,7 +375,7 @@ uint64_t translator_ldq(CPUArchState *env, DisasContextBase *db, abi_ptr pc) return ret; } -void translator_fake_ldb(uint8_t insn8, abi_ptr pc) +void translator_fake_ldb(uint8_t insn8, vaddr pc) { plugin_insn_append(pc, &insn8, sizeof(insn8)); } diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c index 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" From patchwork Wed May 15 07:52:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796879 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp2853712wra; Wed, 15 May 2024 00:54:12 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWbAHPYPyZK/dLcP0D6v8GpjwVeNPpDT52X4oDPgVtGh2uEiQqyuCGA3ZsRdPH5tD3sW0RfEdQKqfQfK9MF9z8o X-Google-Smtp-Source: AGHT+IEf76K487vnH147MSOW0luJEBSmgHO9wtLrWtZcF+EI6rLqZLNaQG+sAQAGTMJtdVJ1Ni1N X-Received: by 2002:a05:6214:5909:b0:6a0:5a42:9626 with SMTP id 6a1803df08f44-6a1681a15e5mr175231426d6.31.1715759652758; Wed, 15 May 2024 00:54:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715759652; cv=none; d=google.com; s=arc-20160816; b=xfSYqyIZdcvxnrkZl7SrvSmixpuznjK29mb/tUmS+T2BWDz6DSylpyTlUnq/9q/Zvm rdlqYz5o0C01hRNZddRxy7e9xo1fuTU1zBMrnh4HmHasoHGIVG87lA2Yii1Uzpc8mBwc FIsTT8Dsn+4kHo8hg5J3HH0j6uLj0pJCWVKX7c3MKTUPzL6bn6vw9DdpRRLhLKvfsn0q H/74SITY876c44wDsh+viOFuHoiRZ+XSQ7KNK5NJYYpJZZSqxbnOi2N0l1EEUplFExGa z/XpWewinlL7lIK3oG+wz235E7mh+ybhva/AY902c5f+3wB97TcxCDssqJ/menyvl1wx 9haA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=B1bT30jWis5RNXLNoiGpiK9Xlgt7r4X1awl1+hpB8zY=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=guocloT5IL5zn3OuikEDQ/L5ZPNLQ6QqoilAFCvoGv6RCohHnepLpLo8hF3zTq6jU2 sLLgTxkH+n64T4loY01ePUujp36bwLQFoXeAuQj6M8WIheHrXtKgl5deorUGc7qDKjT9 jY5nKkAphw+e32dbdKUsCjva6aq4T8jRX5wTPHS7w2vIdBtopL/xwng5+OH6iRap8AnH 6r3XziJSvPOOr1iY+zZuWhlxFvwrNYCfYNSJ9C4yzqWoHNVysqpf1yVzOuT+iKyAIui2 usxVVJgEo5uzL13tODFiSDwewRWo1aW9a0TDKEwhx94nbDj8qOEGadAFPcepNWra9xnv m30g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yplCe7Jb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6a15f2b738dsi135371686d6.331.2024.05.15.00.54.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 00:54:12 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yplCe7Jb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org While there are other methods that could be used to replace TARGET_PAGE_MASK, the function is not really required outside the context of target-specific translation. This makes the header usable by target independent code. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- include/exec/translator.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/exec/translator.h b/include/exec/translator.h index 51489c181c..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); +#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) == 0; } +#endif #endif /* EXEC__TRANSLATOR_H */ From patchwork Wed May 15 07:52:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796881 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp2853776wra; Wed, 15 May 2024 00:54:27 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUe7Cxz7msrsRgkegF11aD6lg/FArUGVBHSI7WWLQifS+V5D5YjI8iG4r3CHtwv44fiMzG1WwmE7uAXuEKzaUL4 X-Google-Smtp-Source: AGHT+IH1V9zGrdD0AHY4Fy/+rKXFCKMeHSSL7y+452r/Z0edu/7luKYrgmvWzlGO+ZiUBLshrJ+I X-Received: by 2002:a05:6214:2c06:b0:6a3:48d9:b39e with SMTP id 6a1803df08f44-6a348d9b573mr44136646d6.18.1715759667711; Wed, 15 May 2024 00:54:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715759667; cv=none; d=google.com; s=arc-20160816; b=ugGzf0kczHJOy/CpqiZWO0lixXgDNqQpDK4E8FZqWtrd8WL8azE7pe6ER2IBc3JrIm giPA9cA49CKMiOBchYTNST2ANDDprjWsZ5kYmITpd1G/J6qmSCYHwQkWM7PZCZM5ZjIa hShicvTKERe4uR1g5weHUnw51E9RDioaz5/ddKOW+JMivh7/UGTR+pPlIwtc2XFjkEpA FL43dbL/3LgspjRtC9yj/h6/TOUsBbRv3AVB3zFJd0kHVYGFV6eHxdgcCItNPidVCWDs 5UfbhVEdPwJTp6vwKfeTWV0B6xRxzv2qTOm4EI6is2HWSKylzfWP2TeHhjLMAcxd3FFT HDgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Z538Yc8eAgdGOVrA7CuXrxetPsi8c98l/ZVNOYY/ekc=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=aX+wyP4cE+VKoKCxmFkPKX1bvh7BEqp4z3B0BowKEyQ9J7Cp//bMUK3YUeURaC1jQA nnOhSEF+nGgNBHBv6lTyeFMTxXaguW2jIdmWmi7Ea+P9ZvkenkeG7ijb1hA8S1ngKGoi LGTba66I0Y1MSwBeIT2d9Sbd1UK9tYMJSSeIwgcLAe009ngxklOduZOU1mbI4ofqh+iY m15PU7sJ1pF8T9TyJRrdI7N4bP8DMPpuS1dirmxUdPQ4iuQwMyfTknBlM5WfbcXBwEWl QzrL/iVoXNjhFY/v5GkyZkrTpZge+zjb9C4Lyatn2b9mhmkVRctL7Mms+3JBwabTjGwu 0joQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rbIGEI0s; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6a15f29afadsi139195606d6.222.2024.05.15.00.54.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 00:54:27 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rbIGEI0s; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- include/exec/translator.h | 5 +++-- accel/tcg/translator.c | 2 +- target/s390x/tcg/translate.c | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/exec/translator.h b/include/exec/translator.h index 212362f5a0..348985c3a3 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -222,15 +222,16 @@ translator_ldq_swap(CPUArchState *env, DisasContextBase *db, /** * translator_fake_ldb - fake instruction load - * @insn8: byte of instruction + * @db: Disassembly context * @pc: program counter of instruction + * @insn8: byte of instruction * * This is a special case helper used where the instruction we are * about to translate comes from somewhere else (e.g. being * re-synthesised for s390x "ex"). It ensures we update other areas of * the translator with details of the executed instruction. */ -void translator_fake_ldb(uint8_t insn8, vaddr pc); +void translator_fake_ldb(DisasContextBase *db, vaddr pc, uint8_t insn8); #ifdef 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, DisasContextBase *db, vaddr pc) return ret; } -void translator_fake_ldb(uint8_t insn8, vaddr pc) +void translator_fake_ldb(DisasContextBase *db, vaddr pc, uint8_t insn8) { plugin_insn_append(pc, &insn8, sizeof(insn8)); } diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index 90a74ee795..6d7f6e7064 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -6203,7 +6203,7 @@ static const DisasInsn *extract_insn(CPUS390XState *env, DisasContext *s) /* Register insn bytes with translator so plugins work. */ for (int i = 0; i < ilen; i++) { uint8_t byte = extract64(insn, 56 - (i * 8), 8); - translator_fake_ldb(byte, pc + i); + translator_fake_ldb(&s->base, pc + i, byte); } op = insn >> 56; } else { From patchwork Wed May 15 07:52:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796873 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp2853472wra; Wed, 15 May 2024 00:53:31 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUYfUVU89AoxbDg4cqC+tqgN7rlEpUMcs0Ev7BJtPIhbvoHovBqDOiwsKglG8tW9FstDhEowYiO3jDbVGHMT9cx X-Google-Smtp-Source: AGHT+IFYDtkxDnJcxq1giwW28Tj7mZCm+pjNU7rMORZ8GJHsaqUeYvyJPLAG6XfPwF0MR/AXgfYU X-Received: by 2002:a05:6214:320c:b0:6a0:85df:3506 with SMTP id 6a1803df08f44-6a16815051amr162445286d6.23.1715759611616; Wed, 15 May 2024 00:53:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715759611; cv=none; d=google.com; s=arc-20160816; b=DnUrPjkIOfx4oGM/hM049R4R6cRKdzT6XxoCg6OcjLfHHeZhEVytup3eg/+fgBMgO0 h/qjO7wCovrWgalPjLKb0YMlNhA57E8YQlfRg3LGD+7gFL7BHSNAmw9LpQkY++ql4382 +/SrFNzXucEifOeBCIaHqTHEe4ZT9MJj4z3za0amA4I029XB6dFfW0acNwWx4IJztABC v7wu4LBiw3czqlA4DpD97KrPbNG7nXQboo5ijvzcIJFF4qcf2nhWBeN4RverniBgm7Dx vnRkq7a8MTaX+j3K2sbW0a/GTMFm70woaayS7pUQelUIMs4OuRBBuMzSbbwXbbrL4NBu pQGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4nDvS6RxjvEh929vNeT9BpypBMUhGJI6gnrhoY//llg=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=IZIZ8uey6gFuGpSV0+AUYH6u966oft9dYmmxHdDatSItugt5ctdfGUtSgDr6UAIGst JFnS5N+8iQk3HJhB/MK5iMJ5ntJS0SlObb4aZ1QSghWlEPvrGpcRxLuRVzFpg1PveVAM UFgyUuhw2Pg3/AzBNbUCOWt75cUYTzWjzfi+W8z9bkfmJgR5uMCsrDWkx+IcQqWbxLOT KGzyHahdg0x8Yja3y3rpBke6u0ygmPzIM3LAjGSCCANep2bO97o4mWAGzZmzeLrUn+NE UdMLNYEhwyYlNxc/FhUkegRo+p7B/GlcnY3ssUKifuqBAqsSySDVZQKYsJwx4T7UNYBt W2hw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cTiK2d+f; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6a15f2e640esi137487986d6.484.2024.05.15.00.53.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 00:53:31 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cTiK2d+f; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Reorg translator_access into translator_ld, with a more memcpy-ish interface. If both pages are in ram, do not go through the caller's slow path. Assert that the access is within the two pages that we are prepared to protect, per TranslationBlock. Allow access prior to pc_first, so long as it is within the first page. Reviewed-by: Philippe Mathieu-Daudé 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, } } -static void *translator_access(CPUArchState *env, DisasContextBase *db, - vaddr pc, size_t len) +static bool translator_ld(CPUArchState *env, DisasContextBase *db, + void *dest, vaddr pc, size_t len) { + TranslationBlock *tb = db->tb; + vaddr last = pc + len - 1; void *host; - vaddr base, end; - TranslationBlock *tb; - - tb = db->tb; + vaddr base; /* Use slow path if first page is MMIO. */ if (unlikely(tb_page_addr0(tb) == -1)) { - return NULL; + return false; } - end = pc + len - 1; - if (likely(is_same_page(db, end))) { - host = db->host_addr[0]; - base = db->pc_first; - } else { + host = db->host_addr[0]; + base = db->pc_first; + + if (likely(((base ^ last) & TARGET_PAGE_MASK) == 0)) { + /* Entire read is from the first page. */ + memcpy(dest, host + (pc - base), len); + return true; + } + + if (unlikely(((base ^ pc) & TARGET_PAGE_MASK) == 0)) { + /* Read begins on the first page and extends to the second. */ + size_t len0 = -(pc | TARGET_PAGE_MASK); + memcpy(dest, host + (pc - base), len0); + pc += len0; + dest += len0; + len -= len0; + } + + /* + * The read must conclude on the second page and not extend to a third. + * + * TODO: We could allow the two pages to be virtually discontiguous, + * since we already allow the two pages to be physically discontiguous. + * The only reasonable use case would be executing an insn at the end + * of the address space wrapping around to the beginning. For that, + * we would need to know the current width of the address space. + * In the meantime, assert. + */ + base = (base & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE; + assert(((base ^ pc) & TARGET_PAGE_MASK) == 0); + assert(((base ^ last) & TARGET_PAGE_MASK) == 0); + host = db->host_addr[1]; + + if (host == NULL) { + tb_page_addr_t page0, old_page1, new_page1; + + new_page1 = get_page_addr_code_hostp(env, base, &db->host_addr[1]); + + /* + * If the second page is MMIO, treat as if the first page + * was MMIO as well, so that we do not cache the TB. + */ + if (unlikely(new_page1 == -1)) { + tb_unlock_pages(tb); + tb_set_page_addr0(tb, -1); + return false; + } + + /* + * If this is not the first time around, and page1 matches, + * then we already have the page locked. Alternately, we're + * not doing anything to prevent the PTE from changing, so + * we might wind up with a different page, requiring us to + * re-do the locking. + */ + old_page1 = tb_page_addr1(tb); + if (likely(new_page1 != old_page1)) { + page0 = tb_page_addr0(tb); + if (unlikely(old_page1 != -1)) { + tb_unlock_page1(page0, old_page1); + } + tb_set_page_addr1(tb, new_page1); + tb_lock_page1(page0, new_page1); + } host = db->host_addr[1]; - base = TARGET_PAGE_ALIGN(db->pc_first); - if (host == NULL) { - tb_page_addr_t page0, old_page1, new_page1; - - new_page1 = get_page_addr_code_hostp(env, base, &db->host_addr[1]); - - /* - * If the second page is MMIO, treat as if the first page - * was MMIO as well, so that we do not cache the TB. - */ - if (unlikely(new_page1 == -1)) { - tb_unlock_pages(tb); - tb_set_page_addr0(tb, -1); - return NULL; - } - - /* - * If this is not the first time around, and page1 matches, - * then we already have the page locked. Alternately, we're - * not doing anything to prevent the PTE from changing, so - * we might wind up with a different page, requiring us to - * re-do the locking. - */ - old_page1 = tb_page_addr1(tb); - if (likely(new_page1 != old_page1)) { - page0 = tb_page_addr0(tb); - if (unlikely(old_page1 != -1)) { - tb_unlock_page1(page0, old_page1); - } - tb_set_page_addr1(tb, new_page1); - tb_lock_page1(page0, new_page1); - } - host = db->host_addr[1]; - } - - /* Use slow path when crossing pages. */ - if (is_same_page(db, pc)) { - return NULL; - } } - tcg_debug_assert(pc >= base); - return host + (pc - base); + memcpy(dest, host + (pc - base), len); + return true; } static void plugin_insn_append(vaddr pc, const void *from, size_t size) @@ -318,61 +337,55 @@ static void plugin_insn_append(vaddr pc, const void *from, size_t size) uint8_t translator_ldub(CPUArchState *env, DisasContextBase *db, vaddr pc) { - uint8_t ret; - void *p = translator_access(env, db, pc, sizeof(ret)); + uint8_t raw; - if (p) { - plugin_insn_append(pc, p, sizeof(ret)); - return ldub_p(p); + if (!translator_ld(env, db, &raw, pc, sizeof(raw))) { + raw = cpu_ldub_code(env, pc); } - ret = cpu_ldub_code(env, pc); - plugin_insn_append(pc, &ret, sizeof(ret)); - return ret; + plugin_insn_append(pc, &raw, sizeof(raw)); + return raw; } uint16_t translator_lduw(CPUArchState *env, DisasContextBase *db, vaddr pc) { - uint16_t ret, plug; - void *p = translator_access(env, db, pc, sizeof(ret)); + uint16_t raw, tgt; - if (p) { - plugin_insn_append(pc, p, sizeof(ret)); - return lduw_p(p); + if (translator_ld(env, db, &raw, pc, sizeof(raw))) { + tgt = tswap16(raw); + } else { + tgt = cpu_lduw_code(env, pc); + raw = tswap16(tgt); } - ret = cpu_lduw_code(env, pc); - plug = tswap16(ret); - plugin_insn_append(pc, &plug, sizeof(ret)); - return ret; + plugin_insn_append(pc, &raw, sizeof(raw)); + return tgt; } uint32_t translator_ldl(CPUArchState *env, DisasContextBase *db, vaddr pc) { - uint32_t ret, plug; - void *p = translator_access(env, db, pc, sizeof(ret)); + uint32_t raw, tgt; - if (p) { - plugin_insn_append(pc, p, sizeof(ret)); - return ldl_p(p); + if (translator_ld(env, db, &raw, pc, sizeof(raw))) { + tgt = tswap32(raw); + } else { + tgt = cpu_ldl_code(env, pc); + raw = tswap32(tgt); } - ret = cpu_ldl_code(env, pc); - plug = tswap32(ret); - plugin_insn_append(pc, &plug, sizeof(ret)); - return ret; + plugin_insn_append(pc, &raw, sizeof(raw)); + return tgt; } uint64_t translator_ldq(CPUArchState *env, DisasContextBase *db, vaddr pc) { - uint64_t ret, plug; - void *p = translator_access(env, db, pc, sizeof(ret)); + uint64_t raw, tgt; - if (p) { - plugin_insn_append(pc, p, sizeof(ret)); - return ldq_p(p); + if (translator_ld(env, db, &raw, pc, sizeof(raw))) { + tgt = tswap64(raw); + } else { + tgt = cpu_ldq_code(env, pc); + raw = tswap64(tgt); } - ret = cpu_ldq_code(env, pc); - plug = tswap64(ret); - plugin_insn_append(pc, &plug, sizeof(ret)); - return ret; + plugin_insn_append(pc, &raw, sizeof(raw)); + return tgt; } void translator_fake_ldb(DisasContextBase *db, vaddr pc, uint8_t insn8) From patchwork Wed May 15 07:52:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796888 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp2854069wra; Wed, 15 May 2024 00:55:28 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXjXrRbw48APKv4BMqiULE3Ep5Xr1i3brmmZLHEz/zI+SGoeDCQX0mfq/XgYAbB9M5whLDITJUrEpiadODA4WE1 X-Google-Smtp-Source: AGHT+IFvL/neVVpPqS+k2g/Ct/qEjcvnf1DusK0B0z5h1KdSL8sxvVNk44kGrSQk2HBbchfMNbUI X-Received: by 2002:ac8:578e:0:b0:43a:daca:2ebb with SMTP id d75a77b69052e-43dfdaf2812mr215830821cf.30.1715759728084; Wed, 15 May 2024 00:55:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715759728; cv=none; d=google.com; s=arc-20160816; b=c5WtwAscCmszWCMY5TFfw9CE9pRg9ZjONZHdXtcFtfAqLCtmLbLTxL5MyVNE30K2Sr wzwIQfSiu2o3AcKNsUGzjRzY6D5Ejgj8sh+g9AAAhBiCx2U7z6EXAAFE0ZAGW4JaNFE+ 2xLGjxddzPyoPDfeExzLJb8/nt/hiZbJVn0SUlTqRElSmM2Rvb7g78OFo84IEJvm31QV ZWIOByEz8aMcCj+ZQ2KeDYNKy/YNtcci85dSYjSs06rZjUp8C8atp9SoC7RRCD6qC65F LKxnVmCWFZc0MA0O+IG2ZBnQXl4nDK3jtZhLl7Asj8f1ViiIx/sj+mePOE12XxmJ0uCb C76A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jEfUsltW8rumdTfAvGwXpV5AkkGUJRb2ZtYX2v2b8B4=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=HWEXwI0DGZEItL8+gEoq6n/SFtkWvLWDXrLmV6l3zlpGznn4OGwrbsnvEq/W1LS2Kr 1SjIXGBEnat1OxCPJB1WO88qtGskHnZwsNg6iujC1OxsVldf8w0VgCMzLNILFoHrGwvZ eezShZ+qtcZwD4TI77ggPvY6vCNm1Pjyi/YvHazYPVgQNPKWLgfPh97BOH9m/PDtDmDi 9ROEK+gRFUup9lFArjkqmxxojQsZUduByvESqX1azjHacnJ3WQvnriDeuDWSbr43oebj bSx/kxjzdNhBAkiBJ5q+quP2XlHQJkw+0RdoNPtREUi1yRVEYGNRpO8HFqSzXwUJg893 nGgQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="BDu0s1/A"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-43df549edbcsi135610951cf.84.2024.05.15.00.55.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 00:55:28 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="BDu0s1/A"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Do not allow translation to proceed beyond one insn with mmio, as we will not be caching the TranslationBlock. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- accel/tcg/translator.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 0848026935..18138c61e1 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -240,6 +240,8 @@ static bool translator_ld(CPUArchState *env, DisasContextBase *db, /* Use slow path if first page is MMIO. */ if (unlikely(tb_page_addr0(tb) == -1)) { + /* We capped translation with first page MMIO in tb_gen_code. */ + tcg_debug_assert(db->max_insns == 1); return false; } @@ -288,6 +290,8 @@ static bool translator_ld(CPUArchState *env, DisasContextBase *db, if (unlikely(new_page1 == -1)) { tb_unlock_pages(tb); tb_set_page_addr0(tb, -1); + /* Require that this be the final insn. */ + db->max_insns = db->num_insns; return false; } From patchwork Wed May 15 07:52:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796885 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp2854062wra; Wed, 15 May 2024 00:55:26 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUCH0OV8r5N0z4X/yFGFCIv1ECWaCS8vXJpNruVHCAKYSTR+4FkSZKEjAAztN/HQ3Ic4Tph8JU1U0CeOIWu8CIf X-Google-Smtp-Source: AGHT+IF/SKrzOZR14DakwJvwreUAMyawS+g0V+rwdjX1nSguQzH8NEqBki41HUkK3k0+CksKZutH X-Received: by 2002:a05:6214:4b0c:b0:6a0:c9ef:3aae with SMTP id 6a1803df08f44-6a16817a8c8mr193071986d6.23.1715759726541; Wed, 15 May 2024 00:55:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715759726; cv=none; d=google.com; s=arc-20160816; b=FORarTuQ/fQ9uM1tMKdzROJr7KshlimZ3RNptGmELy4FCYukxAdIDb8C7G9r6hg/uB 9SWwcOf+3sfkMN5S7Lq54LBmSxPPGjN3njMLfQPL5nSA9NI6CW5t7rbyd6bM08d+zWVs +ITS5hOpnAakhj9RMr+BOoiNfpNYnREv+0H0y09o5lFMRURYkK4BiwTgOfzWypfz0ItL czktMo1X6k8Z581JNCRJqRW07fmaZwPWUJZp3OqWinADNkVe6FV8mDqo/8uhgGpvbSXK b6q+B8lTJJrCmrwRaospvMExvDCkayp5FgylEyofjlFw72zrtWWhlH53DhpUY5/g6hHz q3YA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=aHBV7vFxAWndnD846QEnn6hvoRiyYa0vJI3T3k5IEYM=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=rFxLcChH7WZw1ewDTHSX+9l3u06Uzb4gvgQgv+mQnKGA/ZR7R5A4v/2TTD8TgwtLxc gW/fuxZ/Ggx2+TKOy/fxtd8aO+Wj5f4t3VItspDygW58pYm16svEMOxcz7q5WlOGCxfN hbgK853bqy5hgsuQ9YDBlAYr+E1hS5111XfFcOCtTPD3sKBMlZQqcY8YlnaGwiAxgHAa LspEIKX6CtZB62jNZj7lwrgmatVP2sFtgjcj51pjrvb0znePjm/3WBbqaaJ60ScA6XG1 OplOUR64nObS0PMvzSlT2e36bH5UNwghS2Z3o+2cjEGc05CWpsf4OzsjNZynGtXaZ7gZ u38w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="HBncV/yU"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6a15f2b6009si103473006d6.349.2024.05.15.00.55.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 00:55:26 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="HBncV/yU"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org This will be able to replace plugin_insn_append, and will be usable for disassembly. Reviewed-by: Philippe Mathieu-Daudé 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; /** 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 *tb, int *max_insns, db->insn_start = NULL; db->host_addr[0] = host_pc; db->host_addr[1] = NULL; + db->record_start = 0; + db->record_len = 0; ops->init_disas_context(db, cpu); tcg_debug_assert(db->is_jmp == DISAS_NEXT); /* no early exit */ @@ -318,6 +320,39 @@ static bool translator_ld(CPUArchState *env, DisasContextBase *db, return true; } +static void record_save(DisasContextBase *db, vaddr pc, + const void *from, int size) +{ + int offset; + + /* Do not record probes before the start of TB. */ + if (pc < db->pc_first) { + return; + } + + /* + * In translator_access, we verified that pc is within 2 pages + * of pc_first, thus this will never overflow. + */ + offset = pc - db->pc_first; + + /* + * Either the first or second page may be I/O. If it is the second, + * then the first byte we need to record will be at a non-zero offset. + * In either case, we should not need to record but a single insn. + */ + if (db->record_len == 0) { + db->record_start = offset; + db->record_len = size; + } else { + assert(offset == db->record_start + db->record_len); + assert(db->record_len + size <= sizeof(db->record)); + db->record_len += size; + } + + memcpy(db->record + (offset - db->record_start), from, size); +} + static void plugin_insn_append(vaddr pc, const void *from, size_t size) { #ifdef CONFIG_PLUGIN @@ -345,6 +380,7 @@ uint8_t translator_ldub(CPUArchState *env, DisasContextBase *db, vaddr pc) if (!translator_ld(env, db, &raw, pc, sizeof(raw))) { raw = cpu_ldub_code(env, pc); + record_save(db, pc, &raw, sizeof(raw)); } plugin_insn_append(pc, &raw, sizeof(raw)); return raw; @@ -359,6 +395,7 @@ uint16_t translator_lduw(CPUArchState *env, DisasContextBase *db, vaddr pc) } else { tgt = cpu_lduw_code(env, pc); raw = tswap16(tgt); + record_save(db, pc, &raw, sizeof(raw)); } plugin_insn_append(pc, &raw, sizeof(raw)); return tgt; @@ -373,6 +410,7 @@ uint32_t translator_ldl(CPUArchState *env, DisasContextBase *db, vaddr pc) } else { tgt = cpu_ldl_code(env, pc); raw = tswap32(tgt); + record_save(db, pc, &raw, sizeof(raw)); } plugin_insn_append(pc, &raw, sizeof(raw)); return tgt; @@ -387,6 +425,7 @@ uint64_t translator_ldq(CPUArchState *env, DisasContextBase *db, vaddr pc) } else { tgt = cpu_ldq_code(env, pc); raw = 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, DisasContextBase *db, vaddr pc) void translator_fake_ldb(DisasContextBase *db, vaddr pc, uint8_t insn8) { + assert(pc >= db->pc_first); + record_save(db, pc, &insn8, sizeof(insn8)); plugin_insn_append(pc, &insn8, sizeof(insn8)); } From patchwork Wed May 15 07:52:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796893 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp2854727wra; Wed, 15 May 2024 00:57:40 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVOMm8AEmhCtHeY+M+eX+OR8RdLahJobfQP8XEWaW7M777q81qGwV3ANV9qcSdNFz1FPjH2/Y6SN2uv7llqrK43 X-Google-Smtp-Source: AGHT+IF4pY3u0Ky+UHMUDrmfU13r16JTgMymQBfx/5kU0WitqBYv0eiju7c3bqSGBJizB99seu9H X-Received: by 2002:a0c:aa5b:0:b0:6a0:fb8e:2845 with SMTP id 6a1803df08f44-6a15cbc4adcmr304307276d6.11.1715759859880; Wed, 15 May 2024 00:57:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715759859; cv=none; d=google.com; s=arc-20160816; b=CdweeS7yifKVy8I3d9c3uzYOv+SYt3Y9qUCV4ALBX7DgErBiVIa62mFWKoiUm0Ush3 D0SsSTxacdvpbZfskI3HcuE30MkK3HYCjfeghGTJF0cvDAx4j531Hbdh8ALQzvO1OrsW 0C1KnekmE3cK8K13MV0xwfgCLlmTZdu7XdVNUEuZPzDeARhXBzPopzYJ5QqebSJHkz5h YwOEMO/sKZvAZUutvOMBBahjXMjpY+Pk6j+4NjUIBvF7beFB7Oo11jK8lw3wwVSO9yPm T72Q0zt+vPb1t8m7aprG6NJ5EmWyi3qKP69vpiO1QtioMBTlNvn6GWwJbXzJgdoB1p+/ Xpgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oqU8ItNdi4m1XZTYvDwRO0vv7Nr1dGEj2Szzh23jUJo=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=Qbibok/Sz4IEREWqWeuxAv81Ov0ChXKwc5/Iy2mDzdY4LDVP+1/eaUXM2baWu1Jvtw PTueCToSZ0LwnTs7IedrteW+CNDZT4ZmyrUsrftFD854N6oYOMCIE1Lkfj6D0fOQ0iER X4OmNlVW2bv8v7iFQRIpg/P2hx2G0BFAMjj3x5HgmGXP/zQoujA+q3u9021HC35iS3/v WBvNGlPsD04fxGm9YwINYY/SsnCn4ULPg/Gv3eHywHWimf6prcFbPiC6LUVIrWr4iU2Y +7gE0PdHIFoUaK23iAd6szV9h52fRw+pHlOPO7K0peQze8lqIneO1qAm8S+DuOBHuEca SxBQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oJ1tXAq1; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-43dfec882b7si119544871cf.521.2024.05.15.00.57.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 00:57:39 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oJ1tXAq1; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Remove left-over comment from commit dcd092a063 ("accel/tcg: Improve can_do_io management"). Reviewed-by: Philippe Mathieu-Daudé 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]; 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 *tb, int *max_insns, db->max_insns = *max_insns; db->singlestep_enabled = cflags & CF_SINGLE_STEP; db->insn_start = NULL; + db->fake_insn = false; db->host_addr[0] = host_pc; db->host_addr[1] = NULL; db->record_start = 0; @@ -434,6 +435,7 @@ uint64_t translator_ldq(CPUArchState *env, DisasContextBase *db, vaddr pc) void translator_fake_ldb(DisasContextBase *db, vaddr pc, uint8_t insn8) { assert(pc >= db->pc_first); + db->fake_insn = true; record_save(db, pc, &insn8, sizeof(insn8)); plugin_insn_append(pc, &insn8, sizeof(insn8)); } From patchwork Wed May 15 07:52:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796875 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp2853502wra; Wed, 15 May 2024 00:53:35 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUGOcIGP7XX/W1mp+LHqR/3k3owaqRT+bVWxVeVo2OreXt2ZjiiDL+llKJ/u66VdktQzZbuudZBZ8GO6uDCY6Rb X-Google-Smtp-Source: AGHT+IHxtvqUcX9p8t/Hewl00h3xRdUbwJysF2kjoJxei5T3+CHoBUhkXe5tWprKuM4rqVdS9i62 X-Received: by 2002:a05:6214:4602:b0:6a0:e827:d8e with SMTP id 6a1803df08f44-6a16822b743mr184779726d6.40.1715759615449; Wed, 15 May 2024 00:53:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715759615; cv=none; d=google.com; s=arc-20160816; b=QD5IA9slvdsm7HwgfTMNx8Xfyq6sCjZ2k2AKHHRM0XtS0GUwD2vooapArFl0Zf/V0C BCq4GSAERmbTXrkK0I26Ax9NrQ29GFe9Zpc5Ew8wdtvlhuGWBi7XJpROCa5ql7jWE3um 7HAS/OuBNhtKbsfS9/SuEd7JXTEq0zChjvGuAM2xGCkUejutWKsMwsOelFzk/Hy3Img3 2hnQGYw9rK7bT/Z22a0/KWz1yCUsq+AwONihev5my0s+rQUUJ0fnFYV6R7AdN8jpcaVA 2MWwX+Ob5LuASU6PRp8FkeieLOEM8MMuWqq4hyTXSLw/Jo9HFB7WH3uaE4sxfuWfAPeg n6pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1Iqnca+HhnCCBvOshaH/DqsUrANLuNbYvwccCz1eMgU=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=hFFVxDyJR9Kc66OgQeLBxBK2fjDlnaOJl3Dt6WwMEKTMTRnpVHtbX3nOHREqvRr0P1 B7FeIVur1cO8MsYqgIDWhp85yaYHcnnvh/Ba6/8Ag7NCBchx1PRvEUaUmT3v4EtdizzI jEwtwBowOECGCnAqg4JOr296V3zLbcTVFNLUxeq23xUDVvIb8pE3PoMQZevWL6SbLVv7 TmITjfhcuXITkeqn+N5tBF/Nk7GE5WM94tFsjtKyZK83EtSmi3iYipuhnJpNHwzIYLs4 xEOizOOPcQKNXVG8MTAV19MDaDrYKb3+VXTmE33cBbXGY5hz3f7q6nZBNM2gzK6cll4c gwug==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="ZMbpsqZ/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6a15f2eda0asi136658806d6.466.2024.05.15.00.53.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 00:53:35 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="ZMbpsqZ/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 1 + accel/tcg/plugin-gen.c | 1 + 2 files changed, 2 insertions(+) diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 135e36d729..2a1c080bab 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -537,6 +537,7 @@ struct TCGContext { * space for instructions (for variable-instruction-length ISAs). */ struct qemu_plugin_tb *plugin_tb; + const struct DisasContextBase *plugin_db; /* descriptor of the instruction being translated */ struct qemu_plugin_insn *plugin_insn; diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index 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 DisasContextBase *db, tcg_gen_plugin_cb(PLUGIN_GEN_FROM_TB); } + tcg_ctx->plugin_db = db; tcg_ctx->plugin_insn = NULL; return ret; From patchwork Wed May 15 07:52:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796904 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp2856457wra; Wed, 15 May 2024 01:02:22 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV0wn9/9eh1IAiwVRBgzonx/JcnFiOD7ZS28OpRKbMFzFQ7+ZivqxmMWCDV/5C9pHlCWxqgjS3IvolPECgVPbh4 X-Google-Smtp-Source: AGHT+IGRGE+gKN+e+EzaugOR8UQFUnsXC4+XrUGk2teV1oUGqh3h9+FuWEvmb0HmIZmfK2fCuep9 X-Received: by 2002:a0c:bf0c:0:b0:6a3:294f:554a with SMTP id 6a1803df08f44-6a3294f555bmr146530176d6.32.1715760140126; Wed, 15 May 2024 01:02:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715760140; cv=none; d=google.com; s=arc-20160816; b=KZapjD8gnv6w1a0LiEi5aes2xsWrRDNEVLVbn9e2+Md7XMu9do+10VSA3C7SdEWiTd UO3pnXFWHueJ4n+kEXtfTaEvtesgCIf4VznfyQbZCvrM5jlbpnMzK0OR+IzA+NxGVO+7 AT5zBsSmmDairyBgmXC3F+bWHQdqnMROSn1s0Ki0ssHIgMMQo/Y+EFaJFNk9jqN/kESP d+LG5aKgo4WBgDTUxLUEj0YGsJ8Zp+D923VmPkYsYPfiz3/ZvmnlnsSPbKCzXViZXTyI yaI+kGZlRueO9UmQgXvhJQZYl6CKQEc9DafwSybqkN9XoZNVhNFZ3M79PZQ3xIdxuY1l 5+SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CtQK7Z5/e08tg2ZG57AjvcglO+yjRFx9a1dcx4y70SE=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=U47/utWQygGusKUW5I78H0U5w+dlBNN46Z3aQervqPLkniXr5DpjgXnVoi7/rYt8fX iE2c7vvGKt91qOK99TFi2vwyvXEokWB867qfxcTN34k6+NUo36Oqq2amaulw/uautIJk uYO/K29d308Pv/o/+BcQ1wo4x9hAVI3RONkV6BXDkmQtOT32V6mpJWcyJANvQwStmDZz eWqsBn7PyQIlSjtMkzmUYA+Z8LtO8zNqDakivjUFoox7eVji4qp0ynzfvhN/Vn/mG9A1 2Eg+ml2oO1lcXIErnXNpH/z/CHige3rqPlRaaxPIEZIzLSxaKink5ISsZiTmt4TCp1wj 24mw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IERvbZae; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6a15f2b66ccsi135916556d6.399.2024.05.15.01.02.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 01:02:20 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IERvbZae; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Instead of returning a host pointer, copy the data into storage provided by the caller. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- include/qemu/qemu-plugin.h | 15 +++++++-------- contrib/plugins/execlog.c | 5 +++-- contrib/plugins/howvec.c | 4 ++-- plugins/api.c | 7 +++++-- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index 4fc6c3739b..5f36c2d1ac 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -61,7 +61,7 @@ typedef uint64_t qemu_plugin_id_t; extern QEMU_PLUGIN_EXPORT int qemu_plugin_version; -#define QEMU_PLUGIN_VERSION 2 +#define QEMU_PLUGIN_VERSION 3 /** * struct qemu_info_t - system information for plugins @@ -394,17 +394,16 @@ struct qemu_plugin_insn * qemu_plugin_tb_get_insn(const struct qemu_plugin_tb *tb, size_t idx); /** - * qemu_plugin_insn_data() - return ptr to instruction data + * qemu_plugin_insn_data() - copy instruction data * @insn: opaque instruction handle from qemu_plugin_tb_get_insn() + * @dest: destination into which data is copied + * @len: length of dest * - * Note: data is only valid for duration of callback. See - * qemu_plugin_insn_size() to calculate size of stream. - * - * Returns: pointer to a stream of bytes containing the value of this - * instructions opcode. + * Returns the number of bytes copied, minimum of @len and insn size. */ QEMU_PLUGIN_API -const void *qemu_plugin_insn_data(const struct qemu_plugin_insn *insn); +size_t qemu_plugin_insn_data(const struct qemu_plugin_insn *insn, + void *dest, size_t len); /** * qemu_plugin_insn_size() - return size of instruction diff --git a/contrib/plugins/execlog.c b/contrib/plugins/execlog.c index fab18113d4..371db97eb1 100644 --- a/contrib/plugins/execlog.c +++ b/contrib/plugins/execlog.c @@ -258,8 +258,9 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb) NULL); } } else { - uint32_t insn_opcode; - insn_opcode = *((uint32_t *)qemu_plugin_insn_data(insn)); + uint32_t insn_opcode = 0; + qemu_plugin_insn_data(insn, &insn_opcode, sizeof(insn_opcode)); + char *output = g_strdup_printf("0x%"PRIx64", 0x%"PRIx32", \"%s\"", insn_vaddr, insn_opcode, insn_disas); diff --git a/contrib/plugins/howvec.c b/contrib/plugins/howvec.c index 94bbc53820..9be67f7453 100644 --- a/contrib/plugins/howvec.c +++ b/contrib/plugins/howvec.c @@ -252,7 +252,7 @@ static struct qemu_plugin_scoreboard *find_counter( { int i; uint64_t *cnt = NULL; - uint32_t opcode; + uint32_t opcode = 0; InsnClassExecCount *class = NULL; /* @@ -261,7 +261,7 @@ static struct qemu_plugin_scoreboard *find_counter( * They would probably benefit from a more tailored plugin. * However we can fall back to individual instruction counting. */ - opcode = *((uint32_t *)qemu_plugin_insn_data(insn)); + qemu_plugin_insn_data(insn, &opcode, sizeof(opcode)); for (i = 0; !cnt && i < class_table_sz; i++) { class = &class_table[i]; diff --git a/plugins/api.c b/plugins/api.c index 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 *tb, size_t idx) * instruction being translated. */ -const void *qemu_plugin_insn_data(const struct qemu_plugin_insn *insn) +size_t qemu_plugin_insn_data(const struct qemu_plugin_insn *insn, + void *dest, size_t len) { - return insn->data->data; + len = MIN(len, insn->data->len); + memcpy(dest, insn->data->data, len); + return len; } size_t qemu_plugin_insn_size(const struct qemu_plugin_insn *insn) From patchwork Wed May 15 07:52:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796895 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp2855445wra; Wed, 15 May 2024 01:00:13 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVti/ywaBHg/SBUlzAKulh7uNy74qcu3gzwBeW1s99hULNx99AyOcYs6f/SePWyPgh+JVGHMGupP9nXL8wLIMLA X-Google-Smtp-Source: AGHT+IFjSMIv7krg1mQ9tZMdJ7vjKaHCgjVLaQFLAeZApU6nlEsjNozZiukqs9TejugZCV+b979F X-Received: by 2002:a05:622a:1109:b0:43a:699e:114c with SMTP id d75a77b69052e-43dec39cd25mr279422301cf.31.1715760013368; Wed, 15 May 2024 01:00:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715760013; cv=none; d=google.com; s=arc-20160816; b=kkZhJNQXEeac9h3fb42sk9TGwHdPPlUVmhkabyJneq7Ru6pW/OkXduIGmllMqoA9Uq PlXluflhaVbx6npHm+QT44++DEi/ZG/PSFX91OQ41PAsVPpdd1JwNzdFS9MR0HkKEKm8 3IZLSCnlQc7RAnMk5mopbqYjwmQv/P2B/zhWnCSQ73GFVTTttiQ9Uh+rJwmK2rqBhC6S ek1g++TfU8KW9De4v15Y6DVyOqaVBuxq/xLtCpW/hR7q91iU0nFwfDaMehN8nF+INKVl 1p/x3HOz1dcIOYEU6bjfMA3mhal2AR/4ndCAEF/OaqWWbYIFFghrDlYwEJ9sT7fdfDyd 4cSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yLGS6fJq+lOqJ3w5Tkv/jajaJfxbK2E7v4a67YW3xHU=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=stXud0kVrwUKFVRdF2/CSjyK71b2Jj09dB6/Opo7wlKQ0EVJBEq17Jjy7/TipR8hby KDXGZoKfhPQlJqOV1TXgCvo3cLfx94q+EXZSGM2Z2BKYB8gYmA3BfO/Tvo0I3BFSdawE Ct8HRnn0bedzseaCBonKUWBf0RLT5j2EaYJL7HIuF8CSdhu5YTpfRZ1Mm78LXkH7sQnG wxIfvA9e6ym4Z5y8pPm8B2wXONixueN5j7Y2upPovSIlMTE41vk9IqNMUluiFvbs9Xgh TfD+jNfPPrcLvZyHF59GlT8rupPHN/MZJ24qxREn+v8pkipLFoc2qbE+GvSzXD3DM6kR FRdg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=r+3VOZ2y; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-43df566f4a8si135107261cf.330.2024.05.15.01.00.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 01:00:13 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=r+3VOZ2y; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Copy data out of a completed translation. This will be used for both plugins and disassembly. Reviewed-by: Philippe Mathieu-Daudé 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, DisasContextBase *db, */ void translator_fake_ldb(DisasContextBase *db, vaddr pc, uint8_t insn8); +/** + * translator_st + * @db: disassembly context + * @dest: address to copy into + * @addr: virtual address within TB + * @len: length + * + * Copy @len bytes from @addr into @dest. + * All bytes must have been read during translation. + * Return true on success or false on failure. + */ +bool translator_st(const DisasContextBase *db, void *dest, + vaddr addr, size_t len); + +/** + * translator_st_len + * @db: disassembly context + * + * Return the number of bytes available to copy from the + * current translation block with translator_st. + */ +size_t translator_st_len(const DisasContextBase *db); + #ifdef 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); } +size_t translator_st_len(const DisasContextBase *db) +{ + return db->fake_insn ? db->record_len : db->tb->size; +} + +bool translator_st(const DisasContextBase *db, void *dest, + vaddr addr, size_t len) +{ + size_t offset, offset_end; + + if (addr < db->pc_first) { + return false; + } + offset = addr - db->pc_first; + offset_end = offset + len; + if (offset_end > translator_st_len(db)) { + return false; + } + + if (!db->fake_insn) { + size_t offset_page1 = -(db->pc_first | TARGET_PAGE_MASK); + + /* Get all the bytes from the first page. */ + if (db->host_addr[0]) { + if (offset_end <= offset_page1) { + memcpy(dest, db->host_addr[0] + offset, len); + return true; + } + if (offset < offset_page1) { + size_t len0 = offset_page1 - offset; + memcpy(dest, db->host_addr[0] + offset, len0); + offset += len0; + dest += len0; + } + } + + /* Get any bytes from the second page. */ + if (db->host_addr[1] && offset >= offset_page1) { + memcpy(dest, db->host_addr[1] + (offset - offset_page1), + offset_end - offset); + return true; + } + } + + /* Else get recorded bytes. */ + if (db->record_len != 0 && + offset >= db->record_start && + offset_end <= db->record_start + db->record_len) { + memcpy(dest, db->record + (offset - db->record_start), + offset_end - offset); + return true; + } + return false; +} + static void plugin_insn_append(vaddr pc, const void *from, size_t size) { #ifdef CONFIG_PLUGIN From patchwork Wed May 15 07:52:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796890 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp2854270wra; Wed, 15 May 2024 00:56:15 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX5yn0ms9IPNvivEqnnHTIVDrqoROl+DfPSapEe1u/0J84yTN3uYXYGwgoKtZmb4Vuck+Eg+vzv3YCJs1JKsGzO X-Google-Smtp-Source: AGHT+IElpgUJHPGNJd/QSzjuyTp242+bfil0FdtLXKIbvSAP7yt64q5MmeBmbzz/M4eqfW1NzgJz X-Received: by 2002:a05:620a:424f:b0:792:947b:f62 with SMTP id af79cd13be357-792c6ec5867mr2909876785a.36.1715759775460; Wed, 15 May 2024 00:56:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715759775; cv=none; d=google.com; s=arc-20160816; b=axnYB/RMoD3hpWCusG0HhD7osfio776oAfMM/38VRALBrVPVv2gPXwD2zAVHpDOHGZ SjJB2ro72Xw4BPpVm3PwH1xl60J8lnHT3VO30XTB67A4BBEFXr2UySkLLO1Ghww7a5t9 ApYPKtmE6pxiFIZz6PdYO07mllH4ODSCONfagLGzWNKCiXc/IHB5bmTWJlKehmM5Oykf hkg/xOd2ttR7O5lCzeZCRqjWng6ZFyJ6ahcyHWBf3BeOM3rC7fn6Ko853dauLwQu7i1C q04vwkqjU7AX8Su0m1BFgrmSKsEBFZDJIk4ILu11X7E29uWHZvv0ZjjRC6n6VIjal+IV 4fCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GBtVDB/HuYfnJ/hMo9HZFYBFCYQzVqAd1rDtPXWhcLA=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=bFqT25D7byQ9inzSW5estyLlgBkJoWajF63ymcfJXQJCjWvgbEhWS2yo/kdK7yIkqE yFSLx9ARI/pcSxYeBiLpym/COdj4pj56Nalwy/kzjzST73J1vOmRTQ8RHRfuIS2/stOE FXJ+Ba+hYWumnwMbR4cM/hSUIgKwVtx8B0Ha2DgVi7i1dq4bNwno+/EFA3V1Je2O2KJQ Q19UmiGx6NcKnIVt64mMDNPL20BIyyolYg1Ygu8wkAzJK+arC4Ivxi56/XAuuFoXYHVa mYdWeA0JLxD+p2T8V7AiRbd5htHOYppXOLyVdvEljKvusYU2UdZkqfqZ8CjlrPB3ry5E aluA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="fUBy/HMM"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-792bf36095csi1297196185a.542.2024.05.15.00.56.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 00:56:15 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="fUBy/HMM"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Use the bytes that we record for the entire TB, rather than a per-insn GByteArray. Record the length of the insn in plugin_gen_insn_end rather than infering from the length of the array. Reviewed-by: Philippe Mathieu-Daudé 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 { /* Internal context for instrumenting an instruction */ struct qemu_plugin_insn { - GByteArray *data; uint64_t vaddr; void *haddr; GArray *insn_cbs; GArray *mem_cbs; + uint8_t len; bool calls_helpers; /* if set, the instruction calls helpers that might access guest memory */ @@ -117,18 +117,6 @@ struct qemu_plugin_scoreboard { QLIST_ENTRY(qemu_plugin_scoreboard) entry; }; -/* - * qemu_plugin_insn allocate and cleanup functions. We don't expect to - * cleanup many of these structures. They are reused for each fresh - * translation. - */ - -static inline void qemu_plugin_insn_cleanup_fn(gpointer data) -{ - struct qemu_plugin_insn *insn = (struct qemu_plugin_insn *) data; - g_byte_array_free(insn->data, true); -} - /* Internal context for this TranslationBlock */ struct qemu_plugin_tb { GPtrArray *insns; diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index 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 DisasContextBase *db) ptb->n = n; if (n <= ptb->insns->len) { insn = g_ptr_array_index(ptb->insns, n - 1); - g_byte_array_set_size(insn->data, 0); } else { assert(n - 1 == ptb->insns->len); insn = g_new0(struct qemu_plugin_insn, 1); - insn->data = g_byte_array_sized_new(4); g_ptr_array_add(ptb->insns, insn); } @@ -389,6 +387,11 @@ void plugin_gen_insn_start(CPUState *cpu, const DisasContextBase *db) void plugin_gen_insn_end(void) { + const DisasContextBase *db = tcg_ctx->plugin_db; + struct qemu_plugin_insn *pinsn = tcg_ctx->plugin_insn; + + pinsn->len = db->fake_insn ? db->record_len : db->pc_next - pinsn->vaddr; + tcg_gen_plugin_cb(PLUGIN_GEN_AFTER_INSN); } diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 01e1f0977b..986045154c 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -409,27 +409,6 @@ bool translator_st(const DisasContextBase *db, void *dest, return false; } -static void plugin_insn_append(vaddr pc, const void *from, size_t size) -{ -#ifdef CONFIG_PLUGIN - struct qemu_plugin_insn *insn = tcg_ctx->plugin_insn; - size_t off; - - if (insn == NULL) { - return; - } - off = pc - insn->vaddr; - if (off < insn->data->len) { - g_byte_array_set_size(insn->data, off); - } else if (off > insn->data->len) { - /* we have an unexpected gap */ - g_assert_not_reached(); - } - - insn->data = g_byte_array_append(insn->data, from, size); -#endif -} - uint8_t translator_ldub(CPUArchState *env, DisasContextBase *db, vaddr pc) { uint8_t raw; @@ -438,7 +417,6 @@ uint8_t translator_ldub(CPUArchState *env, DisasContextBase *db, vaddr pc) raw = cpu_ldub_code(env, pc); record_save(db, pc, &raw, sizeof(raw)); } - plugin_insn_append(pc, &raw, sizeof(raw)); return raw; } @@ -453,7 +431,6 @@ uint16_t translator_lduw(CPUArchState *env, DisasContextBase *db, vaddr pc) raw = tswap16(tgt); record_save(db, pc, &raw, sizeof(raw)); } - plugin_insn_append(pc, &raw, sizeof(raw)); return tgt; } @@ -468,7 +445,6 @@ uint32_t translator_ldl(CPUArchState *env, DisasContextBase *db, vaddr pc) raw = tswap32(tgt); record_save(db, pc, &raw, sizeof(raw)); } - plugin_insn_append(pc, &raw, sizeof(raw)); return tgt; } @@ -483,7 +459,6 @@ uint64_t translator_ldq(CPUArchState *env, DisasContextBase *db, vaddr pc) raw = tswap64(tgt); record_save(db, pc, &raw, sizeof(raw)); } - plugin_insn_append(pc, &raw, sizeof(raw)); return tgt; } @@ -492,5 +467,4 @@ void translator_fake_ldb(DisasContextBase *db, vaddr pc, uint8_t insn8) assert(pc >= db->pc_first); db->fake_insn = true; record_save(db, pc, &insn8, sizeof(insn8)); - plugin_insn_append(pc, &insn8, sizeof(insn8)); } diff --git a/plugins/api.c b/plugins/api.c index 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 = MIN(len, insn->data->len); - memcpy(dest, insn->data->data, len); - return len; + const DisasContextBase *db = tcg_ctx->plugin_db; + + len = MIN(len, insn->len); + return translator_st(db, dest, insn->vaddr, len) ? len : 0; } size_t qemu_plugin_insn_size(const struct qemu_plugin_insn *insn) { - return insn->data->len; + return insn->len; } uint64_t qemu_plugin_insn_vaddr(const struct qemu_plugin_insn *insn) @@ -242,7 +244,7 @@ void *qemu_plugin_insn_haddr(const struct qemu_plugin_insn *insn) char *qemu_plugin_insn_disas(const struct qemu_plugin_insn *insn) { CPUState *cpu = current_cpu; - return plugin_disas(cpu, insn->vaddr, insn->data->len); + return plugin_disas(cpu, insn->vaddr, insn->len); } const char *qemu_plugin_insn_symbol(const struct qemu_plugin_insn *insn) diff --git a/tcg/tcg.c b/tcg/tcg.c index 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 = g_new0(struct qemu_plugin_tb, 1); - s->plugin_tb->insns = - g_ptr_array_new_with_free_func(qemu_plugin_insn_cleanup_fn); + s->plugin_tb->insns = g_ptr_array_new(); #endif } From patchwork Wed May 15 07:52:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796891 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp2854514wra; Wed, 15 May 2024 00:56:58 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXsIYvfATP7PDz5lEAR9VAy43DBQDD8iFi4HGYDxfAnvmyE3UsRuRXDy7o8C5QgxYQ0nT3jRnKukQO0uDTx8PQV X-Google-Smtp-Source: AGHT+IFYIad+N8AjDCxX6nPKBWXhK86vJCS71KRVGpWmab+5sauQGaXNJWXExYjvsyzKOWLe8ZnN X-Received: by 2002:a05:6214:3c9c:b0:6a0:ceaf:c6cd with SMTP id 6a1803df08f44-6a1681d94edmr160573376d6.33.1715759817851; Wed, 15 May 2024 00:56:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715759817; cv=none; d=google.com; s=arc-20160816; b=GiDobgKfR0INFYjJqorDIF7aurQs2SaNX44RXBESJplT2fYK5Yoq9KTL8JR/7fjwzw d1XwUqWX8shWEz/uPrjj7Nb3IkWeuobYPhAyARAwRGQczi5wZvuKUII4qE9Sp3B8sniP 21ilgwJCeXJX9OA4XPKhFE8ibnjIyyJ/MkF1mRrh3i5G5Dpq6VN1hfl0h0kR7LSt5+AQ v4AqwRm7BuIFAgIWRca5uXepvworE43K2UG4JlHjzfxLu9US5Hw2Ox+5sJSmlptpsWwm DHa90PG4Nbfnv9ipiaw5gUZJd3AN/1D0suGzk1uuxqIYSDkO7r3uQ06OsaNjj4hSNxJi M8TQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XkVl83KsOOTJGy2FEx65OPALX7XGIVav7feQhODj4vs=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=npECrJ7sW4X/cfyQJ2lGRjni6XGsQLWN7yyxH8bHrD8RZ8g2qnTCk82a5HCyedJptC ng5oYlF08WovhQrpvmGwSvmmHASpxrA7Fmu/ybtkbeABWyvtSu8Qp6g3iUdSGvT3Y2CD 7pMosg2d69yRee33sBqfFjAyPQ27NPLIwoXztsPyd/D4GEl08/DmGy367NCVE30FZDw4 bw/NXIPL4MjwbBquSPowdhy6OiwtjchsB7/jVzDQEIJGYtKQgxLceeNGfDRvxv0Gp1IA e5rGhwwlSIGv2jYUpZvp3juB33f2pl17uuozFnY+oPHy6EwmW/sncO9o1Jo7w7+lU+do tySA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sPv4zHSI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6a15f2b543esi136656546d6.326.2024.05.15.00.56.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 00:56:57 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sPv4zHSI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Do not pass around a boolean between multiple structures, just read it from the TranslationBlock in the TCGContext. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- include/exec/plugin-gen.h | 7 +++---- include/qemu/plugin.h | 3 --- accel/tcg/plugin-gen.c | 4 +--- accel/tcg/translator.c | 2 +- plugins/api.c | 14 +++++++++----- 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/include/exec/plugin-gen.h b/include/exec/plugin-gen.h index f333f33198..cbb2ca2131 100644 --- a/include/exec/plugin-gen.h +++ b/include/exec/plugin-gen.h @@ -18,8 +18,7 @@ struct DisasContextBase; #ifdef CONFIG_PLUGIN -bool plugin_gen_tb_start(CPUState *cpu, const struct DisasContextBase *db, - bool supress); +bool plugin_gen_tb_start(CPUState *cpu, const struct DisasContextBase *db); void plugin_gen_tb_end(CPUState *cpu, size_t num_insns); void plugin_gen_insn_start(CPUState *cpu, const struct DisasContextBase *db); void plugin_gen_insn_end(void); @@ -28,8 +27,8 @@ void plugin_gen_disable_mem_helpers(void); #else /* !CONFIG_PLUGIN */ -static inline bool -plugin_gen_tb_start(CPUState *cpu, const struct DisasContextBase *db, bool sup) +static inline +bool plugin_gen_tb_start(CPUState *cpu, const struct DisasContextBase *db) { return false; } diff --git a/include/qemu/plugin.h b/include/qemu/plugin.h index c8dd2c42fa..c28d0ca31c 100644 --- a/include/qemu/plugin.h +++ b/include/qemu/plugin.h @@ -107,8 +107,6 @@ struct qemu_plugin_insn { /* if set, the instruction calls helpers that might access guest memory */ bool mem_helper; - - bool mem_only; }; /* A scoreboard is an array of values, indexed by vcpu_index */ @@ -125,7 +123,6 @@ struct qemu_plugin_tb { uint64_t vaddr2; void *haddr1; void *haddr2; - bool mem_only; /* if set, the TB calls helpers that might access guest memory */ bool mem_helper; diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index 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 *plugin_tb) } } -bool plugin_gen_tb_start(CPUState *cpu, const DisasContextBase *db, - bool mem_only) +bool plugin_gen_tb_start(CPUState *cpu, const DisasContextBase *db) { bool ret = false; @@ -323,7 +322,6 @@ bool plugin_gen_tb_start(CPUState *cpu, const DisasContextBase *db, ptb->vaddr2 = -1; ptb->haddr1 = db->host_addr[0]; ptb->haddr2 = NULL; - ptb->mem_only = mem_only; ptb->mem_helper = false; tcg_gen_plugin_cb(PLUGIN_GEN_FROM_TB); diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 986045154c..157b447810 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -144,7 +144,7 @@ void translator_loop(CPUState *cpu, TranslationBlock *tb, int *max_insns, ops->tb_start(db, cpu); tcg_debug_assert(db->is_jmp == DISAS_NEXT); /* no early exit */ - plugin_enabled = plugin_gen_tb_start(cpu, db, cflags & CF_MEMI_ONLY); + plugin_enabled = plugin_gen_tb_start(cpu, db); db->plugin_enabled = plugin_enabled; while (true) { diff --git a/plugins/api.c b/plugins/api.c index 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); } +static bool tb_is_mem_only(void) +{ + return tb_cflags(tcg_ctx->gen_tb) & CF_MEMI_ONLY; +} + void qemu_plugin_register_vcpu_tb_exec_cb(struct qemu_plugin_tb *tb, qemu_plugin_vcpu_udata_cb_t cb, enum qemu_plugin_cb_flags flags, void *udata) { - if (!tb->mem_only) { + if (!tb_is_mem_only()) { plugin_register_dyn_cb__udata(&tb->cbs, cb, flags, udata); } } @@ -103,7 +108,7 @@ void qemu_plugin_register_vcpu_tb_exec_inline_per_vcpu( qemu_plugin_u64 entry, uint64_t imm) { - if (!tb->mem_only) { + if (!tb_is_mem_only()) { plugin_register_inline_op_on_entry(&tb->cbs, 0, op, entry, imm); } } @@ -113,7 +118,7 @@ void qemu_plugin_register_vcpu_insn_exec_cb(struct qemu_plugin_insn *insn, enum qemu_plugin_cb_flags flags, void *udata) { - if (!insn->mem_only) { + if (!tb_is_mem_only()) { plugin_register_dyn_cb__udata(&insn->insn_cbs, cb, flags, udata); } } @@ -124,7 +129,7 @@ void qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu( qemu_plugin_u64 entry, uint64_t imm) { - if (!insn->mem_only) { + if (!tb_is_mem_only()) { plugin_register_inline_op_on_entry(&insn->insn_cbs, 0, op, entry, imm); } } @@ -206,7 +211,6 @@ qemu_plugin_tb_get_insn(const struct qemu_plugin_tb *tb, size_t idx) return NULL; } insn = g_ptr_array_index(tb->insns, idx); - insn->mem_only = tb->mem_only; return insn; } From patchwork Wed May 15 07:52:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796886 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp2854067wra; Wed, 15 May 2024 00:55:27 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVp2sbg3vPwA6b0m7hlu1SyRckXQxZwHjLzM4Z9WRbFP5WHgqqAO8xc5muFVIxSYUC0e0rxPzo48Sbfb979CDfD X-Google-Smtp-Source: AGHT+IG9cW3M3+AsObPAG161Bovd9F7tv23Jk+lfPUzxHQaoGgQB9lecqCSfZ4dDkSkdtV5YT/mj X-Received: by 2002:a05:6214:4412:b0:696:4086:5e1 with SMTP id 6a1803df08f44-6a16790406fmr233982196d6.2.1715759727104; Wed, 15 May 2024 00:55:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715759727; cv=none; d=google.com; s=arc-20160816; b=MnmiAfMZY8zsP2ydtdXMnow7BWU1b6luEe8Pnj0N3jtOp500fxfVXIj0+T33S2W2pj 4NPGaKKf1dvSFY4qX94sw+2x/OSIQw1vXNefLB3adF4RttVnLya3wrWc0rd22rpl/WEJ WXpIiIqMDIef8iIxkuYp9rH59K+u4r7Q/UHqCsE3CRojuUnHtzWSACQ0diDwUsV8r6FP SjUr9gIlMPiMCc+q0t4X+AnXPoj6CImAVE3j+GI/F+lQfXRjB1/Xfr2caKYBw3ke2Ld/ UPe0cwY91k/hXj8yGsXMPLU+ZJKrhah0nWg8nabykOMtK/arp32We7ZDAg4UJyR/ZpHA scfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NHmxyaHJvfTQV6eJCp+0w5/I7rCSGxf4lZPvvgw/PM4=; fh=vm85eyWrvOAHduw3sqEA+cYBqvHB7M0MHFcRJg7VWOo=; b=rGvFy/I3so3duVkx5V+x5MyPI2VA76rNQp85Jg+8k51tFbZF4RS1ADzvvteZOxdy/H h+cbvl1n5ttFwp8Fcnp8c4wWbmtGVmPoi9KY0tfMinSvWqQr8YrWUmgL6fOcXDmbtBm3 uoRs0ZkkR1DRRNUo7qZDjcRGjcfRHf+7FEyAgq1L/iO13yfSnrwpK6FVRj+4hGnMlShm 5cSzSdm04fdcCMyVctFLxYb62Re4C8cT/10Wzb0Fkwtp23LchRG2CM3Z1MU0v5JL/2jx 8lojiZhAcDe4OmfU0IXdLxeasxwhwFIyX9Pr587XS4JLtfMjmPCBaDdJ+FIm/bpzCyhi LuFw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=c1fFZEoZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-43df566f8d3si132852041cf.280.2024.05.15.00.55.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 00:55:27 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=c1fFZEoZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org We can delay the computation of haddr until the plugin actually requests it. 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; /* 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 DisasContextBase *db) ret = true; ptb->vaddr = db->pc_first; - ptb->vaddr2 = -1; - ptb->haddr1 = db->host_addr[0]; - ptb->haddr2 = NULL; ptb->mem_helper = false; tcg_gen_plugin_cb(PLUGIN_GEN_FROM_TB); @@ -363,23 +360,6 @@ void plugin_gen_insn_start(CPUState *cpu, const DisasContextBase *db) pc = db->pc_next; insn->vaddr = pc; - /* - * Detect page crossing to get the new host address. - * Note that we skip this when haddr1 == NULL, e.g. when we're - * fetching instructions from a region not backed by RAM. - */ - if (ptb->haddr1 == NULL) { - insn->haddr = NULL; - } else if (is_same_page(db, db->pc_next)) { - insn->haddr = ptb->haddr1 + pc - ptb->vaddr; - } else { - if (ptb->vaddr2 == -1) { - ptb->vaddr2 = TARGET_PAGE_ALIGN(db->pc_first); - get_page_addr_code_hostp(cpu_env(cpu), ptb->vaddr2, &ptb->haddr2); - } - insn->haddr = ptb->haddr2 + pc - ptb->vaddr2; - } - tcg_gen_plugin_cb(PLUGIN_GEN_FROM_INSN); } diff --git a/plugins/api.c b/plugins/api.c index 9e4aa9d2d9..0ae19774df 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -242,7 +242,30 @@ uint64_t qemu_plugin_insn_vaddr(const struct qemu_plugin_insn *insn) void *qemu_plugin_insn_haddr(const struct qemu_plugin_insn *insn) { - return insn->haddr; + const DisasContextBase *db = tcg_ctx->plugin_db; + vaddr page0_last = db->pc_first | ~TARGET_PAGE_MASK; + + if (db->fake_insn) { + return NULL; + } + + /* + * ??? The return value is not intended for use of host memory, + * but as a proxy for address space and physical address. + * Thus we are only interested in the first byte and do not + * care about spanning pages. + */ + if (insn->vaddr <= page0_last) { + if (db->host_addr[0] == NULL) { + return NULL; + } + return db->host_addr[0] + insn->vaddr - db->pc_first; + } else { + if (db->host_addr[1] == NULL) { + return NULL; + } + return db->host_addr[1] + insn->vaddr - (page0_last + 1); + } } char *qemu_plugin_insn_disas(const struct qemu_plugin_insn *insn) From patchwork Wed May 15 07:52:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796892 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp2854725wra; Wed, 15 May 2024 00:57:39 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU0x31PmZ5DHO7BJHxzMh6JJqCR3gWc0dTyRtrB9B9XxCDU6fY2Mtmlu4sdVz9/J9Y07PPdviIFATEvk3ccDQzx X-Google-Smtp-Source: AGHT+IERPo+5wtbCLGIGQFnSlXlvT+Ugbz740JmWTq2jh53Iz6w2NEukcsr/kE2fmBeBhpkkTY1T X-Received: by 2002:ac8:570a:0:b0:43d:f943:624c with SMTP id d75a77b69052e-43dfda8cacemr179217811cf.6.1715759859565; Wed, 15 May 2024 00:57:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715759859; cv=none; d=google.com; s=arc-20160816; b=tXxAYu39k9EhccqBaHUXjGeRr0t/jlWZtNk/hT3TlTdUkQrSXaSaKr5o9KxGp3zUgs AJzD8ZtQBl8BuFuynfRb95BZtU1eKTC2WKD5n7GX0COWPpkwMZKz3DEigZpnlnLELAYJ Ie88yfsYL6SSVv2kC8bvpBWDwyffru0STj0wtDsjmPFO1fRrN+s9hJ2YSNlvHnMVswkB +bZ4Kn7eTJg7fbBtiswhgu4HVD1B+hpy9O28/gCHgQITzITtHvX5dZLnlZOFfTJ5iAuV VDTNJ8/X9OfLmqdesMJSlaLbxkXeQ+3/fd0rAgwEwObn/Awm3IInoBNbVGwyaLw+YteQ Suew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nAVbhs+RqNvGH8rJ76ZP56RL9rwGY3Fja1sdqAVH2vU=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=F1oJ9HoFg1NrTqKm83ClH3ZCU2XpObCE9zwPN0nwNCRqMya5bV2Fg3c65+BixrIzHu Co6vfCW5PGkJVfSoqfXrZJUCTtzbq+xGIACAQqjk8UKtTA1z9G5GlsltMyz/F6UJxIfy WS9lfYufhxyPScGiOY8lwhUGcTsHII/7Tcw8dna08/aDS7mScwWzCdwGbM36czgc77eo 8N2+JiPY0/lqAEyaErqASzyB0jpSqp0QaXcjbnUYI3HcZUZPqcgruo8jQRJ2qNkHwCQc lakTh6dtz4Ivz3HINGH1y/093OdL2oO2JOKZAhLerJ7lTHsHLwD0M+gBbnXJewM9cJKc fbeA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZqU1SAMb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-43df7522ab7si135940171cf.697.2024.05.15.00.57.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 00:57:39 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZqU1SAMb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org We do not need to separately record the start of the TB. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- include/qemu/plugin.h | 1 - accel/tcg/plugin-gen.c | 3 +-- plugins/api.c | 3 ++- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/include/qemu/plugin.h b/include/qemu/plugin.h index 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; /* 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 *plugin_tb) int insn_idx = -1; if (unlikely(qemu_loglevel_mask(LOG_TB_OP_PLUGIN) - && qemu_log_in_addr_range(plugin_tb->vaddr))) { + && qemu_log_in_addr_range(tcg_ctx->plugin_db->pc_first))) { FILE *logfile = qemu_log_trylock(); if (logfile) { fprintf(logfile, "OP before plugin injection:\n"); @@ -318,7 +318,6 @@ bool plugin_gen_tb_start(CPUState *cpu, const DisasContextBase *db) ret = true; - ptb->vaddr = db->pc_first; ptb->mem_helper = false; tcg_gen_plugin_cb(PLUGIN_GEN_FROM_TB); diff --git a/plugins/api.c b/plugins/api.c index 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) uint64_t qemu_plugin_tb_vaddr(const struct qemu_plugin_tb *tb) { - return tb->vaddr; + const DisasContextBase *db = tcg_ctx->plugin_db; + return db->pc_first; } struct qemu_plugin_insn * From patchwork Wed May 15 07:52:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796874 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp2853474wra; Wed, 15 May 2024 00:53:31 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWqfCvUrzYLYWjT2GCYCdVBW9fpuwDubPJkMydqs/j0qZu2KVPvwAyKjIfSHCFNnOgfmmIor0gA4DGttmUiTDH2 X-Google-Smtp-Source: AGHT+IHNR9lqgRBq2PBB7yg0+jElUJKcAlc8aA4y8+2DSd4KI18WypFCSmXgIBYWNIhUuQ6zgIyZ X-Received: by 2002:a05:620a:5e0b:b0:792:bbdb:2520 with SMTP id af79cd13be357-792c75749e9mr1763215485a.9.1715759611615; Wed, 15 May 2024 00:53:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715759611; cv=none; d=google.com; s=arc-20160816; b=WgGTpG2+GtBv+YBvawdgEBfeVmhixRyGt8zMVYwqKHulxBvB4vrsrBSpfuQ3tZHyrD H13Ifr/ocXmQoa2SCRphWWZbUPiQr0k7gKbhInzifD8K7dkuPm0DTTUs0RgY0FhxRZSY K0CnSh88rCPPbox8ZLm//MI8seGZrVl1HlfQXqe+gV+HYLExnkn0xfy+r3kyFFymzzQU 1+xdejN2cl7425IuHrpfeoF399Vhq1x6U4UtG3ZDmXlugaaqPlQcaPbe51H6SxfDR3LC iDEP1v9SEMQt8asUkLTzebnuQfKVarX4CGC2Q+/LmVYyrbV0pX0zWINF2tdh6J2NsHQA 8iHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+l6G3m8cadQ7WYYi4wJCHAd6krJgJAZNy2Yqel8DyXU=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=mCrX6webZ8pKk7F9MXSjIXyd0ZilH49bHC4q1xDI/4IfW4ArZQ6D3Buc/BhYxmM6nf VecimYg3cEVkPB5bCeMQ8RBiDZiO+Zf/+ItNraHtxNaY2b6jT/ILofGGhzBSPs1WqWyS 49ifdSHFBq7rcQwNFoOivz1QCLfspY6P/Xtqr6FR9r7rC6lvQOmZWK0MEtT4j62Glpps QAauIjVsWh3qYBVxBDoDH7JJciLxQkrpGK1Yl1P1PnlKSLdhooA5zfu9xJbCI95e7AHV pYamAk6gb7YC6D43V1DIvsQZQiITDYI8sFVOS1amCoGCN0EdXjgdD3PMq/viWLHNnwii OJlg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=F0cFWyU5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-792bf30ac4bsi1432513185a.229.2024.05.15.00.53.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 00:53:31 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=F0cFWyU5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org We don't need to allocate plugin context at startup, we can wait until we actually use it. Reviewed-by: Philippe Mathieu-Daudé 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) bool plugin_gen_tb_start(CPUState *cpu, const DisasContextBase *db) { - bool ret = false; + struct qemu_plugin_tb *ptb; - if (test_bit(QEMU_PLUGIN_EV_VCPU_TB_TRANS, cpu->plugin_state->event_mask)) { - struct qemu_plugin_tb *ptb = tcg_ctx->plugin_tb; - - /* reset callbacks */ - if (ptb->cbs) { - g_array_set_size(ptb->cbs, 0); - } - ptb->n = 0; - - ret = true; - - ptb->mem_helper = false; - - tcg_gen_plugin_cb(PLUGIN_GEN_FROM_TB); + if (!test_bit(QEMU_PLUGIN_EV_VCPU_TB_TRANS, + cpu->plugin_state->event_mask)) { + return false; } tcg_ctx->plugin_db = db; tcg_ctx->plugin_insn = NULL; + ptb = tcg_ctx->plugin_tb; - return ret; + if (ptb) { + /* Reset callbacks */ + if (ptb->cbs) { + g_array_set_size(ptb->cbs, 0); + } + ptb->n = 0; + ptb->mem_helper = false; + } else { + ptb = g_new0(struct qemu_plugin_tb, 1); + tcg_ctx->plugin_tb = ptb; + ptb->insns = g_ptr_array_new(); + } + + tcg_gen_plugin_cb(PLUGIN_GEN_FROM_TB); + return true; } void plugin_gen_insn_start(CPUState *cpu, const DisasContextBase *db) diff --git a/tcg/tcg.c b/tcg/tcg.c index 71daa5d268..34e3056380 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -761,14 +761,6 @@ QEMU_BUILD_BUG_ON((int)(offsetof(CPUNegativeOffsetState, tlb.f[0]) - < MIN_TLB_MASK_TABLE_OFS); #endif -static void alloc_tcg_plugin_context(TCGContext *s) -{ -#ifdef CONFIG_PLUGIN - s->plugin_tb = g_new0(struct qemu_plugin_tb, 1); - s->plugin_tb->insns = g_ptr_array_new(); -#endif -} - /* * All TCG threads except the parent (i.e. the one that called tcg_context_init * and registered the target's TCG globals) must register with this function @@ -813,7 +805,6 @@ void tcg_register_thread(void) qatomic_set(&tcg_ctxs[n], s); if (n > 0) { - alloc_tcg_plugin_context(s); tcg_region_initial_alloc(s); } @@ -1360,8 +1351,6 @@ static void tcg_context_init(unsigned max_cpus) indirect_reg_alloc_order[i] = tcg_target_reg_alloc_order[i]; } - alloc_tcg_plugin_context(s); - tcg_ctx = s; /* * In user-mode we simply share the init context among threads, since we From patchwork Wed May 15 07:52:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796897 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp2855432wra; Wed, 15 May 2024 01:00:11 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWTzx1Yl7tNLJ/pn0rcAoR1wWDD05xQBpOIBdW07f+Tc/icuP0APCQjU2FUqjDKyzRT9ARuuO/GQOWDCbjRc7o9 X-Google-Smtp-Source: AGHT+IGvwJWc8PCCHpo4CpHVrXpX/pXxz6zZn8XuIhfT3xKudofhUceyYSmE0Ys1vndZ6lHiVB68 X-Received: by 2002:a05:6214:398f:b0:6a0:ad3a:96ec with SMTP id 6a1803df08f44-6a168165f33mr157545736d6.17.1715760011663; Wed, 15 May 2024 01:00:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715760011; cv=none; d=google.com; s=arc-20160816; b=M3vbkyIJz0lAslD+RYNV+wR9Q7YDDspH6R/UuA3bFAdgHQM19lapvlWDZ7diSVel8Y xGlTLG13SEPUBYZ+vTyyGZh9cqX1CXNxP2MauSyJ3ELEBmnkIF4DfHDZ40dFB3n2IqLJ ElcyqDfLGzEWyI4WA78GlH9hVOZLTrBNEUgHNyWVCEydaRXJ3zBtzsm1O/LaBAbtiuP1 4aJUukk2CLfHRd27ITd9s3pU8mOzF3Q9rQxUAyyJoT0/mLAA7K3Rt80Ic6IiQU9quTuh 68z5TZE4+Gr0yC2hhiQEW0XA6oqSeXwUPxO8L06W3Ph4UswNwuWPS9enyNSVSI8ZU5Am OtdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ed4EkfWXBrfCLsx83mIxp0LwZk/NBO19akBhz76SUNk=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=VOtIdMI5s+iRidINzzOvMtGxYNs6iv8W2qs7eoxuchvGnRYboU1W0+UtbtnLBLt9KK uxuM87ecOFvsmgEcyMmuZ7GO4m/7T5exBcFtDV14neEbik9ZMwUm9QISvSGpNZans85p u47qCh8IHRgohxPOgiHHXg6B1LZnkgqQosTXvYvOKl4HClU2zZWxUZAwElJ367uXwIXR kTGw6RMHiBG3XalH3AXPPSIi1OnsPFuW48IWbxUSvgZ8EyStELMqBPhRwPsDwPuc9Yvs QgWuEWYN/g2SIMy7ilwIBbS9epG68k5thaET32N6wQaMEBTKoSkZ5E6UJF5bhKCqaD8I 0A8A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mOpgVblH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6a15f200033si136731976d6.151.2024.05.15.01.00.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 01:00:11 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mOpgVblH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Almost all of the disas_log implementations are identical. Unify them within translator_loop. Drop extra Priv/Virt logging from target/riscv. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- accel/tcg/translator.c | 9 ++++++++- target/alpha/translate.c | 9 --------- target/arm/tcg/translate-a64.c | 11 ----------- target/arm/tcg/translate.c | 12 ------------ target/avr/translate.c | 8 -------- target/cris/translate.c | 11 ----------- target/hexagon/translate.c | 9 --------- target/hppa/translate.c | 6 ++++-- target/i386/tcg/translate.c | 11 ----------- target/loongarch/tcg/translate.c | 8 -------- target/m68k/translate.c | 9 --------- target/microblaze/translate.c | 9 --------- target/mips/tcg/translate.c | 9 --------- target/openrisc/translate.c | 11 ----------- target/ppc/translate.c | 9 --------- target/riscv/translate.c | 18 ------------------ target/rx/translate.c | 8 -------- target/sh4/translate.c | 9 --------- target/sparc/translate.c | 9 --------- target/tricore/translate.c | 9 --------- target/xtensa/translate.c | 9 --------- 21 files changed, 12 insertions(+), 191 deletions(-) diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 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" 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 = 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 *dcbase, CPUState *cpu) } } -static void alpha_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cpu, FILE *logfile) -{ - fprintf(logfile, "IN: %s\n", lookup_symbol(dcbase->pc_first)); - target_disas(logfile, cpu, dcbase->pc_first, dcbase->tb->size); -} - static const TranslatorOps alpha_tr_ops = { .init_disas_context = alpha_tr_init_disas_context, .tb_start = alpha_tr_tb_start, .insn_start = alpha_tr_insn_start, .translate_insn = alpha_tr_translate_insn, .tb_stop = alpha_tr_tb_stop, - .disas_log = alpha_tr_disas_log, }; void gen_intermediate_code(CPUState *cpu, TranslationBlock *tb, int *max_insns, diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 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) } } -static void aarch64_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cpu, FILE *logfile) -{ - DisasContext *dc = container_of(dcbase, DisasContext, base); - - fprintf(logfile, "IN: %s\n", lookup_symbol(dc->base.pc_first)); - target_disas(logfile, cpu, dc->base.pc_first, dc->base.tb->size); -} - const TranslatorOps aarch64_translator_ops = { .init_disas_context = aarch64_tr_init_disas_context, .tb_start = aarch64_tr_tb_start, .insn_start = aarch64_tr_insn_start, .translate_insn = aarch64_tr_translate_insn, .tb_stop = aarch64_tr_tb_stop, - .disas_log = aarch64_tr_disas_log, }; diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c index dc49a8d806..d605e10f11 100644 --- a/target/arm/tcg/translate.c +++ b/target/arm/tcg/translate.c @@ -23,7 +23,6 @@ #include "translate.h" #include "translate-a32.h" #include "qemu/log.h" -#include "disas/disas.h" #include "arm_ldst.h" #include "semihosting/semihost.h" #include "cpregs.h" @@ -9663,22 +9662,12 @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) } } -static void arm_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cpu, FILE *logfile) -{ - DisasContext *dc = container_of(dcbase, DisasContext, base); - - fprintf(logfile, "IN: %s\n", lookup_symbol(dc->base.pc_first)); - target_disas(logfile, cpu, dc->base.pc_first, dc->base.tb->size); -} - static const TranslatorOps arm_translator_ops = { .init_disas_context = arm_tr_init_disas_context, .tb_start = arm_tr_tb_start, .insn_start = arm_tr_insn_start, .translate_insn = arm_tr_translate_insn, .tb_stop = arm_tr_tb_stop, - .disas_log = arm_tr_disas_log, }; static const TranslatorOps thumb_translator_ops = { @@ -9687,7 +9676,6 @@ static const TranslatorOps thumb_translator_ops = { .insn_start = arm_tr_insn_start, .translate_insn = thumb_tr_translate_insn, .tb_stop = arm_tr_tb_stop, - .disas_log = arm_tr_disas_log, }; /* generate intermediate code for basic block 'tb'. */ diff --git a/target/avr/translate.c b/target/avr/translate.c index 87e2bd5ef1..6df93d4c77 100644 --- a/target/avr/translate.c +++ b/target/avr/translate.c @@ -2787,20 +2787,12 @@ static void avr_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) } } -static void avr_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cs, FILE *logfile) -{ - fprintf(logfile, "IN: %s\n", lookup_symbol(dcbase->pc_first)); - target_disas(logfile, cs, dcbase->pc_first, dcbase->tb->size); -} - static const TranslatorOps avr_tr_ops = { .init_disas_context = avr_tr_init_disas_context, .tb_start = avr_tr_tb_start, .insn_start = avr_tr_insn_start, .translate_insn = avr_tr_translate_insn, .tb_stop = avr_tr_tb_stop, - .disas_log = avr_tr_disas_log, }; void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_insns, diff --git a/target/cris/translate.c b/target/cris/translate.c index b3a4d61d0a..b5410189d4 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -25,7 +25,6 @@ #include "qemu/osdep.h" #include "cpu.h" -#include "disas/disas.h" #include "exec/exec-all.h" #include "tcg/tcg-op.h" #include "exec/helper-proto.h" @@ -3148,22 +3147,12 @@ static void cris_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) } } -static void cris_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cpu, FILE *logfile) -{ - if (!DISAS_CRIS) { - fprintf(logfile, "IN: %s\n", lookup_symbol(dcbase->pc_first)); - target_disas(logfile, cpu, dcbase->pc_first, dcbase->tb->size); - } -} - static const TranslatorOps cris_tr_ops = { .init_disas_context = cris_tr_init_disas_context, .tb_start = cris_tr_tb_start, .insn_start = cris_tr_insn_start, .translate_insn = cris_tr_translate_insn, .tb_stop = cris_tr_tb_stop, - .disas_log = cris_tr_disas_log, }; void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_insns, diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c index fcba82f7dc..61302d4f46 100644 --- a/target/hexagon/translate.c +++ b/target/hexagon/translate.c @@ -1076,21 +1076,12 @@ static void hexagon_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) } } -static void hexagon_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cpu, FILE *logfile) -{ - fprintf(logfile, "IN: %s\n", lookup_symbol(dcbase->pc_first)); - target_disas(logfile, cpu, dcbase->pc_first, dcbase->tb->size); -} - - static const TranslatorOps hexagon_tr_ops = { .init_disas_context = hexagon_tr_init_disas_context, .tb_start = hexagon_tr_tb_start, .insn_start = hexagon_tr_insn_start, .translate_insn = hexagon_tr_translate_packet, .tb_stop = hexagon_tr_tb_stop, - .disas_log = hexagon_tr_disas_log, }; void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_insns, diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 6d45611888..1a806a9d09 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -4816,12 +4816,12 @@ static void hppa_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) } } +#ifdef CONFIG_USER_ONLY static void hppa_tr_disas_log(const DisasContextBase *dcbase, CPUState *cs, FILE *logfile) { target_ulong pc = dcbase->pc_first; -#ifdef CONFIG_USER_ONLY switch (pc) { case 0x00: fprintf(logfile, "IN:\n0x00000000: (null)\n"); @@ -4836,11 +4836,11 @@ static void hppa_tr_disas_log(const DisasContextBase *dcbase, fprintf(logfile, "IN:\n0x00000100: syscall\n"); return; } -#endif fprintf(logfile, "IN: %s\n", lookup_symbol(pc)); target_disas(logfile, cs, pc, dcbase->tb->size); } +#endif static const TranslatorOps hppa_tr_ops = { .init_disas_context = hppa_tr_init_disas_context, @@ -4848,7 +4848,9 @@ static const TranslatorOps hppa_tr_ops = { .insn_start = hppa_tr_insn_start, .translate_insn = hppa_tr_translate_insn, .tb_stop = hppa_tr_tb_stop, +#ifdef CONFIG_USER_ONLY .disas_log = hppa_tr_disas_log, +#endif }; void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_insns, diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index de87775016..ed601474a9 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -20,7 +20,6 @@ #include "qemu/host-utils.h" #include "cpu.h" -#include "disas/disas.h" #include "exec/exec-all.h" #include "tcg/tcg-op.h" #include "tcg/tcg-op-gvec.h" @@ -4798,22 +4797,12 @@ static void i386_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) } } -static void i386_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cpu, FILE *logfile) -{ - DisasContext *dc = container_of(dcbase, DisasContext, base); - - fprintf(logfile, "IN: %s\n", lookup_symbol(dc->base.pc_first)); - target_disas(logfile, cpu, dc->base.pc_first, dc->base.tb->size); -} - static const TranslatorOps i386_tr_ops = { .init_disas_context = i386_tr_init_disas_context, .tb_start = i386_tr_tb_start, .insn_start = i386_tr_insn_start, .translate_insn = i386_tr_translate_insn, .tb_stop = i386_tr_tb_stop, - .disas_log = i386_tr_disas_log, }; /* generate intermediate code for basic block 'tb'. */ diff --git a/target/loongarch/tcg/translate.c b/target/loongarch/tcg/translate.c index 7567712655..1fca4afc73 100644 --- a/target/loongarch/tcg/translate.c +++ b/target/loongarch/tcg/translate.c @@ -325,20 +325,12 @@ static void loongarch_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) } } -static void loongarch_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cpu, FILE *logfile) -{ - qemu_log("IN: %s\n", lookup_symbol(dcbase->pc_first)); - target_disas(logfile, cpu, dcbase->pc_first, dcbase->tb->size); -} - static const TranslatorOps loongarch_tr_ops = { .init_disas_context = loongarch_tr_init_disas_context, .tb_start = loongarch_tr_tb_start, .insn_start = loongarch_tr_insn_start, .translate_insn = loongarch_tr_translate_insn, .tb_stop = loongarch_tr_tb_stop, - .disas_log = loongarch_tr_disas_log, }; void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_insns, diff --git a/target/m68k/translate.c b/target/m68k/translate.c index 169927552a..445966fb6a 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -20,7 +20,6 @@ #include "qemu/osdep.h" #include "cpu.h" -#include "disas/disas.h" #include "exec/exec-all.h" #include "tcg/tcg-op.h" #include "qemu/log.h" @@ -6105,20 +6104,12 @@ static void m68k_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) } } -static void m68k_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cpu, FILE *logfile) -{ - fprintf(logfile, "IN: %s\n", lookup_symbol(dcbase->pc_first)); - target_disas(logfile, cpu, dcbase->pc_first, dcbase->tb->size); -} - static const TranslatorOps m68k_tr_ops = { .init_disas_context = m68k_tr_init_disas_context, .tb_start = m68k_tr_tb_start, .insn_start = m68k_tr_insn_start, .translate_insn = m68k_tr_translate_insn, .tb_stop = m68k_tr_tb_stop, - .disas_log = m68k_tr_disas_log, }; void gen_intermediate_code(CPUState *cpu, TranslationBlock *tb, int *max_insns, diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index 84cca04962..9746a6d479 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -20,7 +20,6 @@ #include "qemu/osdep.h" #include "cpu.h" -#include "disas/disas.h" #include "exec/exec-all.h" #include "exec/cpu_ldst.h" #include "tcg/tcg-op.h" @@ -1772,20 +1771,12 @@ static void mb_tr_tb_stop(DisasContextBase *dcb, CPUState *cs) } } -static void mb_tr_disas_log(const DisasContextBase *dcb, - CPUState *cs, FILE *logfile) -{ - fprintf(logfile, "IN: %s\n", lookup_symbol(dcb->pc_first)); - target_disas(logfile, cs, dcb->pc_first, dcb->tb->size); -} - static const TranslatorOps mb_tr_ops = { .init_disas_context = mb_tr_init_disas_context, .tb_start = mb_tr_tb_start, .insn_start = mb_tr_insn_start, .translate_insn = mb_tr_translate_insn, .tb_stop = mb_tr_tb_stop, - .disas_log = mb_tr_disas_log, }; void gen_intermediate_code(CPUState *cpu, TranslationBlock *tb, int *max_insns, diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c index 06c108cc9c..333469b268 100644 --- a/target/mips/tcg/translate.c +++ b/target/mips/tcg/translate.c @@ -29,7 +29,6 @@ #include "exec/translation-block.h" #include "semihosting/semihost.h" #include "trace.h" -#include "disas/disas.h" #include "fpu_helper.h" #define HELPER_H "helper.h" @@ -15475,20 +15474,12 @@ static void mips_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) } } -static void mips_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cs, FILE *logfile) -{ - fprintf(logfile, "IN: %s\n", lookup_symbol(dcbase->pc_first)); - target_disas(logfile, cs, dcbase->pc_first, dcbase->tb->size); -} - static const TranslatorOps mips_tr_ops = { .init_disas_context = mips_tr_init_disas_context, .tb_start = mips_tr_tb_start, .insn_start = mips_tr_insn_start, .translate_insn = mips_tr_translate_insn, .tb_stop = mips_tr_tb_stop, - .disas_log = mips_tr_disas_log, }; void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_insns, diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c index 23fff46084..ca566847cb 100644 --- a/target/openrisc/translate.c +++ b/target/openrisc/translate.c @@ -21,7 +21,6 @@ #include "qemu/osdep.h" #include "cpu.h" #include "exec/exec-all.h" -#include "disas/disas.h" #include "tcg/tcg-op.h" #include "qemu/log.h" #include "qemu/bitops.h" @@ -1638,22 +1637,12 @@ static void openrisc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) } } -static void openrisc_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cs, FILE *logfile) -{ - DisasContext *s = container_of(dcbase, DisasContext, base); - - fprintf(logfile, "IN: %s\n", lookup_symbol(s->base.pc_first)); - target_disas(logfile, cs, s->base.pc_first, s->base.tb->size); -} - static const TranslatorOps openrisc_tr_ops = { .init_disas_context = openrisc_tr_init_disas_context, .tb_start = openrisc_tr_tb_start, .insn_start = openrisc_tr_insn_start, .translate_insn = openrisc_tr_translate_insn, .tb_stop = openrisc_tr_tb_stop, - .disas_log = openrisc_tr_disas_log, }; void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_insns, diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 93ffec787c..49dee6cab0 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -21,7 +21,6 @@ #include "qemu/osdep.h" #include "cpu.h" #include "internal.h" -#include "disas/disas.h" #include "exec/exec-all.h" #include "tcg/tcg-op.h" #include "tcg/tcg-op-gvec.h" @@ -7405,20 +7404,12 @@ static void ppc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) } } -static void ppc_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cs, FILE *logfile) -{ - fprintf(logfile, "IN: %s\n", lookup_symbol(dcbase->pc_first)); - target_disas(logfile, cs, dcbase->pc_first, dcbase->tb->size); -} - static const TranslatorOps ppc_tr_ops = { .init_disas_context = ppc_tr_init_disas_context, .tb_start = ppc_tr_tb_start, .insn_start = ppc_tr_insn_start, .translate_insn = ppc_tr_translate_insn, .tb_stop = ppc_tr_tb_stop, - .disas_log = ppc_tr_disas_log, }; void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_insns, diff --git a/target/riscv/translate.c b/target/riscv/translate.c index 9ff09ebdb6..c999e942e1 100644 --- a/target/riscv/translate.c +++ b/target/riscv/translate.c @@ -20,7 +20,6 @@ #include "qemu/log.h" #include "cpu.h" #include "tcg/tcg-op.h" -#include "disas/disas.h" #include "exec/cpu_ldst.h" #include "exec/exec-all.h" #include "exec/helper-proto.h" @@ -1270,29 +1269,12 @@ static void riscv_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) } } -static void riscv_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cpu, FILE *logfile) -{ -#ifndef CONFIG_USER_ONLY - RISCVCPU *rvcpu = RISCV_CPU(cpu); - CPURISCVState *env = &rvcpu->env; -#endif - - fprintf(logfile, "IN: %s\n", lookup_symbol(dcbase->pc_first)); -#ifndef CONFIG_USER_ONLY - fprintf(logfile, "Priv: "TARGET_FMT_ld"; Virt: %d\n", - env->priv, env->virt_enabled); -#endif - target_disas(logfile, cpu, dcbase->pc_first, dcbase->tb->size); -} - static const TranslatorOps riscv_tr_ops = { .init_disas_context = riscv_tr_init_disas_context, .tb_start = riscv_tr_tb_start, .insn_start = riscv_tr_insn_start, .translate_insn = riscv_tr_translate_insn, .tb_stop = riscv_tr_tb_stop, - .disas_log = riscv_tr_disas_log, }; void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_insns, diff --git a/target/rx/translate.c b/target/rx/translate.c index f6e9e0ec90..92fb2b43ad 100644 --- a/target/rx/translate.c +++ b/target/rx/translate.c @@ -2247,20 +2247,12 @@ static void rx_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) } } -static void rx_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cs, FILE *logfile) -{ - fprintf(logfile, "IN: %s\n", lookup_symbol(dcbase->pc_first)); - target_disas(logfile, cs, dcbase->pc_first, dcbase->tb->size); -} - static const TranslatorOps rx_tr_ops = { .init_disas_context = rx_tr_init_disas_context, .tb_start = rx_tr_tb_start, .insn_start = rx_tr_insn_start, .translate_insn = rx_tr_translate_insn, .tb_stop = rx_tr_tb_stop, - .disas_log = rx_tr_disas_log, }; void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_insns, diff --git a/target/sh4/translate.c b/target/sh4/translate.c index b3282f3ac7..53b092175d 100644 --- a/target/sh4/translate.c +++ b/target/sh4/translate.c @@ -19,7 +19,6 @@ #include "qemu/osdep.h" #include "cpu.h" -#include "disas/disas.h" #include "exec/exec-all.h" #include "tcg/tcg-op.h" #include "exec/helper-proto.h" @@ -2310,20 +2309,12 @@ static void sh4_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) } } -static void sh4_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cs, FILE *logfile) -{ - fprintf(logfile, "IN: %s\n", lookup_symbol(dcbase->pc_first)); - target_disas(logfile, cs, dcbase->pc_first, dcbase->tb->size); -} - static const TranslatorOps sh4_tr_ops = { .init_disas_context = sh4_tr_init_disas_context, .tb_start = sh4_tr_tb_start, .insn_start = sh4_tr_insn_start, .translate_insn = sh4_tr_translate_insn, .tb_stop = sh4_tr_tb_stop, - .disas_log = sh4_tr_disas_log, }; void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_insns, diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 99c6f3cc72..dca072888a 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -21,7 +21,6 @@ #include "qemu/osdep.h" #include "cpu.h" -#include "disas/disas.h" #include "exec/helper-proto.h" #include "exec/exec-all.h" #include "tcg/tcg-op.h" @@ -5149,20 +5148,12 @@ static void sparc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) } } -static void sparc_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cpu, FILE *logfile) -{ - fprintf(logfile, "IN: %s\n", lookup_symbol(dcbase->pc_first)); - target_disas(logfile, cpu, dcbase->pc_first, dcbase->tb->size); -} - static const TranslatorOps sparc_tr_ops = { .init_disas_context = sparc_tr_init_disas_context, .tb_start = sparc_tr_tb_start, .insn_start = sparc_tr_insn_start, .translate_insn = sparc_tr_translate_insn, .tb_stop = sparc_tr_tb_stop, - .disas_log = sparc_tr_disas_log, }; void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_insns, diff --git a/target/tricore/translate.c b/target/tricore/translate.c index c45e1d992e..a46a03e1fd 100644 --- a/target/tricore/translate.c +++ b/target/tricore/translate.c @@ -20,7 +20,6 @@ #include "qemu/osdep.h" #include "cpu.h" -#include "disas/disas.h" #include "exec/exec-all.h" #include "tcg/tcg-op.h" #include "exec/cpu_ldst.h" @@ -8453,20 +8452,12 @@ static void tricore_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) } } -static void tricore_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cpu, FILE *logfile) -{ - fprintf(logfile, "IN: %s\n", lookup_symbol(dcbase->pc_first)); - target_disas(logfile, cpu, dcbase->pc_first, dcbase->tb->size); -} - static const TranslatorOps tricore_tr_ops = { .init_disas_context = tricore_tr_init_disas_context, .tb_start = tricore_tr_tb_start, .insn_start = tricore_tr_insn_start, .translate_insn = tricore_tr_translate_insn, .tb_stop = tricore_tr_tb_stop, - .disas_log = tricore_tr_disas_log, }; diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index b206d57fc4..42109d33ad 100644 --- a/target/xtensa/translate.c +++ b/target/xtensa/translate.c @@ -32,7 +32,6 @@ #include "cpu.h" #include "exec/exec-all.h" -#include "disas/disas.h" #include "tcg/tcg-op.h" #include "qemu/log.h" #include "qemu/qemu-print.h" @@ -1221,20 +1220,12 @@ static void xtensa_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) } } -static void xtensa_tr_disas_log(const DisasContextBase *dcbase, - CPUState *cpu, FILE *logfile) -{ - fprintf(logfile, "IN: %s\n", lookup_symbol(dcbase->pc_first)); - target_disas(logfile, cpu, dcbase->pc_first, dcbase->tb->size); -} - static const TranslatorOps xtensa_translator_ops = { .init_disas_context = xtensa_tr_init_disas_context, .tb_start = xtensa_tr_tb_start, .insn_start = xtensa_tr_insn_start, .translate_insn = xtensa_tr_translate_insn, .tb_stop = xtensa_tr_tb_stop, - .disas_log = xtensa_tr_disas_log, }; void gen_intermediate_code(CPUState *cpu, TranslationBlock *tb, int *max_insns, From patchwork Wed May 15 07:52:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796906 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp2856815wra; Wed, 15 May 2024 01:03:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUcM5U3tMIaaviXD2eb/hfpZT5kCEBOetpRV9FUHHBCMx+/3Fg4TlSImgD4WZXl5yp7OiDEvmKMRxGAxctscOir X-Google-Smtp-Source: AGHT+IH410dSVqYaIgmKH6ZuPGFBcQKdWs3i2qGj2zmZkwAVhj9s1YpIUyWrx9qCIgXT6YO+ooMS X-Received: by 2002:a05:622a:4a0a:b0:43a:ed56:6a42 with SMTP id d75a77b69052e-43dfdd0cdeemr194526501cf.58.1715760196579; Wed, 15 May 2024 01:03:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715760196; cv=none; d=google.com; s=arc-20160816; b=iPg0AghGFkPomXKSSY9xQXvhlumkuxsWnyIMnVfaYpWj7XJRUPGQmtgqLUKfuQwu1P yVGoCGVKMDrbhnXIow8b/7DJJXam11MC3rXyYiFL+AaR0QhDWpqTZJDvxE7ZlC+qWJSf ciywNVx/5mS/mvOLptxh2kzcoR7rxv+Qj4hFOsdqQVTHBkSaUIxlDuTPtOUajBhUMzOm bujJSgGYU3qtfMybfSetsgZ6DbxB/TOIqTupKIh3NEmNmB52PzwKjzBYOePGuUZJNXhh nz5B+kSu9lMoYjXbpBwgM4sZc29t3nC9ZhBOYRyFTE6CUl4hvIn4T+7s6981W6PtDNsS Lz4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YMLriNtzm2n+Yau1lbyLPe0VCMn1fshh8b//AyQSKv8=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=Mzn8v0+gy6qK6+KHD/hzgmguEnZgDWkp3nuLGtuiRk2EaevNO3Fisu9FTnjmxVWHS7 phLRRP4DByonb40l0d5POMGd9FC/wf77BAY6432T/5sscPdJrH8qEFkfKC002QsxglpH tTnSaVJSMYn62uCSQnBNMmltfvboad3rHI7VKHVXu7gq90r493U6MO+A+Rn8GA6+jEJP zJwsNIK05TEPTlDGzBxdvQx1KZikt0KNeDDpTCMEuflDJZZQgA2PFZgOzgrjHTMT+yFY iVXnlx9UUZyt75brkc3nuvEIMT7t1bNPaklzd7W5EqGDp/FLwjCE4bJXyWI7qCDjFaPc ypwQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gbFQXnCu; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-43e0d0a6585si85329851cf.186.2024.05.15.01.03.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 01:03:16 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gbFQXnCu; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org We have eliminated most uses of this hook. Reduce further by allowing the hook to handle only the special cases, returning false for normal processing. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- include/exec/translator.h | 2 +- accel/tcg/translator.c | 5 ++--- target/hppa/translate.c | 15 ++++++--------- target/s390x/tcg/translate.c | 8 +++----- 4 files changed, 12 insertions(+), 18 deletions(-) diff --git a/include/exec/translator.h b/include/exec/translator.h index 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; /** 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 *tb, int *max_insns, if (logfile) { fprintf(logfile, "----------------\n"); - if (ops->disas_log) { - ops->disas_log(db, cpu, logfile); - } else { + if (!ops->disas_log || + !ops->disas_log(db, cpu, logfile)) { fprintf(logfile, "IN: %s\n", lookup_symbol(db->pc_first)); target_disas(logfile, cpu, db->pc_first, db->tb->size); } diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 1a806a9d09..7287e1debf 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -19,7 +19,6 @@ #include "qemu/osdep.h" #include "cpu.h" -#include "disas/disas.h" #include "qemu/host-utils.h" #include "exec/exec-all.h" #include "exec/page-protection.h" @@ -4817,7 +4816,7 @@ static void hppa_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) } #ifdef CONFIG_USER_ONLY -static void hppa_tr_disas_log(const DisasContextBase *dcbase, +static bool hppa_tr_disas_log(const DisasContextBase *dcbase, CPUState *cs, FILE *logfile) { target_ulong pc = dcbase->pc_first; @@ -4825,20 +4824,18 @@ static void hppa_tr_disas_log(const DisasContextBase *dcbase, switch (pc) { case 0x00: fprintf(logfile, "IN:\n0x00000000: (null)\n"); - return; + return true; case 0xb0: fprintf(logfile, "IN:\n0x000000b0: light-weight-syscall\n"); - return; + return true; case 0xe0: fprintf(logfile, "IN:\n0x000000e0: set-thread-pointer-syscall\n"); - return; + return true; case 0x100: fprintf(logfile, "IN:\n0x00000100: syscall\n"); - return; + return true; } - - fprintf(logfile, "IN: %s\n", lookup_symbol(pc)); - target_disas(logfile, cs, pc, dcbase->tb->size); + return false; } #endif diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index 6d7f6e7064..d74939389a 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -31,7 +31,6 @@ #include "qemu/osdep.h" #include "cpu.h" #include "s390x-internal.h" -#include "disas/disas.h" #include "exec/exec-all.h" #include "tcg/tcg-op.h" #include "tcg/tcg-op-gvec.h" @@ -6520,7 +6519,7 @@ static void s390x_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) } } -static void s390x_tr_disas_log(const DisasContextBase *dcbase, +static bool s390x_tr_disas_log(const DisasContextBase *dcbase, CPUState *cs, FILE *logfile) { DisasContext *dc = container_of(dcbase, DisasContext, base); @@ -6528,10 +6527,9 @@ static void s390x_tr_disas_log(const DisasContextBase *dcbase, if (unlikely(dc->ex_value)) { /* ??? Unfortunately target_disas can't use host memory. */ fprintf(logfile, "IN: EXECUTE %016" PRIx64, dc->ex_value); - } else { - fprintf(logfile, "IN: %s\n", lookup_symbol(dc->base.pc_first)); - target_disas(logfile, cs, dc->base.pc_first, dc->base.tb->size); + return true; } + return false; } static const TranslatorOps s390x_tr_ops = { From patchwork Wed May 15 07:52:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796894 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp2854720wra; Wed, 15 May 2024 00:57:39 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWZzlIHe8nebwZRU0h/1lifBnLuzf8cOdLf+JeRuY+w81VhVGq4WadVKgjLjxLPwKcLdbTX2rVkySCEvkYRTQsF X-Google-Smtp-Source: AGHT+IG3tPWicMR6mHXNvtgHJjahAZc3rpAxn4GFfAlbk8RNHniP3DxqpQpGtcd6eATrIt2mDNfS X-Received: by 2002:a05:620a:424f:b0:792:9403:2d77 with SMTP id af79cd13be357-792c75f216dmr1750762185a.51.1715759859106; Wed, 15 May 2024 00:57:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715759859; cv=none; d=google.com; s=arc-20160816; b=dz2rdsqdl6JFY+HjGN/E7S1xTt9Abn2yY/bam46Nvd6Cu56WGd4Yg1lA9Zvh0gRntV DhG0MSAyvrxlJwQnQOoFlJYFQFuRKdwLLHN4nsNhc+wcumaEJbkWia+TxO1OKCdyZ8k1 CEfJjOpHA3vdb0zG6M6sO1b3+cRVUxEt1qfJRiEZVdBMeIW71zo0lnzF6JDCVgLxQJRk 2xwODlsp7jGxr2dIX6QCHePPJuxmyE8AX7m+V3oWFaOod/cFnwcoYCAJHIde2mCzzIxO tqF02BBj7hxXxp+GAtSVtBTaxcMcymIGR67PcUBq8UL1p+XTbpOPH/84A6KAOVqn/L+W Eucg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Y61N3ZndsXj+OYnw5ixGVRN4k3cp76y9d3B3VVCvN+A=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=mx9sj/lrzkkHSOkdnc1AP8S0UtqByHFCQD0KhBIkJQ8GtLfGpoRT0buqkMZCmXTwr6 /efrmjeWkEHYI5qA3sUsxOtcvd55weyyXDAWCp+0FRxCZztmU9Qd2gliAqopRh2k4Dcq D1gOwY5KKOrT4diXbwXLrCZJz640QbJJZq0xGGUHy5DrnmDkC6AaAif1kQKop0BvRWmj dzGH7cHGC9vSFbiz1/34UQfflYaBuT4aUMu76C836F8ilhfJMnK2dafGjqB6FEAAQycg FE/Es3zW3LEj2dvI9BxepGLZVd0Xjk6+RPkX2xZDiz872BazOM1BNCNsRnQpIrne0svy Fxjw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R9BeCIgv; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-792bf361f3csi1330585585a.582.2024.05.15.00.57.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 00:57:39 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R9BeCIgv; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The routines in disas-common.c are also used from disas-mon.c. Otherwise the rest of disassembly is only used from tcg. While we're at it, put host and target code into separate files. Reviewed-by: Philippe Mathieu-Daudé 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; +void disas_initialize_debug(CPUDebug *s); void disas_initialize_debug_target(CPUDebug *s, CPUState *cpu); int disas_gstring_printf(FILE *stream, const char *fmt, ...) G_GNUC_PRINTF(2, 3); +int print_insn_od_host(bfd_vma pc, disassemble_info *info); +int print_insn_od_target(bfd_vma pc, disassemble_info *info); + #endif diff --git a/include/disas/disas.h b/include/disas/disas.h index 176775eff7..54a5e68443 100644 --- a/include/disas/disas.h +++ b/include/disas/disas.h @@ -2,13 +2,17 @@ #define QEMU_DISAS_H /* Disassemble this for me please... (debugging). */ +#ifdef CONFIG_TCG void disas(FILE *out, const void *code, size_t size); void target_disas(FILE *out, CPUState *cpu, uint64_t code, size_t size); +#endif void monitor_disas(Monitor *mon, CPUState *cpu, uint64_t pc, int nb_insn, bool is_physical); +#ifdef CONFIG_PLUGIN char *plugin_disas(CPUState *cpu, uint64_t addr, size_t size); +#endif /* Look up symbol for debugging purpose. Returns "" if unknown. */ const char *lookup_symbol(uint64_t orig_addr); diff --git a/disas/disas-common.c b/disas/disas-common.c new file mode 100644 index 0000000000..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 = NULL; + +/* + * Get LENGTH bytes from info's buffer, at target address memaddr. + * Transfer them to myaddr. + */ +static int target_read_memory(bfd_vma memaddr, bfd_byte *myaddr, int length, + struct disassemble_info *info) +{ + CPUDebug *s = container_of(info, CPUDebug, info); + int r = cpu_memory_rw_debug(s->cpu, memaddr, myaddr, length, 0); + return r ? EIO : 0; +} + +/* + * Print an error message. We can assume that this is in response to + * an error return from {host,target}_read_memory. + */ +static void perror_memory(int status, bfd_vma memaddr, + struct disassemble_info *info) +{ + if (status != EIO) { + /* Can't happen. */ + info->fprintf_func(info->stream, "Unknown error %d\n", status); + } else { + /* Address between memaddr and memaddr + len was out of bounds. */ + info->fprintf_func(info->stream, + "Address 0x%" PRIx64 " is out of bounds.\n", + memaddr); + } +} + +/* Print address in hex. */ +static void print_address(bfd_vma addr, struct disassemble_info *info) +{ + info->fprintf_func(info->stream, "0x%" PRIx64, addr); +} + +/* Stub prevents some fruitless earching in optabs disassemblers. */ +static int symbol_at_address(bfd_vma addr, struct disassemble_info *info) +{ + return 1; +} + +void disas_initialize_debug(CPUDebug *s) +{ + memset(s, 0, sizeof(*s)); + s->info.arch = bfd_arch_unknown; + s->info.cap_arch = -1; + s->info.cap_insn_unit = 4; + s->info.cap_insn_split = 4; + s->info.memory_error_func = perror_memory; + s->info.symbol_at_address_func = symbol_at_address; +} + +void disas_initialize_debug_target(CPUDebug *s, CPUState *cpu) +{ + disas_initialize_debug(s); + + s->cpu = cpu; + s->info.read_memory_func = target_read_memory; + s->info.print_address_func = print_address; + if (target_words_bigendian()) { + s->info.endian = BFD_ENDIAN_BIG; + } else { + s->info.endian = BFD_ENDIAN_LITTLE; + } + + CPUClass *cc = CPU_GET_CLASS(cpu); + if (cc->disas_set_info) { + cc->disas_set_info(cpu, &s->info); + } +} + +int disas_gstring_printf(FILE *stream, const char *fmt, ...) +{ + /* We abuse the FILE parameter to pass a GString. */ + GString *s = (GString *)stream; + int initial_len = s->len; + va_list va; + + va_start(va, fmt); + g_string_append_vprintf(s, fmt, va); + va_end(va); + + return s->len - initial_len; +} + +/* Look up symbol for debugging purpose. Returns "" if unknown. */ +const char *lookup_symbol(uint64_t orig_addr) +{ + const char *symbol = ""; + struct syminfo *s; + + for (s = syminfos; s; s = s->next) { + symbol = s->lookup_symbol(s, orig_addr); + if (symbol[0] != '\0') { + break; + } + } + + return symbol; +} diff --git a/disas/disas-host.c b/disas/disas-host.c new file mode 100644 index 0000000000..8146fafe80 --- /dev/null +++ b/disas/disas-host.c @@ -0,0 +1,129 @@ +/* + * Routines for host instruction disassembly. + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "disas/disas.h" +#include "disas/capstone.h" +#include "disas-internal.h" + + +/* + * Get LENGTH bytes from info's buffer, at host address memaddr. + * Transfer them to myaddr. + */ +static int host_read_memory(bfd_vma memaddr, bfd_byte *myaddr, int length, + struct disassemble_info *info) +{ + if (memaddr < info->buffer_vma + || memaddr + length > info->buffer_vma + info->buffer_length) { + /* Out of bounds. Use EIO because GDB uses it. */ + return EIO; + } + memcpy (myaddr, info->buffer + (memaddr - info->buffer_vma), length); + return 0; +} + +/* Print address in hex, truncated to the width of a host virtual address. */ +static void host_print_address(bfd_vma addr, struct disassemble_info *info) +{ + info->fprintf_func(info->stream, "0x%" PRIxPTR, (uintptr_t)addr); +} + +static void initialize_debug_host(CPUDebug *s) +{ + disas_initialize_debug(s); + + s->info.read_memory_func = host_read_memory; + s->info.print_address_func = host_print_address; +#if HOST_BIG_ENDIAN + s->info.endian = BFD_ENDIAN_BIG; +#else + s->info.endian = BFD_ENDIAN_LITTLE; +#endif +#if defined(CONFIG_TCG_INTERPRETER) + s->info.print_insn = print_insn_tci; +#elif defined(__i386__) + s->info.mach = bfd_mach_i386_i386; + s->info.cap_arch = CS_ARCH_X86; + s->info.cap_mode = CS_MODE_32; + s->info.cap_insn_unit = 1; + s->info.cap_insn_split = 8; +#elif defined(__x86_64__) + s->info.mach = bfd_mach_x86_64; + s->info.cap_arch = CS_ARCH_X86; + s->info.cap_mode = CS_MODE_64; + s->info.cap_insn_unit = 1; + s->info.cap_insn_split = 8; +#elif defined(_ARCH_PPC) + s->info.cap_arch = CS_ARCH_PPC; +# ifdef _ARCH_PPC64 + s->info.cap_mode = CS_MODE_64; +# endif +#elif defined(__riscv) +#if defined(_ILP32) || (__riscv_xlen == 32) + s->info.print_insn = print_insn_riscv32; +#elif defined(_LP64) + s->info.print_insn = print_insn_riscv64; +#else +#error unsupported RISC-V ABI +#endif +#elif defined(__aarch64__) + s->info.cap_arch = CS_ARCH_ARM64; +#elif defined(__alpha__) + s->info.print_insn = print_insn_alpha; +#elif defined(__sparc__) + s->info.print_insn = print_insn_sparc; + s->info.mach = bfd_mach_sparc_v9b; +#elif defined(__arm__) + /* TCG only generates code for arm mode. */ + s->info.cap_arch = CS_ARCH_ARM; +#elif defined(__MIPSEB__) + s->info.print_insn = print_insn_big_mips; +#elif defined(__MIPSEL__) + s->info.print_insn = print_insn_little_mips; +#elif defined(__m68k__) + s->info.print_insn = print_insn_m68k; +#elif defined(__s390__) + s->info.cap_arch = CS_ARCH_SYSZ; + s->info.cap_insn_unit = 2; + s->info.cap_insn_split = 6; +#elif defined(__hppa__) + s->info.print_insn = print_insn_hppa; +#elif defined(__loongarch__) + s->info.print_insn = print_insn_loongarch; +#endif +} + +/* Disassemble this for me please... (debugging). */ +void disas(FILE *out, const void *code, size_t size) +{ + uintptr_t pc; + int count; + CPUDebug s; + + initialize_debug_host(&s); + s.info.fprintf_func = fprintf; + s.info.stream = out; + s.info.buffer = code; + s.info.buffer_vma = (uintptr_t)code; + s.info.buffer_length = size; + s.info.show_opcodes = true; + + if (s.info.cap_arch >= 0 && cap_disas_host(&s.info, code, size)) { + return; + } + + if (s.info.print_insn == NULL) { + s.info.print_insn = print_insn_od_host; + } + for (pc = (uintptr_t)code; size > 0; pc += count, size -= count) { + fprintf(out, "0x%08" PRIxPTR ": ", pc); + count = s.info.print_insn(pc, &s.info); + fprintf(out, "\n"); + if (count < 0) { + break; + } + } +} diff --git a/disas/disas-target.c b/disas/disas-target.c new file mode 100644 index 0000000000..82313b2a67 --- /dev/null +++ b/disas/disas-target.c @@ -0,0 +1,84 @@ +/* + * Routines for target instruction disassembly. + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "disas/disas.h" +#include "disas/capstone.h" +#include "disas-internal.h" + + +void target_disas(FILE *out, CPUState *cpu, uint64_t code, size_t size) +{ + uint64_t pc; + int count; + CPUDebug s; + + disas_initialize_debug_target(&s, cpu); + s.info.fprintf_func = fprintf; + s.info.stream = out; + s.info.buffer_vma = code; + s.info.buffer_length = size; + s.info.show_opcodes = true; + + if (s.info.cap_arch >= 0 && cap_disas_target(&s.info, code, size)) { + return; + } + + if (s.info.print_insn == NULL) { + s.info.print_insn = print_insn_od_target; + } + + for (pc = code; size > 0; pc += count, size -= count) { + fprintf(out, "0x%08" PRIx64 ": ", pc); + count = s.info.print_insn(pc, &s.info); + fprintf(out, "\n"); + if (count < 0) { + break; + } + if (size < count) { + fprintf(out, + "Disassembler disagrees with translator over instruction " + "decoding\n" + "Please report this to qemu-devel@nongnu.org\n"); + break; + } + } +} + +#ifdef CONFIG_PLUGIN +static void plugin_print_address(bfd_vma addr, struct disassemble_info *info) +{ + /* does nothing */ +} + +/* + * We should only be dissembling one instruction at a time here. If + * there is left over it usually indicates the front end has read more + * bytes than it needed. + */ +char *plugin_disas(CPUState *cpu, uint64_t addr, size_t size) +{ + CPUDebug s; + GString *ds = g_string_new(NULL); + + disas_initialize_debug_target(&s, cpu); + s.info.fprintf_func = disas_gstring_printf; + s.info.stream = (FILE *)ds; /* abuse this slot */ + s.info.buffer_vma = addr; + s.info.buffer_length = size; + s.info.print_address_func = plugin_print_address; + + if (s.info.cap_arch >= 0 && cap_disas_plugin(&s.info, addr, size)) { + ; /* done */ + } else if (s.info.print_insn) { + s.info.print_insn(addr, &s.info); + } else { + ; /* cannot disassemble -- return empty string */ + } + + /* Return the buffer, freeing the GString container. */ + return g_string_free(ds, false); +} +#endif /* CONFIG_PLUGIN */ diff --git a/disas/disas.c b/disas/disas.c deleted file mode 100644 index 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 = NULL; - -/* - * Get LENGTH bytes from info's buffer, at host address memaddr. - * Transfer them to myaddr. - */ -static int host_read_memory(bfd_vma memaddr, bfd_byte *myaddr, int length, - struct disassemble_info *info) -{ - if (memaddr < info->buffer_vma - || memaddr + length > info->buffer_vma + info->buffer_length) { - /* Out of bounds. Use EIO because GDB uses it. */ - return EIO; - } - memcpy (myaddr, info->buffer + (memaddr - info->buffer_vma), length); - return 0; -} - -/* - * Get LENGTH bytes from info's buffer, at target address memaddr. - * Transfer them to myaddr. - */ -static int target_read_memory(bfd_vma memaddr, bfd_byte *myaddr, int length, - struct disassemble_info *info) -{ - CPUDebug *s = container_of(info, CPUDebug, info); - int r = cpu_memory_rw_debug(s->cpu, memaddr, myaddr, length, 0); - return r ? EIO : 0; -} - -/* - * Print an error message. We can assume that this is in response to - * an error return from {host,target}_read_memory. - */ -static void perror_memory(int status, bfd_vma memaddr, - struct disassemble_info *info) -{ - if (status != EIO) { - /* Can't happen. */ - info->fprintf_func(info->stream, "Unknown error %d\n", status); - } else { - /* Address between memaddr and memaddr + len was out of bounds. */ - info->fprintf_func(info->stream, - "Address 0x%" PRIx64 " is out of bounds.\n", - memaddr); - } -} - -/* Print address in hex. */ -static void print_address(bfd_vma addr, struct disassemble_info *info) -{ - info->fprintf_func(info->stream, "0x%" PRIx64, addr); -} - -/* Print address in hex, truncated to the width of a host virtual address. */ -static void host_print_address(bfd_vma addr, struct disassemble_info *info) -{ - print_address((uintptr_t)addr, info); -} - -/* Stub prevents some fruitless earching in optabs disassemblers. */ -static int symbol_at_address(bfd_vma addr, struct disassemble_info *info) -{ - return 1; -} - -static int print_insn_objdump(bfd_vma pc, disassemble_info *info, - const char *prefix) -{ - int i, n = info->buffer_length; - g_autofree uint8_t *buf = g_malloc(n); - - if (info->read_memory_func(pc, buf, n, info) == 0) { - for (i = 0; i < n; ++i) { - if (i % 32 == 0) { - info->fprintf_func(info->stream, "\n%s: ", prefix); - } - info->fprintf_func(info->stream, "%02x", buf[i]); - } - } else { - info->fprintf_func(info->stream, "unable to read memory"); - } - return n; -} - -static int print_insn_od_host(bfd_vma pc, disassemble_info *info) -{ - return print_insn_objdump(pc, info, "OBJD-H"); -} - -static int print_insn_od_target(bfd_vma pc, disassemble_info *info) -{ - return print_insn_objdump(pc, info, "OBJD-T"); -} - -static void initialize_debug(CPUDebug *s) -{ - memset(s, 0, sizeof(*s)); - s->info.arch = bfd_arch_unknown; - s->info.cap_arch = -1; - s->info.cap_insn_unit = 4; - s->info.cap_insn_split = 4; - s->info.memory_error_func = perror_memory; - s->info.symbol_at_address_func = symbol_at_address; -} - -void disas_initialize_debug_target(CPUDebug *s, CPUState *cpu) -{ - initialize_debug(s); - - s->cpu = cpu; - s->info.read_memory_func = target_read_memory; - s->info.print_address_func = print_address; - if (target_words_bigendian()) { - s->info.endian = BFD_ENDIAN_BIG; - } else { - s->info.endian = BFD_ENDIAN_LITTLE; - } - - CPUClass *cc = CPU_GET_CLASS(cpu); - if (cc->disas_set_info) { - cc->disas_set_info(cpu, &s->info); - } -} - -static void initialize_debug_host(CPUDebug *s) -{ - initialize_debug(s); - - s->info.read_memory_func = host_read_memory; - s->info.print_address_func = host_print_address; -#if HOST_BIG_ENDIAN - s->info.endian = BFD_ENDIAN_BIG; -#else - s->info.endian = BFD_ENDIAN_LITTLE; -#endif -#if defined(CONFIG_TCG_INTERPRETER) - s->info.print_insn = print_insn_tci; -#elif defined(__i386__) - s->info.mach = bfd_mach_i386_i386; - s->info.cap_arch = CS_ARCH_X86; - s->info.cap_mode = CS_MODE_32; - s->info.cap_insn_unit = 1; - s->info.cap_insn_split = 8; -#elif defined(__x86_64__) - s->info.mach = bfd_mach_x86_64; - s->info.cap_arch = CS_ARCH_X86; - s->info.cap_mode = CS_MODE_64; - s->info.cap_insn_unit = 1; - s->info.cap_insn_split = 8; -#elif defined(_ARCH_PPC) - s->info.cap_arch = CS_ARCH_PPC; -# ifdef _ARCH_PPC64 - s->info.cap_mode = CS_MODE_64; -# endif -#elif defined(__riscv) -#if defined(_ILP32) || (__riscv_xlen == 32) - s->info.print_insn = print_insn_riscv32; -#elif defined(_LP64) - s->info.print_insn = print_insn_riscv64; -#else -#error unsupported RISC-V ABI -#endif -#elif defined(__aarch64__) - s->info.cap_arch = CS_ARCH_ARM64; -#elif defined(__alpha__) - s->info.print_insn = print_insn_alpha; -#elif defined(__sparc__) - s->info.print_insn = print_insn_sparc; - s->info.mach = bfd_mach_sparc_v9b; -#elif defined(__arm__) - /* TCG only generates code for arm mode. */ - s->info.cap_arch = CS_ARCH_ARM; -#elif defined(__MIPSEB__) - s->info.print_insn = print_insn_big_mips; -#elif defined(__MIPSEL__) - s->info.print_insn = print_insn_little_mips; -#elif defined(__m68k__) - s->info.print_insn = print_insn_m68k; -#elif defined(__s390__) - s->info.cap_arch = CS_ARCH_SYSZ; - s->info.cap_insn_unit = 2; - s->info.cap_insn_split = 6; -#elif defined(__hppa__) - s->info.print_insn = print_insn_hppa; -#elif defined(__loongarch__) - s->info.print_insn = print_insn_loongarch; -#endif -} - -/* Disassemble this for me please... (debugging). */ -void target_disas(FILE *out, CPUState *cpu, uint64_t code, size_t size) -{ - uint64_t pc; - int count; - CPUDebug s; - - disas_initialize_debug_target(&s, cpu); - s.info.fprintf_func = fprintf; - s.info.stream = out; - s.info.buffer_vma = code; - s.info.buffer_length = size; - s.info.show_opcodes = true; - - if (s.info.cap_arch >= 0 && cap_disas_target(&s.info, code, size)) { - return; - } - - if (s.info.print_insn == NULL) { - s.info.print_insn = print_insn_od_target; - } - - for (pc = code; size > 0; pc += count, size -= count) { - fprintf(out, "0x%08" PRIx64 ": ", pc); - count = s.info.print_insn(pc, &s.info); - fprintf(out, "\n"); - if (count < 0) { - break; - } - if (size < count) { - fprintf(out, - "Disassembler disagrees with translator over instruction " - "decoding\n" - "Please report this to qemu-devel@nongnu.org\n"); - break; - } - } -} - -int disas_gstring_printf(FILE *stream, const char *fmt, ...) -{ - /* We abuse the FILE parameter to pass a GString. */ - GString *s = (GString *)stream; - int initial_len = s->len; - va_list va; - - va_start(va, fmt); - g_string_append_vprintf(s, fmt, va); - va_end(va); - - return s->len - initial_len; -} - -static void plugin_print_address(bfd_vma addr, struct disassemble_info *info) -{ - /* does nothing */ -} - - -/* - * We should only be dissembling one instruction at a time here. If - * there is left over it usually indicates the front end has read more - * bytes than it needed. - */ -char *plugin_disas(CPUState *cpu, uint64_t addr, size_t size) -{ - CPUDebug s; - GString *ds = g_string_new(NULL); - - disas_initialize_debug_target(&s, cpu); - s.info.fprintf_func = disas_gstring_printf; - s.info.stream = (FILE *)ds; /* abuse this slot */ - s.info.buffer_vma = addr; - s.info.buffer_length = size; - s.info.print_address_func = plugin_print_address; - - if (s.info.cap_arch >= 0 && cap_disas_plugin(&s.info, addr, size)) { - ; /* done */ - } else if (s.info.print_insn) { - s.info.print_insn(addr, &s.info); - } else { - ; /* cannot disassemble -- return empty string */ - } - - /* Return the buffer, freeing the GString container. */ - return g_string_free(ds, false); -} - -/* Disassemble this for me please... (debugging). */ -void disas(FILE *out, const void *code, size_t size) -{ - uintptr_t pc; - int count; - CPUDebug s; - - initialize_debug_host(&s); - s.info.fprintf_func = fprintf; - s.info.stream = out; - s.info.buffer = code; - s.info.buffer_vma = (uintptr_t)code; - s.info.buffer_length = size; - s.info.show_opcodes = true; - - if (s.info.cap_arch >= 0 && cap_disas_host(&s.info, code, size)) { - return; - } - - if (s.info.print_insn == NULL) { - s.info.print_insn = print_insn_od_host; - } - for (pc = (uintptr_t)code; size > 0; pc += count, size -= count) { - fprintf(out, "0x%08" PRIxPTR ": ", pc); - count = s.info.print_insn(pc, &s.info); - fprintf(out, "\n"); - if (count < 0) { - break; - } - } - -} - -/* Look up symbol for debugging purpose. Returns "" if unknown. */ -const char *lookup_symbol(uint64_t orig_addr) -{ - const char *symbol = ""; - struct syminfo *s; - - for (s = syminfos; s; s = s->next) { - symbol = s->lookup_symbol(s, orig_addr); - if (symbol[0] != '\0') { - break; - } - } - - return symbol; -} diff --git a/disas/objdump.c b/disas/objdump.c new file mode 100644 index 0000000000..9859f23419 --- /dev/null +++ b/disas/objdump.c @@ -0,0 +1,37 @@ +/* + * Dump disassembly as text, for processing by scripts/disas-objdump.pl. + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "disas-internal.h" + + +static int print_insn_objdump(bfd_vma pc, disassemble_info *info, + const char *prefix) +{ + int i, n = info->buffer_length; + g_autofree uint8_t *buf = g_malloc(n); + + if (info->read_memory_func(pc, buf, n, info) == 0) { + for (i = 0; i < n; ++i) { + if (i % 32 == 0) { + info->fprintf_func(info->stream, "\n%s: ", prefix); + } + info->fprintf_func(info->stream, "%02x", buf[i]); + } + } else { + info->fprintf_func(info->stream, "unable to read memory"); + } + return n; +} + +int print_insn_od_host(bfd_vma pc, disassemble_info *info) +{ + return print_insn_objdump(pc, info, "OBJD-H"); +} + +int print_insn_od_target(bfd_vma pc, disassemble_info *info) +{ + return print_insn_objdump(pc, info, "OBJD-T"); +} diff --git a/disas/meson.build b/disas/meson.build index 5c8073beb3..20d6aef9a7 100644 --- a/disas/meson.build +++ b/disas/meson.build @@ -14,7 +14,11 @@ common_ss.add(when: 'CONFIG_SH4_DIS', if_true: files('sh4.c')) common_ss.add(when: 'CONFIG_SPARC_DIS', if_true: files('sparc.c')) common_ss.add(when: 'CONFIG_XTENSA_DIS', if_true: files('xtensa.c')) common_ss.add(when: capstone, if_true: [files('capstone.c'), capstone]) -common_ss.add(files('disas.c')) - +common_ss.add(when: 'CONFIG_TCG', if_true: files( + 'disas-host.c', + 'disas-target.c', + 'objdump.c' +)) +common_ss.add(files('disas-common.c')) system_ss.add(files('disas-mon.c')) specific_ss.add(capstone) From patchwork Wed May 15 07:52:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796898 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp2855475wra; Wed, 15 May 2024 01:00:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVQ7xZn2XPfHj5YiuvMh8fhpwmO0HEkPI3FhoAazo2wbb8iHFJRteAPcenAoXAeRhQO/6GTxU1e5KVd4ds0/UNj X-Google-Smtp-Source: AGHT+IGxcFmYnuozGvm20K2pf6XqT3JdrwBH4L1ozvU69kum6gJIZyHLpriSNAsuFIV2vhW4Gb2N X-Received: by 2002:a05:620a:1464:b0:792:be7c:36e4 with SMTP id af79cd13be357-792c76104afmr1530235185a.71.1715760015740; Wed, 15 May 2024 01:00:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715760015; cv=none; d=google.com; s=arc-20160816; b=W60w+eQupxRNzge1ZUN3qnJrr6QVa1GmmYQmQM8EQ8b9bWrQj6GkFg+U50349+Z9cB +a1MK+pVLLHxIPPuM8tbgNpO74zFv/n70iYUZAc0vt90f5qyKxHKvdmOhWqvX5KTBgxN x5bqjcYDj7ROmzBiNLAQoItuV2wC79ZyxW12s4JpMpI5bpT4JONkz+kDkk5Vjd3NKObv x3qtXBdMbXmOUjEsBKQ3CSL/I4yT8xv6aKD9EXlZQT1AwNIsRnTdvQYJscuk1afjwBVR p9Uq6BBa3/85/B7TCI1RLQk1a16rTMGXvKifvtAKqSckOA/9usbAn6Jj8aHfRXcMBJUv Dk/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=W3reNa+vlMnQNIk6cvUIcWGKHdlW1nVEiDXshCrKVtM=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=RNChOGbigDdzr0ZDF6DsTgylIYUaBOnLAFNcxieYXMxd7WH0NfuCQf9cQmcOjGw27v 4LXgU08G3yBrehr9s10Z+AY7ExjnIvi46RZzhKS/Y1nzz8yjLJPDrzU1j2hFJiGTQfgk RIlfLSm/EIkt8zYjgYc3xMK+Yol9zHr1qCAiMC8T3VTzP6RE5mAo3527YtQOTjA+LpGE Pw4jdQdnAaTjcKEuBmZyoDMJ0xrKo0SmJ8ui1Tm1M2el1ZSthOMir/G9/9QI9QW0OQI3 FFtxpi4HBTBEHy9P619MQzZYniJXerg29BPevbkTkWUL/g+6IbJMTnjDt7X4dZvTmC7B Zh4w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tZ9UboHw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-792bf30b2casi1453765885a.244.2024.05.15.01.00.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 01:00:15 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tZ9UboHw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Read from already translated pages, or saved mmio data. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- include/disas/disas.h | 5 +++-- include/exec/translator.h | 4 ++-- include/qemu/typedefs.h | 1 + accel/tcg/translator.c | 2 +- disas/disas-common.c | 14 -------------- disas/disas-mon.c | 15 +++++++++++++++ disas/disas-target.c | 19 +++++++++++++++++-- plugins/api.c | 4 ++-- 8 files changed, 41 insertions(+), 23 deletions(-) diff --git a/include/disas/disas.h b/include/disas/disas.h index 54a5e68443..c702b1effc 100644 --- a/include/disas/disas.h +++ b/include/disas/disas.h @@ -4,14 +4,15 @@ /* Disassemble this for me please... (debugging). */ #ifdef CONFIG_TCG void disas(FILE *out, const void *code, size_t size); -void target_disas(FILE *out, CPUState *cpu, uint64_t code, size_t size); +void target_disas(FILE *out, CPUState *cpu, const DisasContextBase *db); #endif void monitor_disas(Monitor *mon, CPUState *cpu, uint64_t pc, int nb_insn, bool is_physical); #ifdef CONFIG_PLUGIN -char *plugin_disas(CPUState *cpu, uint64_t addr, size_t size); +char *plugin_disas(CPUState *cpu, const DisasContextBase *db, + uint64_t addr, size_t size); #endif /* Look up symbol for debugging purpose. Returns "" if unknown. */ diff --git a/include/exec/translator.h b/include/exec/translator.h index 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; +}; /** * 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 *tb, int *max_insns, if (!ops->disas_log || !ops->disas_log(db, cpu, logfile)) { fprintf(logfile, "IN: %s\n", lookup_symbol(db->pc_first)); - target_disas(logfile, cpu, db->pc_first, db->tb->size); + target_disas(logfile, cpu, db); } fprintf(logfile, "\n"); qemu_log_unlock(logfile); diff --git a/disas/disas-common.c b/disas/disas-common.c index 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" /* Filled in by elfload.c. Simplistic, but will do for now. */ struct syminfo *syminfos = NULL; -/* - * Get LENGTH bytes from info's buffer, at target address memaddr. - * Transfer them to myaddr. - */ -static int target_read_memory(bfd_vma memaddr, bfd_byte *myaddr, int length, - struct disassemble_info *info) -{ - CPUDebug *s = container_of(info, CPUDebug, info); - int r = cpu_memory_rw_debug(s->cpu, memaddr, myaddr, length, 0); - return r ? EIO : 0; -} - /* * Print an error message. We can assume that this is in response to * an error return from {host,target}_read_memory. @@ -73,7 +60,6 @@ void disas_initialize_debug_target(CPUDebug *s, CPUState *cpu) disas_initialize_debug(s); s->cpu = cpu; - s->info.read_memory_func = target_read_memory; s->info.print_address_func = print_address; if (target_words_bigendian()) { s->info.endian = BFD_ENDIAN_BIG; diff --git a/disas/disas-mon.c b/disas/disas-mon.c index 5d6d9aa02d..37bf16ac79 100644 --- a/disas/disas-mon.c +++ b/disas/disas-mon.c @@ -11,6 +11,19 @@ #include "hw/core/cpu.h" #include "monitor/monitor.h" +/* + * Get LENGTH bytes from info's buffer, at target address memaddr. + * Transfer them to myaddr. + */ +static int +virtual_read_memory(bfd_vma memaddr, bfd_byte *myaddr, int length, + struct disassemble_info *info) +{ + CPUDebug *s = container_of(info, CPUDebug, info); + int r = cpu_memory_rw_debug(s->cpu, memaddr, myaddr, length, 0); + return r ? EIO : 0; +} + static int physical_read_memory(bfd_vma memaddr, bfd_byte *myaddr, int length, struct disassemble_info *info) @@ -38,6 +51,8 @@ void monitor_disas(Monitor *mon, CPUState *cpu, uint64_t pc, if (is_physical) { s.info.read_memory_func = physical_read_memory; + } else { + s.info.read_memory_func = virtual_read_memory; } s.info.buffer_vma = pc; diff --git a/disas/disas-target.c b/disas/disas-target.c index 82313b2a67..48f3a365dc 100644 --- a/disas/disas-target.c +++ b/disas/disas-target.c @@ -6,16 +6,28 @@ #include "qemu/osdep.h" #include "disas/disas.h" #include "disas/capstone.h" +#include "exec/translator.h" #include "disas-internal.h" -void target_disas(FILE *out, CPUState *cpu, uint64_t code, size_t size) +static int translator_read_memory(bfd_vma memaddr, bfd_byte *myaddr, + int length, struct disassemble_info *info) { + const DisasContextBase *db = info->application_data; + return translator_st(db, myaddr, memaddr, length) ? 0 : EIO; +} + +void target_disas(FILE *out, CPUState *cpu, const struct DisasContextBase *db) +{ + uint64_t code = db->pc_first; + size_t size = translator_st_len(db); uint64_t pc; int count; CPUDebug s; disas_initialize_debug_target(&s, cpu); + s.info.read_memory_func = translator_read_memory; + s.info.application_data = (void *)db; s.info.fprintf_func = fprintf; s.info.stream = out; s.info.buffer_vma = code; @@ -58,12 +70,15 @@ static void plugin_print_address(bfd_vma addr, struct disassemble_info *info) * there is left over it usually indicates the front end has read more * bytes than it needed. */ -char *plugin_disas(CPUState *cpu, uint64_t addr, size_t size) +char *plugin_disas(CPUState *cpu, const DisasContextBase *db, + uint64_t addr, size_t size) { CPUDebug s; GString *ds = g_string_new(NULL); disas_initialize_debug_target(&s, cpu); + s.info.read_memory_func = translator_read_memory; + s.info.application_data = (void *)db; s.info.fprintf_func = disas_gstring_printf; s.info.stream = (FILE *)ds; /* abuse this slot */ s.info.buffer_vma = addr; diff --git a/plugins/api.c b/plugins/api.c index 02014d4c6e..b04c5e1928 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -271,8 +271,8 @@ void *qemu_plugin_insn_haddr(const struct qemu_plugin_insn *insn) char *qemu_plugin_insn_disas(const struct qemu_plugin_insn *insn) { - CPUState *cpu = current_cpu; - return plugin_disas(cpu, insn->vaddr, insn->len); + return plugin_disas(tcg_ctx->cpu, tcg_ctx->plugin_db, + insn->vaddr, insn->len); } const char *qemu_plugin_insn_symbol(const struct qemu_plugin_insn *insn) From patchwork Wed May 15 07:52:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796907 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp2856889wra; Wed, 15 May 2024 01:03:26 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVYRdq0KgKDyB/+Ek53Xn1QZ7R9jrLIxiRMxFDy7vEKU6kDT6kgWYOh/hJGO5Ahks/Y6AJcp2ppqsKOVZsyetDS X-Google-Smtp-Source: AGHT+IGaTcHtFYmfxyQ0EETTL2/PJPovWbe9p/j7s0mkV631gR94kItLFASY34+XveChff93dJBf X-Received: by 2002:a81:b2c3:0:b0:617:cb98:f9b2 with SMTP id 00721157ae682-622b016aa53mr134955987b3.43.1715760206513; Wed, 15 May 2024 01:03:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715760206; cv=none; d=google.com; s=arc-20160816; b=K1w1HhYJMf5OhSwf/JUPZYg0UfCvHl34VryMXMOeL4j52FmH09uAS2WbvM1w0zfHYZ EBKW1Ria4/sYTIS4PiIt0u/J2nisexi8HHbKvoIzq8Lq7o80bYukBi39bPmj2Fxzgusi xSI4c3ymmnveXTrnKbSJktLetLFOScwecxECCLP/FFATshvgN7EfdtKcEufzvaQ5tI2c uojUl2iwOZiMbJEhZ3dkbczGLsG7fUY1cq5YUYDLqtw5QLaunpl1IwYqDIGNfl6mYcoy JTvqROoBbcwzuoC9gPstk7u0IasIWzzzuunuzJspDvg+Vhv2T8PNYCqRx8TdOZ4tcHYs BLSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1nWXlcFf/ukN+q7QhzDqXIa8CiZT41OLDlcvMAkUxKU=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=FtNZDQOCPtaUhLOr8hNfSCdnhlCTss9elRm3t4KtIUJmFUEd2NOGAsIAxiFtxoakUP KUrq3cBp/frjB3IKm1FmMB8x4szbG2aTCuFwJG26GyMYXsMKbGfSkPVtnogaRrInM5Ia pEamZYQNyzAiK9wUUMYlt1JTIFWzaPAWMDyEd5o+dSufclRyxZM/qmluYugpFpaJFX5G Hhb38t0RdzLfqWbj1FnBgMgXDAchTAP1nN6l6y4Pcko9rX/+8r0h7Zh1psy4bNJp4n6O UiWDKq2skbCiKRck7u/r0L2XMJHVCLpA31mCvvQfE9yzDcsOeIeQMphNP3a+S0RJVW/z e8DA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Owl7Idi+; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-43df56ddc2dsi133427241cf.746.2024.05.15.01.03.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 01:03:26 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Owl7Idi+; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Replace translator_fake_ldb, which required multiple calls, with translator_fake_ld, which can take all data at once. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- include/exec/translator.h | 8 ++++---- accel/tcg/translator.c | 5 ++--- target/s390x/tcg/translate.c | 8 ++++---- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/include/exec/translator.h b/include/exec/translator.h index 411ce2b47e..25004dfb76 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -234,17 +234,17 @@ translator_ldq_swap(CPUArchState *env, DisasContextBase *db, } /** - * translator_fake_ldb - fake instruction load + * translator_fake_ld - fake instruction load * @db: Disassembly context - * @pc: program counter of instruction - * @insn8: byte of instruction + * @data: bytes of instruction + * @len: number of bytes * * This is a special case helper used where the instruction we are * about to translate comes from somewhere else (e.g. being * re-synthesised for s390x "ex"). It ensures we update other areas of * the translator with details of the executed instruction. */ -void translator_fake_ldb(DisasContextBase *db, vaddr pc, uint8_t insn8); +void translator_fake_ld(DisasContextBase *db, const void *data, size_t len); /** * translator_st diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 00322c6fd9..c56967eecd 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -468,9 +468,8 @@ uint64_t translator_ldq(CPUArchState *env, DisasContextBase *db, vaddr pc) return tgt; } -void translator_fake_ldb(DisasContextBase *db, vaddr pc, uint8_t insn8) +void translator_fake_ld(DisasContextBase *db, const void *data, size_t len) { - assert(pc >= db->pc_first); db->fake_insn = true; - record_save(db, pc, &insn8, sizeof(insn8)); + record_save(db, db->pc_first, data, len); } diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index d74939389a..2eb787e401 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -6191,6 +6191,8 @@ static const DisasInsn *extract_insn(CPUS390XState *env, DisasContext *s) const DisasInsn *info; if (unlikely(s->ex_value)) { + uint64_t be_insn; + /* Drop the EX data now, so that it's clear on exception paths. */ tcg_gen_st_i64(tcg_constant_i64(0), tcg_env, offsetof(CPUS390XState, ex_value)); @@ -6200,10 +6202,8 @@ static const DisasInsn *extract_insn(CPUS390XState *env, DisasContext *s) ilen = s->ex_value & 0xf; /* Register insn bytes with translator so plugins work. */ - for (int i = 0; i < ilen; i++) { - uint8_t byte = extract64(insn, 56 - (i * 8), 8); - translator_fake_ldb(&s->base, pc + i, byte); - } + be_insn = cpu_to_be64(insn); + translator_fake_ld(&s->base, &be_insn, ilen); op = insn >> 56; } else { insn = ld_code2(env, s, pc); From patchwork Wed May 15 07:52:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796899 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp2855498wra; Wed, 15 May 2024 01:00:17 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX8jtGRiShIxwsuKmzxiIlZHDw+FM6jW4veSWT6klerwcPMQfmAg4c/zUDenFDtOUK5OruqNgFh9zolabEtIdH7 X-Google-Smtp-Source: AGHT+IEiS85wF4dErsmO77PRRJdQ00Dla87X+dhk5e6nEfKeXwBVuMQbl5bpZMxgGDp8EyzYDv9q X-Received: by 2002:a05:6102:3c9e:b0:47c:18df:9f3d with SMTP id ada2fe7eead31-48077ebbe06mr17564728137.34.1715760017330; Wed, 15 May 2024 01:00:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715760017; cv=none; d=google.com; s=arc-20160816; b=dVqULJr4PPMlR/rtOeWlJO+ReSh1ArluOIkmMszA8kaZM8kbDgF+CgAzGqSRdugeMf M/xETdWaJYegMfM5ih1E5pO1j5VHeoR6mKf/BpcF50kYP4EjtnoDVshjyJZm/zOe/PDR M4BUrq2Mmu8KExBi6j3pjS5bN2IT5AtStjkYfs0PRbjHh8hQPNjN4Sng8fve/5EPOdjh oxj14Y2IPw/ngFCedyJom1JYZXlzxK+XpTwe0b8PJdEWZml72DweupD/O1BOHyGshnmP p+n2ElfpEq4N6ZxNaEscNcSX/LAt9wonWMTxaaYmxc1dfUqHqsJ9CsBQt+VnggmotYq9 w4aA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zosCwfAqzS9tNL9GWtQRdlVeW1LGv2S9SgE5WNHpqQg=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=U3KAVZk/f/NIze9rqC+LlZTSFYNLdSzfs0zK+qErZrqLnBSX4eec/ryxuddgWQxJUP 6pRCO2G+5BItwt5rFfEtzGwV1KOmuB037DC88hm7baeSIebTMwtcY5anPywT9Z3ZRhIM WqoIrCCqeHdkzX9Vx2iSnBxqZF8J6NoBw3dN9MdWsmK1QSqUihXGVyoS8Si0OIbztcUb hE/lQtY3w+a9I3wRvIUmmNEVlfbECTOa5j0KGeXZx+V3z71N2Um03ZHuTUtLwJ4lTKXk +kPg5D0COCDgnsVyU2ekaiFZhLhzAEVu+TpzpfTQFgvGxNuVLbPbTMLvj4Qg7otyh63Z 7uCQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=I10h4Ewd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-43df54a1b6bsi134609001cf.79.2024.05.15.01.00.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 01:00:17 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=I10h4Ewd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The ilen value extracted from ex_value is the length of the EXECUTE instruction itself, and so is the increment to the pc. However, the length of the synthetic insn is located in the opcode like all other instructions. Reviewed-by: Philippe Mathieu-Daudé 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 = s->ex_value & 0xffffffffffff0000ull; ilen = s->ex_value & 0xf; + op = insn >> 56; /* Register insn bytes with translator so plugins work. */ be_insn = cpu_to_be64(insn); - translator_fake_ld(&s->base, &be_insn, ilen); - op = insn >> 56; + translator_fake_ld(&s->base, &be_insn, get_ilen(op)); } else { insn = ld_code2(env, s, pc); op = (insn >> 8) & 0xff; From patchwork Wed May 15 07:52:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796882 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp2853927wra; Wed, 15 May 2024 00:54:55 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVdhcttRbMauuU9nwtc8KqbgsHCJLGEpt1xM62LwERUv7NvIgqnoEnWkxSN70QTKBrnVm5WwPTi60kTFE70ado3 X-Google-Smtp-Source: AGHT+IElT6roKCarHFGHzFzJDTXzCuJqM5xFxTDw8bMVyG5RlYpSvZxAKJCTTyV7R3YyTQStpDNg X-Received: by 2002:a05:6214:5789:b0:6a0:b905:97b0 with SMTP id 6a1803df08f44-6a16820d12fmr192976436d6.39.1715759694971; Wed, 15 May 2024 00:54:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715759694; cv=none; d=google.com; s=arc-20160816; b=DH3Ke6Z8c61WANmnbJ/FxQFF9xWdiaFpHDLufwI/UUdFT0SCJwnKedpSkaqvFKTydc xwAp5H6m5LJ8/xIfwmojv2PUd5UICKE5Fpt8O7v2Mak8/UvtwbyTjxsJlNCOTGP7PPLE 7EP017SHEaxUEgMdzYwHq53VHkZh3qIp5e4S9PEBArl0ASHfmp4nV9M3vJNaeGAQoHjF X9lIEe66/Wmia+udeQbPBF8m108qCzw1GP1vK4BLhP4tJsDOXU2KgJ0eNL0wPhUAU0As 0UOEZ7ugtELfJbntYiIrXI7GsVkjRIfRunEKaADkxYNF9aPBFnJ/6XNvwnG74539p6Kx esxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=43VCEYELAxrkckI6OKg065TP0NGfyWvRiJUBmPu7X2I=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=qIQqtdJwRmBFPXe2PNQDj2922rLoz+eg4zM66LtlFyMW0E6saG8kyVOjM4Xl5JWurC Jc/SxyAjTMcKwVNu6k8wm/uEI0max3UJrsdsbtvLvShtzTgIJR7D3kNfXXpuONKDqVW1 d7MkpZFgbI2j5ObKdfpO3o123LGBxsWJ8CRvLdSBshTon4nTCJyJZCQFU1X94GF9riLj NRFm8znDY71bM9o1iFaYmsOmffYm/pMf3JUgEjUTeLqdcfdKv8iFh+TzL2s2NihtLcB6 +zlFhIwrbIiHVaWVhPIC92pOS4mRa6Opgzv2hnWMabzUokf8XaDDHCf+hVQg9rnsDHm0 O7lQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CfItn7JY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6a15f29aa04si133986706d6.233.2024.05.15.00.54.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 00:54:54 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CfItn7JY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/s390x/tcg/translate.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index 95d4d6ebc3..bac033c63c 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -6525,8 +6525,9 @@ static bool s390x_tr_disas_log(const DisasContextBase *dcbase, DisasContext *dc = container_of(dcbase, DisasContext, base); if (unlikely(dc->ex_value)) { - /* ??? Unfortunately target_disas can't use host memory. */ - fprintf(logfile, "IN: EXECUTE %016" PRIx64, dc->ex_value); + /* The ex_value has been recorded with translator_fake_ld. */ + fprintf(logfile, "IN: EXECUTE\n"); + target_disas(logfile, cs, &dc->base); return true; } return false; From patchwork Wed May 15 07:52:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796905 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp2856617wra; Wed, 15 May 2024 01:02:45 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV4oZqWwbuJqnFzVduNHGjCJmg6LznWZ7proiCRxXp6VP3uj3XcCIknxHBJXfVW2LBnOl9rqFBLzg8+Jfhgxi+y X-Google-Smtp-Source: AGHT+IFTIbvN4OrpKp9RZJsvGW6DdletGVSNHQvmumdIS74W6aJPY1OByfZqYDSNOy3o1XKtEo5l X-Received: by 2002:a05:6808:2ca:b0:3c9:7f1e:76dc with SMTP id 5614622812f47-3c9970dbfdcmr15464738b6e.59.1715760165128; Wed, 15 May 2024 01:02:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715760165; cv=none; d=google.com; s=arc-20160816; b=hjk1S+b29P/e5c3L28+Ag8OyBgIkyzZBd2XouaO3VPDtiB2dzblZe2FjOiE0losBu8 cPz8JJmzs7eC+IQd/Ntk9jUBM5Im+6Sb1i7dz0YE0tDcpoLszN4zlqoUHcda9qSrmOS3 qqmCUarbjHbUJtYO6yCifqS+W8een5nj+Y96UNvZXrthKUJ7XF1t2GMUVBL4PARwiYFN fHF3LHRqcNjUYjx/krhwbGFm6rI43I/iiH49DQtsHqFq8QIq9g37eSIrexuyvytbH/uh iwB9iIzJ+4Gne1Jhxf5yocP6sfb3su7I//aAr+pwPCGwXoVA5BGkxtjZGQlFhR7WNhHV oWLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JIimXBciSNwwzH7l+M6cptiwOdaQNdn1djFTj7g5Tr8=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=DxBGUs+nhKDqJT5Mjg6ZO6LGHuwBDVMGx5wwWxKpxoHpJdgCe8p0t/rzKZOxxwx+Nj F6nWN1SxSRMFbLk/ih5JEnmgMIAXiCPo5a7Kl9uPzKoJdo7HeQRnHkLh/Eyx3F3VdtbY akWALBkh/6LTaIFzQHWReB4HES9IOBDvZ4JwdV7y1NzyOhgAzX6Vi2dGTjB1YuvAR5il WCaVwpQ5YniypEBnwTURcP2DURpFIl5/91A5w8A3tJhx3+g9mR+DIVc59WNgKzZJGTLo jLN2f43bYNsQJhA1jCZWcaJm85BcOvboatm9GaH1eK6LdIOaujJktjvEMZBy/1Fa/LLS c/bQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i7l63MY8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-43df56b318esi139656311cf.579.2024.05.15.01.02.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 01:02:45 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i7l63MY8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/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, DisasContext *ctx) int nwords; for (nwords = 0; !found_end && nwords < PACKET_WORDS_MAX; nwords++) { - uint32_t word = cpu_ldl_code(env, + uint32_t word = translator_ldl(env, &ctx->base, ctx->base.pc_next + nwords * sizeof(uint32_t)); found_end = is_packet_end(word); } From patchwork Wed May 15 07:52:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796877 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp2853667wra; Wed, 15 May 2024 00:54:05 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX1iIxZEtB3GWKavpaaQ6k48sxUu1ixqa107VpWGjRv6b6yLVlnu/qAgld86weCfmkmzfx9p6hCF7oFXSB3lSKx X-Google-Smtp-Source: AGHT+IFgKGBap6QiT+bv3p01Mk1dZKtGhtHypPY2tZ6Jke9poVcYifbhQF6rZSsNdF9tIkTBx8xG X-Received: by 2002:a25:2e0b:0:b0:dcf:3ef5:4d30 with SMTP id 3f1490d57ef6-dee4f2c71dfmr13741913276.17.1715759644763; Wed, 15 May 2024 00:54:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715759644; cv=none; d=google.com; s=arc-20160816; b=aiqWWRVry3fp9qEiKt2d4jX6tP7skiKHP9no2GqQawfku8nvwf19mhsBIkHf+70x8F uHCHllSs0AlniOZTPll08zH09Wvxest9L8HZ8GMEITMu00YSSXomWpfQ5NGfUdTlnXd/ 6Yt0poOpc6Oc35YvVoVDyOqo24hGB9AZuHb6WoRvCyxn9rhVrg0XzeV3q7c/oz1krCas xSdPvgv2RTrtNvTt5r+TA0YR2EPIFiMW310QrZ50ecpLe9Zi4quliMiKdavG/39pKLff q91FuiBDDPTVsZUjw3E5U4wkmqOus6xUq72hoctZZyv7Riw5F7gNcolJE72i1QliiI0M lV9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Buz2rJGX38jbC3oBTd0wt7g7ce1h+CXiegaHhEfcdIs=; fh=yIXiVAD5FpZIeFc+c4tpRY/5DBPhgcMqmQf6hSviIlk=; b=yRGzPeoWBULFI5iQvq7oMEl6k/kpqwHC7LGZYdp/Lcj0U43PKQoYETpB2OomB1kYzG EVPHpdgBRfMQbBX2zW78oAVHKprl7quSHluPPwGleVi4RkbCPQliaRoBsL524FhEOeo+ Qzz//5CIPVoiGbObRwOe20a0JYGFW71wbXzCCiJP3Gu/kiDlGNA1mP0pA7oLyUyvfcAY fq138EkypA26ZVINITVEVsSBMnOZo0Gki13Q0hZ7ip9ZYlGp+USdISWVE64Ahyd1InS1 lxl21VGqDb0pTv8WYBWyyr9hBx8rfB+sJHCLkE7K4VJgtHcPZ7o54QWmVX5oHl3jSAY6 wEfQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fi+UYFtR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-792bf297280si1335688785a.170.2024.05.15.00.54.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 00:54:04 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fi+UYFtR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: "Edgar E . Iglesias" , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Reviewed-by: Edgar E. Iglesias Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/microblaze/translate.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index 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" @@ -1637,7 +1636,7 @@ static void mb_tr_translate_insn(DisasContextBase *dcb, CPUState *cs) dc->tb_flags_to_set = 0; - ir = cpu_ldl_code(cpu_env(cs), dc->base.pc_next); + ir = translator_ldl(cpu_env(cs), &dc->base, dc->base.pc_next); if (!decode(dc, ir)) { trap_illegal(dc, true); } From patchwork Wed May 15 07:52:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796902 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp2855549wra; Wed, 15 May 2024 01:00:24 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV6dzZfO9YusTHt56koPJoh7eOw4JhXF/GeiTNzLpdVS9p45EYacz1Umov9LbYTeIITDXLmR22+ai9YhtssS4Hw X-Google-Smtp-Source: AGHT+IH4iqOI6fHcyOX6GgvS4N6oFgwj5Ok5tXr/uapZlAGA6R3E3NxRQqXurMTSb6RgI8Dv1IhO X-Received: by 2002:a05:6122:310a:b0:4d4:2398:51a2 with SMTP id 71dfb90a1353d-4df882ca873mr12326679e0c.8.1715760024185; Wed, 15 May 2024 01:00:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715760024; cv=none; d=google.com; s=arc-20160816; b=gleFWndG9pyqexsRBkafIj0iPqbwD0SnTEkbgUJTJKkXCjRptyjst93aLTg8o1Ly9/ 4d0lxRnXA7NKKtkeA5FwY0pfw4Oye0OldX+sJB3WXRB8X5mNM14VEN9efNVbOe03Umrt coLMHvJRciK5A1hGsqKJ7gWKTPkVFZvE04KWCb7mvlmZwvcP239kqHtdMjl7C9o+sX66 Z6GUGQ7ivpAR5HsA7QvLNN3Mson35r4kcy04Z2IdggF+PHrNXnq3th20IBHIcKNKv+G6 erdT2MQ2aBWmggbVwO3TFyJnlrssKrXEY5awJiv6O8W6ubKofYge5a10uxtTg0AGNPMr QrFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=w1Iksx0xg6rkS7/ro1+ykm+RdeutCXftoxj1EQCWqvE=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=YsKstCEMCHfDMet0sjiOzqpUcxEHrSzV9+qtXnCcEKD+7afGS59brkLCWDQMFQqo6C BosgaAUg8+KcLW/INexhcdgr1FXifAPT5rtRiqgxnSOGEHanv1cLr/Jm9SOOAKqy9MOc ykrRPkr57rPoz2UZyQLvweUqhaVfTngFM0GY6jtf46i1z/qWA/kowijiLPKru/Y3U0M8 rPmvp8UiArIjT8iD+QrS7PnZrflhsAF5TlZtNTag1sdge26g0d46faMw7FjsnZhBXq93 JD79V62KnsJCB7AqT4iwof3hnExHBnQs9qsntv9IQoz/FTAl2X3kIuDUYCCXsp0MkjlM wDiQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AcTCks7Z; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 71dfb90a1353d-4df98d59037si1322054e0c.88.2024.05.15.01.00.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 01:00:23 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AcTCks7Z; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/i386/tcg/translate.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 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" @@ -1579,9 +1578,8 @@ static uint64_t advance_pc(CPUX86State *env, DisasContext *s, int num_bytes) * This can happen even if the operand is only one byte long! */ if (((s->pc - 1) ^ (pc - 1)) & TARGET_PAGE_MASK) { - volatile uint8_t unused = - cpu_ldub_code(env, (s->pc - 1) & TARGET_PAGE_MASK); - (void) unused; + (void)translator_ldub(env, &s->base, + (s->pc - 1) & TARGET_PAGE_MASK); } siglongjmp(s->jmpbuf, 1); } @@ -2177,7 +2175,7 @@ static void gen_unknown_opcode(CPUX86State *env, DisasContext *s) fprintf(logfile, "ILLOPC: " TARGET_FMT_lx ":", pc); for (; pc < end; ++pc) { - fprintf(logfile, " %02x", cpu_ldub_code(env, pc)); + fprintf(logfile, " %02x", translator_ldub(env, &s->base, pc)); } fprintf(logfile, "\n"); qemu_log_unlock(logfile); From patchwork Wed May 15 07:52:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796903 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp2855740wra; Wed, 15 May 2024 01:00:47 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVOwAaEUlqhX4rbGjO26NqGELb0nifo6s8KyuulxBpoww09Hijs48GvOsTcuTSAs8I8KolzwvNOzgb7wRykRJvQ X-Google-Smtp-Source: AGHT+IH67ifEe1BDQDAUrl184Ged34uh+KbEKfeDF8no4At3C1GTjinszODoL5Y57io8sqSPe80O X-Received: by 2002:a05:620a:72a5:b0:78d:6649:4c79 with SMTP id af79cd13be357-792c75fd87dmr1605684485a.70.1715760047031; Wed, 15 May 2024 01:00:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715760047; cv=none; d=google.com; s=arc-20160816; b=ZK6qJ5ezbsg83uHMKlJQ8Extgb0iBZlal8vPdIBze/sj1hNBSF35xDTt40ZeTqe5MN ojxqAFGyn1GAwRSFXZqrp6h25bKY7S+9lSkywUnb9OcyW01zEoXooet7TAgKi+XlYls/ 9jx3dzcwWhRD9qc2tj5069qvR22PCp5ITRbRnZuZMEMmXCil4f4V2LQvZfrFQEokLXTM gsug3QkIq+jhkg/e5BRtdcEZKPhbBG210K+/gyWvLzdpP7DsEMHo8/yGWAlU1oSgJIYh vpEOceFDC/mQIvVVGlkxlLBrj08IKN0PoN362Max59LdeZ0onZn7XYgytwSNVc1HzmNp Ucog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Ku4i14FBhF0AsxG1wJUIaWCeb9p5uUrtgrDPrlUkN+c=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=N3DC11ChuZyyI00etv3u3MixVw4GykCePl2Sy6nw14XkSZL8UAdHwIguIVPwhAjpkF LGkBnoGGXsyHi2Cxy4abmwTS1+NER4lHTz5XwLMSoA3CHaWMz1Ugx9b9ugU6KWizrFUv FHbD9eQhYV9ME45osQbLAMhOhYxfdcIQrXpyLzO22OWuNQiwZfEWlTCtW3FX670N4hjp sU2R4LmAtG0x4GMf+CIRXwuTf4My7pbOYrEUIs7Z6vnrsfxO80kfCKwGRIw1dCKsV0rt EJxqijvxUDY9j2vEziBYmmTfCcn7ovz435SGSIN3JVSjyPd2qIKwNeokafK0maKwXcKj Oo8w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zPnvyqIz; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-792e8fb21f0si436604385a.115.2024.05.15.01.00.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 01:00:47 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zPnvyqIz; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/avr/translate.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/avr/translate.c b/target/avr/translate.c index 6df93d4c77..2d51892115 100644 --- a/target/avr/translate.c +++ b/target/avr/translate.c @@ -24,7 +24,6 @@ #include "cpu.h" #include "exec/exec-all.h" #include "tcg/tcg-op.h" -#include "exec/cpu_ldst.h" #include "exec/helper-proto.h" #include "exec/helper-gen.h" #include "exec/log.h" @@ -173,7 +172,7 @@ static int to_regs_00_30_by_two(DisasContext *ctx, int indx) static uint16_t next_word(DisasContext *ctx) { - return cpu_lduw_code(ctx->env, ctx->npc++ * 2); + return translator_lduw(ctx->env, &ctx->base, ctx->npc++ * 2); } static int append_16(DisasContext *ctx, int x) From patchwork Wed May 15 07:52:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796896 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp2855448wra; Wed, 15 May 2024 01:00:13 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVvW/5BKhqhpex2Ksg8sX4LywsFRdC2+hyDRlLAYcYimmLRys6m2dQUayDWUZo8tlEWRBGXkrakaHOVCuZN3bo8 X-Google-Smtp-Source: AGHT+IGB14GGGlqu4oMnyYRIbLI2WVESrj4pis0dJl8m6TZg7u5OP6rndNyOisLHtiWvVfys1diP X-Received: by 2002:a05:622a:2288:b0:43d:f37a:dbe4 with SMTP id d75a77b69052e-43dfdb0a0ddmr186572621cf.8.1715760013265; Wed, 15 May 2024 01:00:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715760013; cv=none; d=google.com; s=arc-20160816; b=lWRoKGOlwf3mSW03FOwiPVEag1LWIRTU3fL+7BhURPEgLCZtH4CXLdGs8xtivEXHO5 KmSN//VDNJ56ckHCZQT3QK33+HvVZrZkdKjOsPLOnXWDYKO81tIszulBHRytVxXxLb9R mQ7K9JIg6MpsTfC4rtHxViSKA6RLZahhP401XTSl9b/64FLqRuTquwmfdg1RHTbTHBtP ixhqT52EOJs3/ImDEByzWcq16G9gJIf6boE55PDT1ejp3UxqdySj91nH1SVoaUlxE5Nc bfHz4icRZZyvUHh6O+ri6MKOptBOLBJmUBbYGqiKprQkEKl3nod3AXRq00tOWp3eRds3 gFtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LFwVHeO0xdQZE4q/p0sWN9ZrSqg0kbbJP7VPGYxlODk=; fh=yIXiVAD5FpZIeFc+c4tpRY/5DBPhgcMqmQf6hSviIlk=; b=smAKyYCCVB6G4hLqo5WL1IzYFCiO1rIx49dSNGAYxQh5l+PJIz0pThGPyrTwcwvHrc ax8bRbxc4fj+QcDdpQkc5qSoKViLnFSN4xZAcd5Cr5WbOP39PDmhGObM78CfuBJHLMci k6f5U48fBvTOClsaxa+by4nKFaW4z3SpZF+Mczv4PWHZARWvw7Ntub+NL7XkNLXnENhd mV4NUA7EGro1pWanpOXu7oTWSfLuOWqOevOhBYaBg63ABasD1bpynPkJ6b9Ivagd/+j4 RdfVt/V8qWKjHEBAehoh5d+RcUoM3VlcsFtpjwwqX/wHIbPZbF6u9rA3DVI3LUsaust3 32pA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XRQJUHcV; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-43df56ecd5fsi140396301cf.781.2024.05.15.01.00.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 01:00:13 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XRQJUHcV; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: "Edgar E . Iglesias" , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Reviewed-by: Edgar E. Iglesias Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/cris/translate.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/target/cris/translate.c b/target/cris/translate.c index b5410189d4..bb2d6612ba 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -222,37 +222,28 @@ static int sign_extend(unsigned int val, unsigned int width) } static int cris_fetch(CPUCRISState *env, DisasContext *dc, uint32_t addr, - unsigned int size, unsigned int sign) + unsigned int size, bool sign) { int r; switch (size) { case 4: - { - r = cpu_ldl_code(env, addr); + r = translator_ldl(env, &dc->base, addr); break; - } case 2: - { + r = translator_lduw(env, &dc->base, addr); if (sign) { - r = cpu_ldsw_code(env, addr); - } else { - r = cpu_lduw_code(env, addr); + r = (int16_t)r; } break; - } case 1: - { + r = translator_ldub(env, &dc->base, addr); if (sign) { - r = cpu_ldsb_code(env, addr); - } else { - r = cpu_ldub_code(env, addr); + r = (int8_t)r; } break; - } default: - cpu_abort(CPU(dc->cpu), "Invalid fetch size %d\n", size); - break; + g_assert_not_reached(); } return r; } @@ -2868,7 +2859,7 @@ static unsigned int crisv32_decoder(CPUCRISState *env, DisasContext *dc) int i; /* Load a halfword onto the instruction register. */ - dc->ir = cris_fetch(env, dc, dc->pc, 2, 0); + dc->ir = cris_fetch(env, dc, dc->pc, 2, 0); /* Now decode it. */ dc->opcode = EXTRACT_FIELD(dc->ir, 4, 11); From patchwork Wed May 15 07:52:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796883 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp2853988wra; Wed, 15 May 2024 00:55:08 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUeEckv6nAybYRzqZP/4TJXc0/O0+znsbfoBe8YbTDualyxj9gmNBBSgB+cr0zabjAufeec1d50Nvz5kUPSi+WJ X-Google-Smtp-Source: AGHT+IHEI7/9u2+ZrWBazcRr2Jr9KDYg04ecqhebA9dVh/ae81cL/bXw6OUeN4UhxDRVQZesrAhm X-Received: by 2002:a05:620a:7f1:b0:789:ecf2:d777 with SMTP id af79cd13be357-792c7610783mr1428782485a.70.1715759708196; Wed, 15 May 2024 00:55:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715759708; cv=none; d=google.com; s=arc-20160816; b=Dlerp4KisofS7rEfO8w7Go2JvTVoqRifG3KllqaY9dyff0wU4pl5kN++s99Qjk6JHS 6bfkkjPJ10tXwffeH0LP1uOCYL+7BTw0FsrqI6dc0UYsM+Spbk9qophx+QkWAfBC7EST 3lVGSm8Ot6lfhNoX0wwgyUigY0/KEE9TwUbIlN6z/k4ZEL6NweSHHFRU69/ih4ZotpL6 pYS2rl0EO9O03FBxkFG/KQf7zggdbLk+GDF2NHGmux9ImGu8RVWF1KQOZffE0zUehuA3 cFK94XKGhzcTwDCj0ycba1vEy9N7mlvkrWWSXWox988PL/e2YNWpjuNyxhQf9gVzcBuO cokQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eL11UZGpeVEq4VOMmX63mOyK3p1fvPoFDCh9Izq0OCE=; fh=yIXiVAD5FpZIeFc+c4tpRY/5DBPhgcMqmQf6hSviIlk=; b=jaQdqL2tidXFtUoEXsXs5GCf9i6HAJ6HEesmtusQ8MTIFGJJhKgg2U7KT6QSRZh2e6 l6PmhiR99Hil3X2wHntxnB6LA7i52n95zsE81N0nntjJVe7Tj7rLtyw3/qQ/+gXEiagn 0FELYCnrfd7ZYkvbgu3e8WobFNiPOSTDBJoNGeOYKaGtRY5j2+19/BMnW8SQxjz5rMJh NKy9+1nvAutEHxxGTLF9vdxitY9Ot3ISBjE5B1+g7bRQD6GbjgvkrUn7sJ01vGGBS8mh tvycpHg2TLrIeIaDjKkPgmMI8mKvTAlaIvC0sFEuE0opf89xVIJ5kAxhfQePJjYdRbP6 yVHA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YqW1ne0w; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-792bf336b59si1327466385a.439.2024.05.15.00.55.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 00:55:08 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YqW1ne0w; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: "Edgar E . Iglesias" , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Reviewed-by: Edgar E. Iglesias Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/cris/translate.c | 1 - target/cris/translate_v10.c.inc | 30 +++++++++--------------------- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/target/cris/translate.c b/target/cris/translate.c index bb2d6612ba..a30c67eb07 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -29,7 +29,6 @@ #include "tcg/tcg-op.h" #include "exec/helper-proto.h" #include "mmu.h" -#include "exec/cpu_ldst.h" #include "exec/translator.h" #include "crisv32-decode.h" #include "qemu/qemu-print.h" diff --git a/target/cris/translate_v10.c.inc b/target/cris/translate_v10.c.inc index 73fc27c15d..c15ff47505 100644 --- a/target/cris/translate_v10.c.inc +++ b/target/cris/translate_v10.c.inc @@ -165,20 +165,7 @@ static int dec10_prep_move_m(CPUCRISState *env, DisasContext *dc, /* Load [$rs] onto T1. */ if (is_imm) { - if (memsize != 4) { - if (s_ext) { - if (memsize == 1) - imm = cpu_ldsb_code(env, dc->pc + 2); - else - imm = cpu_ldsw_code(env, dc->pc + 2); - } else { - if (memsize == 1) - imm = cpu_ldub_code(env, dc->pc + 2); - else - imm = cpu_lduw_code(env, dc->pc + 2); - } - } else - imm = cpu_ldl_code(env, dc->pc + 2); + imm = cris_fetch(env, dc, dc->pc + 2, memsize, s_ext); tcg_gen_movi_tl(dst, imm); @@ -929,10 +916,11 @@ static int dec10_dip(CPUCRISState *env, DisasContext *dc) LOG_DIS("dip pc=%x opcode=%d r%d r%d\n", dc->pc, dc->opcode, dc->src, dc->dst); if (dc->src == 15) { - imm = cpu_ldl_code(env, dc->pc + 2); + imm = cris_fetch(env, dc, dc->pc + 2, 4, 0); tcg_gen_movi_tl(cpu_PR[PR_PREFIX], imm); - if (dc->postinc) + if (dc->postinc) { insn_len += 4; + } tcg_gen_addi_tl(cpu_R[15], cpu_R[15], insn_len - 2); } else { gen_load(dc, cpu_PR[PR_PREFIX], cpu_R[dc->src], 4, 0); @@ -1095,10 +1083,10 @@ static unsigned int dec10_ind(CPUCRISState *env, DisasContext *dc) if (dc->src == 15) { LOG_DIS("jump.%d %d r%d r%d direct\n", size, dc->opcode, dc->src, dc->dst); - imm = cpu_ldl_code(env, dc->pc + 2); - if (dc->mode == CRISV10_MODE_AUTOINC) + imm = cris_fetch(env, dc, dc->pc + 2, size, 0); + if (dc->mode == CRISV10_MODE_AUTOINC) { insn_len += size; - + } c = tcg_constant_tl(dc->pc + insn_len); t_gen_mov_preg_TN(dc, dc->dst, c); dc->jmp_pc = imm; @@ -1164,7 +1152,7 @@ static unsigned int dec10_ind(CPUCRISState *env, DisasContext *dc) case CRISV10_IND_BCC_M: cris_cc_mask(dc, 0); - simm = cpu_ldsw_code(env, dc->pc + 2); + simm = cris_fetch(env, dc, dc->pc + 2, 2, 1); simm += 4; LOG_DIS("bcc_m: b%s %x\n", cc_name(dc->cond), dc->pc + simm); @@ -1185,7 +1173,7 @@ static unsigned int crisv10_decoder(CPUCRISState *env, DisasContext *dc) unsigned int insn_len = 2; /* Load a halfword onto the instruction register. */ - dc->ir = cpu_lduw_code(env, dc->pc); + dc->ir = cris_fetch(env, dc, dc->pc, 2, 0); /* Now decode it. */ dc->opcode = EXTRACT_FIELD(dc->ir, 6, 9); From patchwork Wed May 15 07:52:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796900 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp2855499wra; Wed, 15 May 2024 01:00:17 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWG9jJYyrl2BXfWNsQOwexBWAKOiQMQZNjy4IBqkJenqmg39QR5GpKcxP3cIioxj0p2fvP3puwlkRToDmE0/DM1 X-Google-Smtp-Source: AGHT+IFGX0uqRaQzQJsKe1Q67onuT9BW9gZ6jfiw8cmdRsIzfngo62H98qQMJnwYgfLdrA+4KgYW X-Received: by 2002:a05:620a:22f:b0:792:bc48:cdab with SMTP id af79cd13be357-792c757701dmr1603572885a.13.1715760017378; Wed, 15 May 2024 01:00:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715760017; cv=none; d=google.com; s=arc-20160816; b=Y7rAwuhXjoti99nbsxqS/DHOgsrF8y4qcamvGQ+QIgvo9DpSAB80OaWU76zPwPCGF9 meomNkuYC077Pf7xf22ctth1xmYshy+5uDKbZnJWUDKmwZlENLOO/+MB9ieJUMGrKgJD i55eKoESfl5dCsEj2ySCpf8e84y/pCE08O8neViU9brU8ce1ik8SD4uwboQ6wfdMymWj LOTW69ugUYTY1qKX8W84UPcqd9WeJsTlNcpjINjaCH7cM1vkxwenN8sFflUo8Gf6hii0 dyxSNsnUC2dxBzpiTgZX4NQ3SExl5l/jrZNjzaPmPGeVCU19kPsI+zuLnlYV9yd1GsT7 GXOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+OfPp6+r7Zf3NKTXpMRuMvIJCtMgZRIBNwDS9FcnyZQ=; fh=hCxFjoGWrGrRQspmq/CLS+yuX8/gGHZ6aT42c5brLWg=; b=KbWXqGiC10XNSB0cvOLKWLzkTx7gcIdPUGAKgHbP6z4LxnHqZT6IKoTTYB2bra4zvI pId+YWPtKreV0dLWDcL+ZYzLCpT/cbYsBra78Jv8rg8YlpDHXIcc3chgeBZQyoKWpuUo mJQ98fvc7s8rFiKl0wL6WDTHHN+TwBDdFSXIaECtGHdTm3xnVExdrLLqNJQM3CGGqZnl 74FI/TxLDSW1/70zPhlM48S7Sk92N1quow1O3cmm1F4yc2VQOC/jTYIVvnEdpQtwNPoh ibWHJ8mzR9dlcQBOW/9xc87+fOd91dOamHFa9c+UxKIQDVy5G9wwhyM4yH9/sejfFn6O Hgww==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WMqI9hQG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-792bf360a7esi1306861685a.551.2024.05.15.01.00.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 01:00:17 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WMqI9hQG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Alistair Francis , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Reviewed-by: Alistair Francis Reviewed-by: Philippe Mathieu-Daudé 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, target_ulong pc) CPUState *cpu = ctx->cs; CPURISCVState *env = cpu_env(cpu); - return cpu_ldl_code(env, pc); + return translator_ldl(env, &ctx->base, pc); } /* Include insn module translation function */ @@ -1243,7 +1242,8 @@ static void riscv_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) unsigned page_ofs = ctx->base.pc_next & ~TARGET_PAGE_MASK; if (page_ofs > TARGET_PAGE_SIZE - MAX_INSN_LEN) { - uint16_t next_insn = cpu_lduw_code(env, ctx->base.pc_next); + uint16_t next_insn = + translator_lduw(env, &ctx->base, ctx->base.pc_next); int len = insn_len(next_insn); if (!is_same_page(&ctx->base, ctx->base.pc_next + len - 1)) { From patchwork Wed May 15 07:52:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796876 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp2853599wra; Wed, 15 May 2024 00:53:51 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXAz31ETMUhZQvX+FJP78koAHB5Gb8LokYCqEH9APehakSbApHG2II+wPw80Q/8iEESemmE05oC4iNB4d2lrSgv X-Google-Smtp-Source: AGHT+IGRhBw5MFeED4RfGLyojSmlstZ8YQb9kGn6nyvtNLv2zGpM4xJVm9Wuj4zaLPHEI0EfavR/ X-Received: by 2002:a05:6214:2dc2:b0:6a0:d4ea:2378 with SMTP id 6a1803df08f44-6a16815e177mr171596076d6.20.1715759631113; Wed, 15 May 2024 00:53:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715759631; cv=none; d=google.com; s=arc-20160816; b=qL2lext5tJDUoNgLFHgFG80H0bxtaI10IDAE0VMInvU/li15PO5Jk4dUUREz2AsRg9 D6KLreDyWr7hUbUrdOk5UcGbqmsSSoahTpJhyBDKgKReeMsr2IVkhV1rYFC10oF7fu6X 6Q7KVwfZ9bDk2ZambElz/7zi5hbSS35Y/S4Q59pcfccHXJSIqCEH6HvdooJKV75dNaRN uecJp+JOr2nXoyu/s3+7RxMqT2PEqosUkw0KhdInkh7JKgKSYAcAKT0STW0q3DZcgUAV jmaNEkgJmvhEw6J3VlI8eUock+4iWzxFvhK0HqCGV6NgcfOYSOqPMp85xeIeUW9HHVK1 RudQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=abuDTzJtuHQkleQ2JIJcQY+Wz/0ibhtmXe6lLhOCiLw=; fh=BCLN+t2ZqfLIJQawKoImfSYKBLl07s8FDPr8BfggRIo=; b=ABdY7N+2TzaxyR23dmFGeCsiRq/aHXQczXARbY/jlUqj27tPogTjsLA0XQi4vEEOjV SWTyKFkGAeFIDt343c/LSOvmon8nkqJE7G/LY+076x4Gad3QD12yPZnwN6Q3OSXBOTY7 j7rrfHGpaGszInaYa9AKCMt7Qp1T3KsoQTO0jXOgS6JSBStVq+IZ+I1h219Gx8v+fpdO ojrIzkAp6FdRoRmrN8HIyZQ9cnULP4vvgMVTTLSWIU50KJBTMBpEyG8h9xZum9IVrf6d +z14wYjBWswNjY8Py3KnhQed7pGx0NY+JX8VXTi9n13285IAqKPcTTDNL6m1gj8/JPyI fJ+w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i8fhWAB7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6a15f2f24f2si134122826d6.514.2024.05.15.00.53.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 00:53:51 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i8fhWAB7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Yoshinori Sato , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Reviewed-by: Yoshinori Sato Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/rx/translate.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/target/rx/translate.c b/target/rx/translate.c index 92fb2b43ad..9b81cf20b3 100644 --- a/target/rx/translate.c +++ b/target/rx/translate.c @@ -22,7 +22,6 @@ #include "cpu.h" #include "exec/exec-all.h" #include "tcg/tcg-op.h" -#include "exec/cpu_ldst.h" #include "exec/helper-proto.h" #include "exec/helper-gen.h" #include "exec/translator.h" @@ -75,10 +74,10 @@ static TCGv_i64 cpu_acc; /* decoder helper */ static uint32_t decode_load_bytes(DisasContext *ctx, uint32_t insn, - int i, int n) + int i, int n) { while (++i <= n) { - uint8_t b = cpu_ldub_code(ctx->env, ctx->base.pc_next++); + uint8_t b = translator_ldub(ctx->env, &ctx->base, ctx->base.pc_next++); insn |= b << (32 - i * 8); } return insn; @@ -90,22 +89,24 @@ static uint32_t li(DisasContext *ctx, int sz) CPURXState *env = ctx->env; addr = ctx->base.pc_next; - tcg_debug_assert(sz < 4); switch (sz) { case 1: ctx->base.pc_next += 1; - return cpu_ldsb_code(env, addr); + return (int8_t)translator_ldub(env, &ctx->base, addr); case 2: ctx->base.pc_next += 2; - return cpu_ldsw_code(env, addr); + return (int16_t)translator_lduw(env, &ctx->base, addr); case 3: ctx->base.pc_next += 3; - tmp = cpu_ldsb_code(env, addr + 2) << 16; - tmp |= cpu_lduw_code(env, addr) & 0xffff; + tmp = (int8_t)translator_ldub(env, &ctx->base, addr + 2); + tmp <<= 16; + tmp |= translator_lduw(env, &ctx->base, addr); return tmp; case 0: ctx->base.pc_next += 4; - return cpu_ldl_code(env, addr); + return translator_ldl(env, &ctx->base, addr); + default: + g_assert_not_reached(); } return 0; } @@ -190,22 +191,22 @@ static inline TCGv rx_index_addr(DisasContext *ctx, TCGv mem, { uint32_t dsp; - tcg_debug_assert(ld < 3); switch (ld) { case 0: return cpu_regs[reg]; case 1: - dsp = cpu_ldub_code(ctx->env, ctx->base.pc_next) << size; + dsp = translator_ldub(ctx->env, &ctx->base, ctx->base.pc_next) << size; tcg_gen_addi_i32(mem, cpu_regs[reg], dsp); ctx->base.pc_next += 1; return mem; case 2: - dsp = cpu_lduw_code(ctx->env, ctx->base.pc_next) << size; + dsp = translator_lduw(ctx->env, &ctx->base, ctx->base.pc_next) << size; tcg_gen_addi_i32(mem, cpu_regs[reg], dsp); ctx->base.pc_next += 2; return mem; + default: + g_assert_not_reached(); } - return NULL; } static inline MemOp mi_to_mop(unsigned mi) From patchwork Wed May 15 07:52:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796884 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp2854059wra; Wed, 15 May 2024 00:55:26 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVwqDZ+xMu/Z8LVYcjOESrXp+2gmZFtiVoNVSPkNah57c0zI/mJGJj5an6wHa/davd3/UQQHFiLTKmPUd02UqY9 X-Google-Smtp-Source: AGHT+IGiZ/O80RAgqD8wWJUydWFmTNSLFylGhPvl5LocMAW4NZEwsiTjbdf4t9WOUgmcNQhqvU2L X-Received: by 2002:a05:620a:55ba:b0:792:c473:f645 with SMTP id af79cd13be357-792c75ffbb3mr1554591585a.54.1715759726199; Wed, 15 May 2024 00:55:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715759726; cv=none; d=google.com; s=arc-20160816; b=k2UUtBjL1LTBWArq8Wq6fplbq4uhV5vrEgLo7QAatvKaRQHWDaL5IRdtznqiNalwrh 2AO07+2ilKbSpTSeAiY6No6BJTZZWW/XZK14wPK5TTJHAPFzAzao8Xx3s9O6GPE68SXg qjVW0zeLgsYo/dhFkxIW1xgdVwkIVUzFLqJmhC/tTQSP2AJYOc/DMNFgqOKyV8UZdGSA ybrIemS5Ag4WD6eTohFBzKzSCSlzPKCYRdY1pMniVCP4Nu6Pi/cYQlmI9CM7uVR8Avez +jsnrj+zffgONBT8eCxWDUE0B0zmn5WLy/XGuR6QpKpXcCp621tSFYMtUkIDCGk9nNnC Xkng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QiNkoAsgvTetR5YHMAeB2w6OV5e9o48b6mfaDP+sgJw=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=PdwouuX+N5aoyAnkbVgOrZJhBu9aV/GdRh5Cv1709cNA/7g2bNZGPbxWUKyPJ08KgK eHjSvHwI1VrasRFkd8AU0tOofZWpPUTkzCT/y4OzZl6PUbOk5oQJDYwaCu8vDkr163zZ sHhbL/BEIO2RnmTKpJHziCP+U4awE6TlYnO0qzG7ne3Pb15tgwhCEEQvSoEfCQyKiF9O N/HEH5qFUhl4Q+8FW2YYbjOHhBLV6Blx7NMSx7z2etttzo7B7OdohD0ad8mWOFKzB0SW nu7oEf+2fAM7jpPAvtBV9t9a5JZQG36ZM/bpOnZ0esfXGA8daVPQ9gklyay1lMwc8hAe YrFw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bH4iHFd0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-792d7f288d9si841532285a.192.2024.05.15.00.55.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 00:55:26 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bH4iHFd0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/xtensa/translate.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index 42109d33ad..75b7bfda4c 100644 --- a/target/xtensa/translate.c +++ b/target/xtensa/translate.c @@ -35,7 +35,6 @@ #include "tcg/tcg-op.h" #include "qemu/log.h" #include "qemu/qemu-print.h" -#include "exec/cpu_ldst.h" #include "semihosting/semihost.h" #include "exec/translator.h" @@ -1118,7 +1117,7 @@ static void disas_xtensa_insn(CPUXtensaState *env, DisasContext *dc) static inline unsigned xtensa_insn_len(CPUXtensaState *env, DisasContext *dc) { - uint8_t b0 = cpu_ldub_code(env, dc->pc); + uint8_t b0 = translator_ldub(env, &dc->base, dc->pc); return xtensa_op0_insn_len(dc, b0); } From patchwork Wed May 15 07:52:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796878 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp2853689wra; Wed, 15 May 2024 00:54:08 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW2gLwPoCZ2O1rbTKsew5U/KKR3s2NtIm6DK1S7EaPuz9lumKoO175l8ym9FF4UO0PtBZwe5mdyXbPbMh0+5/X8 X-Google-Smtp-Source: AGHT+IF5cHdiySzprAQ6RpC8oCFzbi/db76r/nSuL0ffrQs8g8iIj6G9YYnrbtxNS5DN/mC1c30/ X-Received: by 2002:a05:6902:390:b0:de6:80a:f7fb with SMTP id 3f1490d57ef6-dee4f2cf742mr14445449276.17.1715759648004; Wed, 15 May 2024 00:54:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715759647; cv=none; d=google.com; s=arc-20160816; b=PovHbKkPyisvnMeowxFuF8MiMtFYyRiBnbRK+Gq/G/URzdeAJU8gR4/is+s9vLMRt4 j04PZFzEe+q9uwlGdAQPp8j43oGTqgQ5buyEd14kEWkme9xdKU4PkszhYa0cqlzBsA/j iI2C1WjVKJt2U+Co7WMM6NMmHr/4wMOR5uYnBOihlCAyLZ67B6Avd34ddTF4eBP6WLPZ naBQ0is0oHqlpTNl6SquZ45o7MoZJxBmLzhmo18t8CXPd/XaIPStg9C1yt9c4XQeGBsi oUEIGPbXCTxeN7woQuiqc4bUSf17fYQYMe2R+c2wk8j1+4gLjmtvHFkwPIoPBGa4cgFL GF7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SjyMRvjnIaY+m73p3izMShXRE/INt2PJeY5RjBYNjA4=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=RK0ljOf6Ku1QO54dJlCpKR9QEVLvuSLq6UOORQqVvon6B3ZI3hC7/0ypBmgbzvGYhF DGuaN5KdtawlH8ZXPCTOymf1ipBATcGkXQNk7IOF3eLreEFA80Kvb2LOweqjAJ9xzq1w DMgckXTnMMX1RdxuTOLmCMm/5wjxG3h8rkejUkM/zT1wTvaF3SIAQirZ8vmb7Frnwzp5 pBWWd433CcLyQpOqAhdcMedKXyGu9oXxNz1ZOXm3V/FEA7gblQ8QX8nuICTCSIvVyXjY qY/XLFKAHzXu94qkcdFJWU8YXfhzUu9JuasjFPXJakqfzjZ1O1bm2Bc29sB5aWkyHPzD f8ow==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mwkZkJ1I; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6a15f1d6de7si136240716d6.113.2024.05.15.00.54.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 00:54:07 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mwkZkJ1I; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/s390x/tcg/translate.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index bac033c63c..ebd96abe6c 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -36,7 +36,6 @@ #include "tcg/tcg-op-gvec.h" #include "qemu/log.h" #include "qemu/host-utils.h" -#include "exec/cpu_ldst.h" #include "exec/helper-proto.h" #include "exec/helper-gen.h" @@ -6471,7 +6470,7 @@ static void s390x_tr_insn_start(DisasContextBase *dcbase, CPUState *cs) static target_ulong get_next_pc(CPUS390XState *env, DisasContext *s, uint64_t pc) { - uint64_t insn = cpu_lduw_code(env, pc); + uint64_t insn = translator_lduw(env, &s->base, pc); return pc + get_ilen((insn >> 8) & 0xff); } From patchwork Wed May 15 07:52:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796889 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp2854094wra; Wed, 15 May 2024 00:55:33 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUZ7wnouEwv8ADziWosCDr/AKqIajt0DJsq895KtJlR6v3BudZp4ycoEz2PmeA/4cBVwo6sFGQD+7f3XYYKH65F X-Google-Smtp-Source: AGHT+IEazz0L3aER26Mlz72D7yFo0zAfAnn79ZVpy62Za18yVOSg7EM4AXqZp134BKZHh2pmIQ5N X-Received: by 2002:a05:622a:3d4:b0:43b:1472:166d with SMTP id d75a77b69052e-43dfdcd82camr147610131cf.51.1715759733401; Wed, 15 May 2024 00:55:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715759733; cv=none; d=google.com; s=arc-20160816; b=kErvQbOBsdsYkJC6l2VOWoqEA0ECibu8EM4xwHnCQyP1CNyGG4N66pcnCVgI0gtV07 LNOvhI4XzrqLtGrC+HA5dACWXp5OR7l0zBl3JKK92OxW9y47jRHYIRIBd811FKdO61B8 vndBoyacRa+0Np6fse1loqBJPQrczmio5QGwMm+K8LTWZeze9PZPBKNxIW5npAI9oq8k rSV9RNqBYSGh0vCX5Dhq1etIvbqjmVfxZeVghQ4cf1EoMaaih/fA/cP7/KnNvTCxWmUg jLrwfY0U7RD8g1PFni1Xs0KCWDB6wMuWEv14gZ7rDaO5/iiwkJ50uOcMrznEQMTLC9Mp jImw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WSsZfxq/88RzELsWEja85iYyfeFnMRpyB3iR3ue9fiM=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=LbzzivtdLq+3C00VqidwJBsAOS149QYnUL+bqnrtW+LWArc6muxaPMzxgL1Gh0X1E5 1MyYjnMVxYeTHe6eVr1NtK5Cm0V31yKbkZq29C2iJjpjeE9IQ6dqSNkF00mwQMNtH/HZ kg46apzcO7qXk4niTgBOeAFZMrKD5ri0HCz1H/IqHFMRHiKumg6uU8lABPAclcmEaMm5 S23OFTXTmJUbFNgueqa6yd5Kjxbs5R1YzwNWcdLVuESoy+kMjBa9oAxdY4AJZJNvRGpt YS1/bWPL0HPgfBJA1xom5uVYlpu46gux6KAABPLwr45IQCSLD5Gr44PaMnEbZiD2c3yF a5aw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pdzSkBZ0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-43df549f4b5si137010601cf.34.2024.05.15.00.55.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 00:55:33 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pdzSkBZ0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Previous commits replaced them by translator_ld* calls. Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20240405131532.40913-1-philmd@linaro.org> Signed-off-by: Richard Henderson --- include/exec/cpu_ldst.h | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h index 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); -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 From patchwork Wed May 15 07:52:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796880 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp2853729wra; Wed, 15 May 2024 00:54:17 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWv6jZ1Bddj8bKj/2lPSgKJnu2bFA+QcH5nd6rT3f/XX7Crb1m4y+Z7GmxTk3ZAOufReL0ijBxe5ZwCGZvf22hl X-Google-Smtp-Source: AGHT+IH/Fh9ffzXzlVFAPiDWvRK/CKseJRtHwe/dXAMDSVe9TbtfuY5KiBWakW01K0RAFyZpM+fj X-Received: by 2002:ac8:570a:0:b0:43a:9cd3:8063 with SMTP id d75a77b69052e-43dfdb06faamr175344941cf.12.1715759657555; Wed, 15 May 2024 00:54:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715759657; cv=none; d=google.com; s=arc-20160816; b=Hwp1eq6yCcZKfwHnMp5L4/POeHYzWWsHxuPUjdMhu1juksZmgOcR9B1tSdefInoqAr CAj1V+dq5jRD9dZQ/Ut3xH9JJCxAa2Ee19JxR24Md3NoTwEWVO5UKcqbXU+znZ7WmoPe i0HP5BL7/a/dntjP4ZrCFOPDPA1RBV3dYrRmuOq1hiOUcrW3AmB1ouyCTc5PjKsWs2LE XcBGIg+gGq7i17T28s2cwrnDKpB9oehhQHFXnIF50bfU3DBFBUtjmSn4ZXVG0Z9mlkpV H6fvYj502nD1cVKQoju5sxO/awk3xri580l3u6pXMgsaluO3uIfWfThYg7elSG8K0sb/ D42A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cTgwDkKTKvYMYNq8Uet4oTtWVQWuFqOkSWxaQArY+XQ=; fh=dEwFLx4RlFeIdEjB+81df8rw+g2kcnWwTIpTqh+QlBQ=; b=c19MrV9klUJsoUa977fXZYIXdm0yEdsPu2EfeIyEWnMPQoiA/vh0204D0vbODjzF7S PJTZwiFR1PkswcaeS8lp/JlgftDhygwqaeIzC3j+OIJsFXpJdiE8z6mXKBHGwZMdyh/9 o4WqJrZHhtJsAArNaZg55WBW65dw14l0p0grK2xj1eW8WXe0zdRfG4of0qxhHdZx38Wk hvqWLRpntj5TDrbTGhVG5PQDLYWVIweSSmgt05yt3TGPGVw+2DuMj8/YTTBGNCx2/Ux6 yO5PaurLOf1pdqYYkPHH3OZzRdiYIvYO4H7PPeoxzhUFNR3auqs8MOZKL2TDv8m7HLtC 06OQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Xk7gApZQ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-43e214b5da6si47451171cf.542.2024.05.15.00.54.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 00:54:17 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Xk7gApZQ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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, } } -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 = type == 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 <= offset && offset <= 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(); + } } -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 = type == 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 <= offset && offset <= 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 = TCG_REG_TMP0; + offset = 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 <= offset && offset <= 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 = TCG_REG_TMP0; + offset = 0; + } + tcg_out_opc_vstelm_d(s, src, base, offset, 0); + } + break; + case TCG_TYPE_V128: + if (-0x800 <= offset && offset <= 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(); + } } static bool tcg_out_sti(TCGContext *s, TCGType type, TCGArg val, @@ -1740,7 +1810,6 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, { TCGType type = vecl + TCG_TYPE_V64; TCGArg a0, a1, a2, a3; - TCGReg temp = TCG_REG_TMP0; TCGReg temp_vec = TCG_VEC_TMP0; static const LoongArchInsn cmp_vec_insn[16][4] = { @@ -1820,22 +1889,10 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, switch (opc) { case INDEX_op_st_vec: - /* Try to fit vst imm */ - if (-0x800 <= a2 && a2 <= 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 <= a2 && a2 <= 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);