Skip to content

Commit 004a5bf

Browse files
author
Nelson Chu
committed
RISC-V: Dump instruction without checking architecture support as usual.
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. binutils/ * NEWS: Updated.
1 parent 4868f60 commit 004a5bf

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

binutils/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
-*- text -*-
22

3+
* RISC-V disassembly now supports -M,max option like QEMU to dump instruction
4+
without checking architecture support as usual.
5+
36
Changes in 2.43:
47

58
* The MIPS port now supports microMIPS MT Application Specific Extension

opcodes/riscv-dis.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ static const char (*riscv_fpr_names)[NRC];
8080
/* If set, disassemble as most general instruction. */
8181
static bool no_aliases = false;
8282

83+
/* If set, disassemble without checking architectire string, just like what
84+
we did at the beginning. */
85+
static bool all_ext = false;
8386

8487
/* Set default RISC-V disassembler options. */
8588

@@ -103,6 +106,8 @@ parse_riscv_dis_option_without_args (const char *option)
103106
riscv_gpr_names = riscv_gpr_names_numeric;
104107
riscv_fpr_names = riscv_fpr_names_numeric;
105108
}
109+
else if (strcmp (option, "max") == 0)
110+
all_ext = true;
106111
else
107112
return false;
108113
return true;
@@ -968,7 +973,8 @@ riscv_disassemble_insn (bfd_vma memaddr,
968973
if ((op->xlen_requirement != 0) && (op->xlen_requirement != xlen))
969974
continue;
970975
/* Is this instruction supported by the current architecture? */
971-
if (!riscv_multi_subset_supports (&riscv_rps_dis, op->insn_class))
976+
if (!all_ext
977+
&& !riscv_multi_subset_supports (&riscv_rps_dis, op->insn_class))
972978
continue;
973979

974980
/* It's a match. */

0 commit comments

Comments
 (0)