From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NelsondeMBP.localdomain (36-230-185-169.dynamic-ip.hinet.net [36.230.185.169]) by sourceware.org (Postfix) with ESMTP id 7FF4B3858404 for ; Fri, 27 Oct 2023 00:39:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7FF4B3858404 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=NelsondeMBP.localdomain ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7FF4B3858404 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=36.230.185.169 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698367163; cv=none; b=pDX04j4e3YPaRVDiAQXkE/TA0wI6GjXZYeL+roQVgJPEytunad8BRar/8DKmdvoowJkS/V4Ryx20Z8kgbK3aUFhhua6nORuQXTOQoOvjeQuP4w64yMUH7yphBR3RXSgy0eKyX2riLGO+dewIfRYPYf/CMbetkXt2RTJQbx6pIWk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698367163; c=relaxed/simple; bh=pv20wEeJx/L397eVZjohAZNDCaV2lCkkd7BX2vsS2fc=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=AP8O2M762dkhmiKvJFK8nlm5Eij4gaXRFw0km4uTPh2wna4gTvGgHrRznhbJgvekcYninef5EhD5CeltcjRUPTpUIlrlx49YS3HJs/S6Te/vXyjzyk1B58HMClaZXjrUROf3zE9iNPg1b+DSZ37qqIkpqz6JHIVivLlyzwxAbAo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by NelsondeMBP.localdomain (Postfix, from userid 501) id EECD112D8EF6; Fri, 27 Oct 2023 08:39:18 +0800 (CST) From: Nelson Chu To: binutils@sourceware.org, palmer@rivosinc.com, andrew@sifive.com, kito.cheng@sifive.com Cc: nelson.rivosinc.com@NelsondeMBP.localdomain, Nelson Chu Subject: [PATCH] RISC-V: Dump instruction without checking architecture support as usual. Date: Fri, 27 Oct 2023 08:39:17 +0800 Message-Id: <20231027003917.67308-1-nelson@rivosinc.com> X-Mailer: git-send-email 2.39.3 (Apple Git-145) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,GIT_PATCH_0,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,KHOP_HELO_FCRDNS,NO_DNS_FOR_FROM,RCVD_IN_PBL,RCVD_IN_SORBS_DUL,RDNS_DYNAMIC,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Since QEMU have supported -Max option to to enable all normal extensions, the dis-assembler should also add an option, -M,max to do the same thing. For the instruction, which have overlapped encodings like zfinx, will not be considered by the -M,max option. opcodes/ * riscv-dis.c (all_ext): New static boolean. If set, disassemble without checking architectire string. (riscv_disassemble_insn): Likewise. (parse_riscv_dis_option_without_args): Recognized -M,max option. --- opcodes/riscv-dis.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/opcodes/riscv-dis.c b/opcodes/riscv-dis.c index 216916e9426..6a910595f6d 100644 --- a/opcodes/riscv-dis.c +++ b/opcodes/riscv-dis.c @@ -75,6 +75,9 @@ static const char (*riscv_fpr_names)[NRC]; /* If set, disassemble as most general instruction. */ static bool no_aliases = false; +/* If set, disassemble without checking architectire string, just like what + we did at the beginning. */ +static bool all_ext = false; /* Set default RISC-V disassembler options. */ @@ -98,6 +101,8 @@ parse_riscv_dis_option_without_args (const char *option) riscv_gpr_names = riscv_gpr_names_numeric; riscv_fpr_names = riscv_fpr_names_numeric; } + else if (strcmp (option, "max") == 0) + all_ext = true; else return false; return true; @@ -772,7 +777,8 @@ riscv_disassemble_insn (bfd_vma memaddr, if ((op->xlen_requirement != 0) && (op->xlen_requirement != xlen)) continue; /* Is this instruction supported by the current architecture? */ - if (!riscv_multi_subset_supports (&riscv_rps_dis, op->insn_class)) + if (!all_ext + && !riscv_multi_subset_supports (&riscv_rps_dis, op->insn_class)) continue; /* It's a match. */ -- 2.39.3 (Apple Git-145)