From patchwork Wed Apr 24 23:31:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791609 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1107555wrq; Wed, 24 Apr 2024 16:36:37 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWr2DyRi/oiE0vl1/urjRhGiZxRlsSR73CLce9daekd8EJXpHFxV8YBWE9F8kzip5wZZHEDRystnrw+2cMh47Dk X-Google-Smtp-Source: AGHT+IEOtUAJH6Yk2jgWHKLkwovJRb7YT9eNRstR17+zqKiziP5hQGd03MHxkApM7TelzORQbf76 X-Received: by 2002:a0c:f749:0:b0:699:3883:5474 with SMTP id e9-20020a0cf749000000b0069938835474mr4310670qvo.33.1714001797100; Wed, 24 Apr 2024 16:36:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714001797; cv=none; d=google.com; s=arc-20160816; b=MfMbHPw3HAUNg+51pPTRF7PAHPnAqEv+Td1zJEIZAAQQfjB0jjoLBMzBJbjsfbz44O 3oIurdKBYv2dGaZOrrmpaRJ3dqCvDHzrFTr+r9RmnIJKSnuxYcPW1pyjQkQOGdk6MHE2 mgPQMlxuTbCtWmgtgySn+2ed3AusAcgfDdLC6KYdCQjbwUy5vaTnBM2Tgkdf3zKQp/Ub 2Ms4l6IcoPSLeNCjkh/aRE2nmImaNIFutS6G8+lkw11TUV2qd+c3V0EMPAjVAg5Hevmd w4HOdIgxXm27AVGG9brfMeF7N6mlfAzQrXJKbTLIctPliQ2k1lCTZV+p91B6DMW1MZIO dYYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=udtyyROxDVvgFlN2ODG5uKnex/HkXV/I+K4Ewok5QlI=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=OIDAGq8HTUkzMn00Pp7nRBizMHeGYw4fM1nQChTqSwnN3dtrM0x5HV+pZmJj6+dBO/ ciuEeLiHtPY8yihMMDfLiLm6erIxS3K/nxbcyP4nljwoJXHCgXKbbF5zydeZTEOEJQxt QHu5P1/Z9fp8Mj3S7GYH0lwgmM83KGNFI/mFQtdh46qDJp2JKUQ3nTTeRR5j1RRitGBO f/BbAIL1ir4zZBbMBeTYIRpP9mjcosDM2uCbOQgSzbplbnlBp9jGxAfHacQG09frAJwf s6IM3dGBzerA9damzyBZR19PgAeaOp618F8K1+IUDP7FiB9z0TDAE4vJTQjrSdCmFDA2 alrA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GoE+Q51W; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e8-20020a0562140d8800b006993226cc11si16245420qve.566.2024.04.24.16.36.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:36:37 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GoE+Q51W; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzm5j-0005wX-Fj; Wed, 24 Apr 2024 19:31:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rzm5f-0005qv-0U for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:51 -0400 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzm5d-0003Tq-9g for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:31:50 -0400 Received: by mail-pg1-x52a.google.com with SMTP id 41be03b00d2f7-5f415fd71f8so323808a12.3 for ; Wed, 24 Apr 2024 16:31:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714001508; x=1714606308; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=udtyyROxDVvgFlN2ODG5uKnex/HkXV/I+K4Ewok5QlI=; b=GoE+Q51WpgP+TesOQfrnXUYuEV2e7QIn0K2udoQNFJhEoyMEpbSjHEBL3NE7ZABwg5 jPEkAHc9aOlND5PE+CTyWzK/K0CXFOmymDHEsAND8UjrnWiXepMfnLbva8osZZQEXrRv Q1huEvn8gXP6g8YqE9ij+TdPVndVzqKDO/Vi9uDKPvMYV0AV/Qxz840GFkizm9jg8N4T 6uLAUw1Ezdt7cvEjlKDQECdIhDIOxIrD/HstzkQxNra4Pup4Sn7x0i7S2k9bMPF4fe2K M7vvZIzfvySFgePA2aEUd4csVWaUKs2VH/yOveTmodjrkl4EVEN5eA6TnhThzecqc4LA NPfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714001508; x=1714606308; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=udtyyROxDVvgFlN2ODG5uKnex/HkXV/I+K4Ewok5QlI=; b=eFJ036VD7Ll2/ghtpDOD7talZvCPNdalcRfgUaRmA81I/iEuiulELFOhFy71r68Hjg u8FkPFH5McGu8ITEXgfwKscte3u0CN5BJkxRiZzX+UeheDNkPxQeJXI4PXAIsgtGKZoQ HwF0zDW0oJy5V/vw8b3Ia9f1FShwnCxEL3iJyKoyvk5Skn1UXa0Bre2ofFvJYBuRekcS CjkJc5hpumVaJvAEtU0NsOpcPKqyyrucv8WBYHuH/iK9zklHIgl1XyweUzKqptSu+fzb Tin877plGLJcjfFxo9jDhcWU1+QNSJAnfdPXYhGtE3KpDRyE9YDtqg+nFPuWA7vkyoP2 Gq1Q== X-Gm-Message-State: AOJu0YwJLDCZtXvE/pSWgoAAjojtqScm88/UINuOW17vH6jScgp5cQBC Ad9F7GFu/OxBFgdT6UP2GgmlUItNb3rcM9zIkHnaQZQk7JpHlahae8waiPESjyIlFK23mae1V84 z X-Received: by 2002:a05:6a20:6a1d:b0:1a9:85a0:afeb with SMTP id p29-20020a056a206a1d00b001a985a0afebmr4562937pzk.20.1714001507978; Wed, 24 Apr 2024 16:31:47 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id z24-20020a17090abd9800b002a56b3931dfsm11737859pjr.49.2024.04.24.16.31.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:31:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 17/33] accel/tcg: Return bool from TranslatorOps.disas_log Date: Wed, 24 Apr 2024 16:31:15 -0700 Message-Id: <20240424233131.988727-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240424233131.988727-1-richard.henderson@linaro.org> References: <20240424233131.988727-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52a; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org We have eliminated most uses of this hook. Reduce further by allowing the hook to handle only the special cases, returning false for normal processing. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- include/exec/translator.h | 2 +- accel/tcg/translator.c | 5 ++--- target/hppa/translate.c | 15 ++++++--------- target/s390x/tcg/translate.c | 8 +++----- 4 files changed, 12 insertions(+), 18 deletions(-) diff --git a/include/exec/translator.h b/include/exec/translator.h index 3c354a4310..bd76d6446b 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -135,7 +135,7 @@ typedef struct TranslatorOps { void (*insn_start)(DisasContextBase *db, CPUState *cpu); void (*translate_insn)(DisasContextBase *db, CPUState *cpu); void (*tb_stop)(DisasContextBase *db, CPUState *cpu); - void (*disas_log)(const DisasContextBase *db, CPUState *cpu, FILE *f); + bool (*disas_log)(const DisasContextBase *db, CPUState *cpu, FILE *f); } TranslatorOps; /** diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index db586b894a..8e8c4e1bf8 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -227,9 +227,8 @@ void translator_loop(CPUState *cpu, TranslationBlock *tb, int *max_insns, if (logfile) { fprintf(logfile, "----------------\n"); - if (ops->disas_log) { - ops->disas_log(db, cpu, logfile); - } else { + if (!ops->disas_log || + !ops->disas_log(db, cpu, logfile)) { fprintf(logfile, "IN: %s\n", lookup_symbol(db->pc_first)); target_disas(logfile, cpu, db->pc_first, db->tb->size); } diff --git a/target/hppa/translate.c b/target/hppa/translate.c index cafba84631..e8a542c039 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -19,7 +19,6 @@ #include "qemu/osdep.h" #include "cpu.h" -#include "disas/disas.h" #include "qemu/host-utils.h" #include "exec/exec-all.h" #include "tcg/tcg-op.h" @@ -4816,7 +4815,7 @@ static void hppa_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) } #ifdef CONFIG_USER_ONLY -static void hppa_tr_disas_log(const DisasContextBase *dcbase, +static bool hppa_tr_disas_log(const DisasContextBase *dcbase, CPUState *cs, FILE *logfile) { target_ulong pc = dcbase->pc_first; @@ -4824,20 +4823,18 @@ static void hppa_tr_disas_log(const DisasContextBase *dcbase, switch (pc) { case 0x00: fprintf(logfile, "IN:\n0x00000000: (null)\n"); - return; + return true; case 0xb0: fprintf(logfile, "IN:\n0x000000b0: light-weight-syscall\n"); - return; + return true; case 0xe0: fprintf(logfile, "IN:\n0x000000e0: set-thread-pointer-syscall\n"); - return; + return true; case 0x100: fprintf(logfile, "IN:\n0x00000100: syscall\n"); - return; + return true; } - - fprintf(logfile, "IN: %s\n", lookup_symbol(pc)); - target_disas(logfile, cs, pc, dcbase->tb->size); + return false; } #endif diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index 6d7f6e7064..d74939389a 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -31,7 +31,6 @@ #include "qemu/osdep.h" #include "cpu.h" #include "s390x-internal.h" -#include "disas/disas.h" #include "exec/exec-all.h" #include "tcg/tcg-op.h" #include "tcg/tcg-op-gvec.h" @@ -6520,7 +6519,7 @@ static void s390x_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) } } -static void s390x_tr_disas_log(const DisasContextBase *dcbase, +static bool s390x_tr_disas_log(const DisasContextBase *dcbase, CPUState *cs, FILE *logfile) { DisasContext *dc = container_of(dcbase, DisasContext, base); @@ -6528,10 +6527,9 @@ static void s390x_tr_disas_log(const DisasContextBase *dcbase, if (unlikely(dc->ex_value)) { /* ??? Unfortunately target_disas can't use host memory. */ fprintf(logfile, "IN: EXECUTE %016" PRIx64, dc->ex_value); - } else { - fprintf(logfile, "IN: %s\n", lookup_symbol(dc->base.pc_first)); - target_disas(logfile, cs, dc->base.pc_first, dc->base.tb->size); + return true; } + return false; } static const TranslatorOps s390x_tr_ops = {