From patchwork Wed Mar 6 14:40:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 778314 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:47:b0:33e:474f:8c56 with SMTP id k7csp327891wrx; Wed, 6 Mar 2024 06:49:21 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVsz3e6dCA6SCdIftciPbo+ofcQPK/1Kpw+dgPeJwGHja36RPyuplDJJ6OB7a748OieS5QturMZG6rasH/k6qbw X-Google-Smtp-Source: AGHT+IHnWcsTMiJDWggkXPsbZoyODDItFd8U8nqfUHO73ZatO1Gp4ahdByvvNv0uvlvBKz4NOwVi X-Received: by 2002:a25:dc42:0:b0:dd0:412f:e01f with SMTP id y63-20020a25dc42000000b00dd0412fe01fmr8153339ybe.43.1709736561117; Wed, 06 Mar 2024 06:49:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709736561; cv=none; d=google.com; s=arc-20160816; b=U3YnL8eLLGADu+BCGxLGt72N0Nfux79nc69BVtvBIx70h7606czKRf6Db/hrvxPlMa FucZB7xUqxnSw0t93x7fSF6jG2AaeDQOLcsHFEx1uQSqUEE74Q1hLlkanIV18a0J2c8p f15GK/ez/h1jUiC4QWDAWCr0nb41TSLqaedSlIcxc0DbSjNH7WeZ/e/a3hspOZ368JNU oZQrwZTzUGKmRDDggWmXCDlQlpPOqvikujellwpSO44vqfRZjpNQssQaonwXqIKAmLt6 oDR/+mbHDZ5/elHjhwHD3tgggqzPhQfiNOk3KJOJEoi1ikld+OFluDQF1u4245B7rwDR s86Q== 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=wx2eJ+KDhes0tXleUJeO3uNoYSnGN+NK8RX0V99627k=; fh=Dl1GGLpLw06hPq9R2IL2OsOOEUL5C+Eo+nVuL4DHI8o=; b=fPPQ3a5oRNIhG165Rrh0K5DvigPPslgZb1yOZGwDpa/s8MQPMiKylCfsRghMu1gMEl Pix1lkG79zjWgj8u5rGTqKmWwJwAxgdlFNSlAI5lkbPe/Of5RzAWfsabVar3FCYtQEls t8zMoQiy0qKRdv+UtOi9l0suIw4en789+EOru0sO0lTaVTGjMP/kshgxRHyMozYQ6Vid S1zvWTM0OoxeaAzo8WKwyZZyqeKFCy+1d1NRphcj0ysYatiboJ/QBQ6DZK+A4jcgWska 5f9JTt1a3tBrZF/X/d/L8MYnCSuebpo2r3WubTwTo1l3P3BQ/eptfGRtHZ+OICBbli+k rNtQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="bzN25o/3"; 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 d10-20020a05622a15ca00b0042eef6c5754si7679167qty.344.2024.03.06.06.49.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Mar 2024 06:49:21 -0800 (PST) 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="bzN25o/3"; 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 1rhsZx-0006fq-6n; Wed, 06 Mar 2024 09:49:09 -0500 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 1rhsZo-0006bc-Pq for qemu-devel@nongnu.org; Wed, 06 Mar 2024 09:49:01 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rhsZn-0004EA-8h for qemu-devel@nongnu.org; Wed, 06 Mar 2024 09:49:00 -0500 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-33d6f26ff33so775623f8f.0 for ; Wed, 06 Mar 2024 06:48:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709736537; x=1710341337; 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=wx2eJ+KDhes0tXleUJeO3uNoYSnGN+NK8RX0V99627k=; b=bzN25o/3dQJz/IHglzntxjO2gU8qSzscQ0OiaZuzrh6/Xvc5ovZL65N1eTLFhR7Mc/ 1AIhjIoPa3o2yx8MyOxqeDViNcqanUuACJon5TgWi7KhMBY+1int7w2gP2RWAMIdKjPq +t7ci6OCFlgDSbunAo8mAeP67yt91Lll2Dk+0h242ZpJ2fqBbA/yZAjHqkvWne7v/f60 EnypX7q2P7lukKhDQaQ5v+vmXP+V7jGj88VVlnRpTyuHmP9XCfdOrWuy9jsuJHOZC3Pm U2FWBGWZ+Cp5dwhwTCsH4E+qtA42lI/8pGFl9fyx0yYE3pd5gjhaFLJNaGYCOjZD4OOm 9iOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709736537; x=1710341337; 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=wx2eJ+KDhes0tXleUJeO3uNoYSnGN+NK8RX0V99627k=; b=sLIgfQYjTPZi1bhHDCPmnzc1Dqd6LLMgZFhpTE8grwrtGAP6WGQ7n01uJ021f3sLGC 1kXnsnPndMgJYX2N1qr8b80ExmaiEJ2vYU4CigqqeReAZc70vVn9HgeAXK0ZW6GIVgsD Tz8XYq1nMcCstY6FeBlrVx+RYuLl1h/tRv3aLAHfk07B6k/CCPxFutnTdE2GY2oZvsSl /E0dd9CeG4a2Od6ENaYdacgE94CNdqvzGlSXUgS9rwadCtJY6kvt16McLFQWqLOA4trx 6pNh8OlIGjxZQFtK1cOgDsh8Tanx/5ovglBwUjBfGqGxwGJ/1JF74upEP9maJIoQ67n1 y9Ow== X-Gm-Message-State: AOJu0YxHAkFacspS2AD5spZ2y5P/t6wxy1tPJ70KE4gtSGlrmKseLm3Z M/ysg5BTqemMcl4DaNj0AqtBTr9XELgYMjZ5L/l/eEaNSAvx+n5Qdzl9WOpEqMg= X-Received: by 2002:a5d:6145:0:b0:33e:187e:a5b1 with SMTP id y5-20020a5d6145000000b0033e187ea5b1mr10359305wrt.37.1709736537725; Wed, 06 Mar 2024 06:48:57 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id bp16-20020a5d5a90000000b0033e0567e90bsm18436009wrb.5.2024.03.06.06.48.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 06:48:57 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 2609A5F9FB; Wed, 6 Mar 2024 14:40:44 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , Palmer Dabbelt , Alistair Francis , qemu-riscv@nongnu.org (open list:RISC-V TCG target) Subject: [PULL 29/29] target/riscv: honour show_opcodes when disassembling Date: Wed, 6 Mar 2024 14:40:41 +0000 Message-Id: <20240306144041.3787188-30-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240306144041.3787188-1-alex.bennee@linaro.org> References: <20240306144041.3787188-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42d.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, T_SCC_BODY_TEXT_LINE=-0.01 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 makes the output suitable when used for plugins. Reviewed-by: Richard Henderson Signed-off-by: Alex Bennée Message-Id: <20240305121005.3528075-30-alex.bennee@linaro.org> diff --git a/disas/riscv.c b/disas/riscv.c index 8a546d5ea53..e236c8b5b7c 100644 --- a/disas/riscv.c +++ b/disas/riscv.c @@ -5192,19 +5192,21 @@ print_insn_riscv(bfd_vma memaddr, struct disassemble_info *info, rv_isa isa) } } - switch (len) { - case 2: - (*info->fprintf_func)(info->stream, INST_FMT_2, inst); - break; - case 4: - (*info->fprintf_func)(info->stream, INST_FMT_4, inst); - break; - case 6: - (*info->fprintf_func)(info->stream, INST_FMT_6, inst); - break; - default: - (*info->fprintf_func)(info->stream, INST_FMT_8, inst); - break; + if (info->show_opcodes) { + switch (len) { + case 2: + (*info->fprintf_func)(info->stream, INST_FMT_2, inst); + break; + case 4: + (*info->fprintf_func)(info->stream, INST_FMT_4, inst); + break; + case 6: + (*info->fprintf_func)(info->stream, INST_FMT_6, inst); + break; + default: + (*info->fprintf_func)(info->stream, INST_FMT_8, inst); + break; + } } disasm_inst(buf, sizeof(buf), isa, memaddr, inst,