From patchwork Fri Apr 5 10:24:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786221 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp93000wrw; Fri, 5 Apr 2024 03:27:03 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVzVUJ9x29puaxX3c1wlOQGXyl17P49MhMNJB9ExrVLTDos4387UClPcKEM+qwP0Q7QCZ2iJbZFF561An7+z3ag X-Google-Smtp-Source: AGHT+IHx7ZEizTs6cpL5XxOtQUP9l9z4pNC1L/lY3oNPthg30pqEP9guAZ0t4OznSMIe7H3gMjad X-Received: by 2002:a05:620a:f8c:b0:789:da81:8f2f with SMTP id b12-20020a05620a0f8c00b00789da818f2fmr807265qkn.26.1712312822812; Fri, 05 Apr 2024 03:27:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712312822; cv=none; d=google.com; s=arc-20160816; b=SBeA5kY9u25Uf0kv7cKBAhk2O/bGOOHWeP9qTA4QzXYWSFLurKv4LNEmF+6/cp7+qE kCuIdacxi9WfOCAW31Jw6bHZuNP2YOlZ1+Dma63XS74nMUfWigKY3DyiNKM8GXXv12Oz KaQnAoN+3feDZLqpzmb/FeLLWxKKWT409BUL6V31t0JG45IoRqjjMgXPuLg+ywBdRfYJ 0soDcdR3zwboV4Ck0jHmQvCAJEvOuTha4bqJ6gNK/+er5EXHtUCtIO7Q4uvQcfSHei+G 9Mbzke61kxl8ixLbPzFQSuERUVhBejrWqJt7eeVZ3Clt/VcOWHZ0EamzzKEj4YL5IyGp wKzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=rExV436qASDL7Fg2YdiVxvwbh1gcXXC/kcp8pAfAu2E=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=M0p/ykBn+n6kzSz1GVhCzGt/aIbyePsFyC2XyfbmYvmR+JmZnwTEGw0rXUKo6fmEHl huKmELjIfb6498r3bXfipAn2NnAg05NpWnCgFI3fYfChw65CR4gIcdOBabHXutO5y8hY 5SbFI5hsncxhRycOSI76QAVJhfn9q52kfv6WglLHy6fcN7ayDNHZrFH3tFdnq6QS2u6b o7t88e6wQ/dcx4YfrFqtwiwqIV+3ZC8/pMrQp/edaFXq3U+1QRGn9mTQ5hs0qUK/8dnU aHoDzlLu8+evtz606RWT5ByegJxr0eDi7M2E/ZTQYWFUGl3OWc21/vYz01FEOiezifnR mo3w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kOFE5F0P; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y11-20020a37e30b000000b007882e4d4076si1420914qki.578.2024.04.05.03.27.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Apr 2024 03:27:02 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kOFE5F0P; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rsglJ-00065K-UI; Fri, 05 Apr 2024 06:25:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rsglC-00060C-Cn for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:26 -0400 Received: from mail-ot1-x32f.google.com ([2607:f8b0:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rsglA-0004m2-N6 for qemu-devel@nongnu.org; Fri, 05 Apr 2024 06:25:26 -0400 Received: by mail-ot1-x32f.google.com with SMTP id 46e09a7af769-6e69a9c0eaeso1285945a34.3 for ; Fri, 05 Apr 2024 03:25:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712312723; x=1712917523; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=rExV436qASDL7Fg2YdiVxvwbh1gcXXC/kcp8pAfAu2E=; b=kOFE5F0PSHQdUmtDU4G6G7OmSGJgcR1a5YoFavYVBu0u2/JOyYahOyAZQJATAqyEHM NYfMcKyC4OCW7ZYoy3DSHWIUMqK0nJNKSQQSmt6baqXk39wcG8sYbeiy+A3cCcHc3Mbu zcjX573L56CWVRvh2FfgOc8g2RJ4SrcquSxllIUWn8pljeADvDmM3YNHaRxT9FxJoXjb ForoKA1+v/phTHhMQ6/9bJd7XrAc+hMXQUAx3iw9gHj1lf8LWjzPJC+w/lpZS7MDyHB9 QYU+qEEDDOn4+TxHEysAVq8V8qev2aKGYn9vI18tater+oBjDzyx6r5d1wBTeSLlJK87 bb0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712312723; x=1712917523; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rExV436qASDL7Fg2YdiVxvwbh1gcXXC/kcp8pAfAu2E=; b=P5AqyztKByzMVSgYQOC0zv/9kij/L0CsV4DLbgN/IliOK9BNxUdSTZRR3yZ0W1Xh7C 4rgXFb3Hj4U1giGSHDz8fjVTb+pzBXDx2nDPf8Gt5em8YxyBeNFsFsgEpujc95/up1nq E1/uLfPzI3EvxIsdSGeO/65r/jq67tLtenJp+Ew3MGbjRIgypzNo/URpoeAUWooRuVJl IYtS4QonfT0WLx6RUy2w2/UpqCr4p+Ttux+w2Zv+RRhAzMg7eroFtWthsnN70betpf5a tO6LPXV+CdABRfphsL/dTBGQ8pP7iKmAzTZwshGj9xCCBH116DRHtxfToYmKUKLjaMoF vvNA== X-Gm-Message-State: AOJu0YzZF3uB64cG3D5+qXln9+M+kAghzvyyORFcTLxxFSCpdMG2p1XS nxZsDfn0S02rOAzrbEpZyR+qiC4AtgKZ3yw9XR9BOihdM43jfk2QTjeCcCWFiX2ogBWqNQuor9a r X-Received: by 2002:a05:6870:f286:b0:22a:a40c:4bf2 with SMTP id u6-20020a056870f28600b0022aa40c4bf2mr1137462oap.14.1712312723440; Fri, 05 Apr 2024 03:25:23 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id h10-20020a63f90a000000b005e438fe702dsm1104304pgi.65.2024.04.05.03.25.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 03:25:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 17/32] accel/tcg: Return bool from TranslatorOps.disas_log Date: Fri, 5 Apr 2024 00:24:44 -1000 Message-Id: <20240405102459.462551-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240405102459.462551-1-richard.henderson@linaro.org> References: <20240405102459.462551-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32f; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org We have eliminated most uses of this hook. Reduce further by allowing the hook to handle only the special cases, returning false for normal processing. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- include/exec/translator.h | 2 +- accel/tcg/translator.c | 5 ++--- target/hppa/translate.c | 15 ++++++--------- target/s390x/tcg/translate.c | 8 +++----- 4 files changed, 12 insertions(+), 18 deletions(-) diff --git a/include/exec/translator.h b/include/exec/translator.h index 97cdb7439e..6ebe69d25c 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -134,7 +134,7 @@ typedef struct TranslatorOps { void (*insn_start)(DisasContextBase *db, CPUState *cpu); void (*translate_insn)(DisasContextBase *db, CPUState *cpu); void (*tb_stop)(DisasContextBase *db, CPUState *cpu); - void (*disas_log)(const DisasContextBase *db, CPUState *cpu, FILE *f); + bool (*disas_log)(const DisasContextBase *db, CPUState *cpu, FILE *f); } TranslatorOps; /** diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 2a69916b9a..712e0d5c7e 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -224,9 +224,8 @@ void translator_loop(CPUState *cpu, TranslationBlock *tb, int *max_insns, if (logfile) { fprintf(logfile, "----------------\n"); - if (ops->disas_log) { - ops->disas_log(db, cpu, logfile); - } else { + if (!ops->disas_log || + !ops->disas_log(db, cpu, logfile)) { fprintf(logfile, "IN: %s\n", lookup_symbol(db->pc_first)); target_disas(logfile, cpu, db->pc_first, db->tb->size); } diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 7470795578..b1d3d6d415 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -19,7 +19,6 @@ #include "qemu/osdep.h" #include "cpu.h" -#include "disas/disas.h" #include "qemu/host-utils.h" #include "exec/exec-all.h" #include "tcg/tcg-op.h" @@ -4816,7 +4815,7 @@ static void hppa_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) } #ifdef CONFIG_USER_ONLY -static void hppa_tr_disas_log(const DisasContextBase *dcbase, +static bool hppa_tr_disas_log(const DisasContextBase *dcbase, CPUState *cs, FILE *logfile) { target_ulong pc = dcbase->pc_first; @@ -4824,20 +4823,18 @@ static void hppa_tr_disas_log(const DisasContextBase *dcbase, switch (pc) { case 0x00: fprintf(logfile, "IN:\n0x00000000: (null)\n"); - return; + return true; case 0xb0: fprintf(logfile, "IN:\n0x000000b0: light-weight-syscall\n"); - return; + return true; case 0xe0: fprintf(logfile, "IN:\n0x000000e0: set-thread-pointer-syscall\n"); - return; + return true; case 0x100: fprintf(logfile, "IN:\n0x00000100: syscall\n"); - return; + return true; } - - fprintf(logfile, "IN: %s\n", lookup_symbol(pc)); - target_disas(logfile, cs, pc, dcbase->tb->size); + return false; } #endif diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index 8282936559..d8c1ad042d 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -31,7 +31,6 @@ #include "qemu/osdep.h" #include "cpu.h" #include "s390x-internal.h" -#include "disas/disas.h" #include "exec/exec-all.h" #include "tcg/tcg-op.h" #include "tcg/tcg-op-gvec.h" @@ -6522,7 +6521,7 @@ static void s390x_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) } } -static void s390x_tr_disas_log(const DisasContextBase *dcbase, +static bool s390x_tr_disas_log(const DisasContextBase *dcbase, CPUState *cs, FILE *logfile) { DisasContext *dc = container_of(dcbase, DisasContext, base); @@ -6530,10 +6529,9 @@ static void s390x_tr_disas_log(const DisasContextBase *dcbase, if (unlikely(dc->ex_value)) { /* ??? Unfortunately target_disas can't use host memory. */ fprintf(logfile, "IN: EXECUTE %016" PRIx64, dc->ex_value); - } else { - fprintf(logfile, "IN: %s\n", lookup_symbol(dc->base.pc_first)); - target_disas(logfile, cs, dc->base.pc_first, dc->base.tb->size); + return true; } + return false; } static const TranslatorOps s390x_tr_ops = {