From patchwork Fri Oct 27 00:39:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nelson Chu X-Patchwork-Id: 158717 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp266267vqb; Thu, 26 Oct 2023 17:39:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFY1kH9obKXEr4CFD+feDSFeLcspoI4si8KIM44RXiHlB1pmpBFN/wlqlbg69M6HIKkVjOC X-Received: by 2002:a05:6214:76d:b0:65d:6a5:1a3f with SMTP id f13-20020a056214076d00b0065d06a51a3fmr1515116qvz.43.1698367167670; Thu, 26 Oct 2023 17:39:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698367167; cv=pass; d=google.com; s=arc-20160816; b=rRoI2fxIwZvL42O6dCcT37Ww62Swesk18CEuVoAviVIORZkTOAMIWPWKrLn5g7HjGK UIPk+LbY6k3+scUpXZ3XI8PTOr34NC2NHtYiCrmirxN7S+wvA8UoFZB+8uvDqmT0jxAn h0uINjZMSfV9MzLahkw+IkScBO9GA27XifWjeYprnYjIfN0VIzR0AlGYZXw212Y6lb63 zvcCM1XTttvesk/Nl2huDHqfPlcZu0CmALxWKDtYngdn5xAz53BssJjPtZH+5qSOr0hD 8wMOriGIbomaG60NJT/wCpKJhcMcazv+h1CBMkcJPnE9ukIpXMsnnRyfbRTJRc64zu1d huJw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:arc-filter :dmarc-filter:delivered-to; bh=NMHGwGWdJqCllNqv/GTnUrMxU7mGBJOEkiDyJob4SM8=; fh=zGVoguJjwP065RYyZrI5mkAkjrbFw3u8SkVsX+sk4dE=; b=iKIgi8QAe6oLDXw42G12Xj3GLWdrVrm2N47ncfz66ZR8PP6IAMx1TJQu9dyTxMbilA 26BJQ9iQSyKsAdiPScjsUqVYaxF3eCTPZF1Tv98iTi5bblEdj2RrmVcSn8ucZPcsBzRH PcqwxrMhwKsprMRRvhQbTvkLH6zKbccOiZlnWL7igUWqtd8IbVDmlBB0JWJU55JkxOZy EJ4DEG87SjZdhBHfxzbEMaWjmtDEsGpQ+JxYlpDb0LBlM9J+nlW0ecBjXSNBAZsapwdM Jqz13fUybGqXUoKQJAL/oHLxFQptQRcJ0rfCQO2Kj6XQ7/aGIEw1EfXCWlyW3TFidUed tGDA== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id i4-20020ad45c64000000b0066d1e8d7d73si327925qvh.20.2023.10.26.17.39.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 17:39:27 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 70B863857707 for ; Fri, 27 Oct 2023 00:39:27 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org 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 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 X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780867051358575460 X-GMAIL-MSGID: 1780867051358575460 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. */