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 = {