mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-09 04:21:49 +08:00
bd0cf5a6ba
According to the riscv privilege spec, some CSR are only valid when rv32 or the specific extension is set. We extend the DECLARE_CSR and DECLARE_CSR_ALIAS to record more informaton we need, and then check whether the CSR is valid according to these information. We report warning message when the CSR is invalid, so we have a choice between error and warning by --fatal-warnings option. Also, a --no-warn/-W option is used to turn the warnings off, if people don't want the warnings. gas/ * config/tc-riscv.c (enum riscv_csr_class): New enum. Used to decide whether or not this CSR is legal in the current ISA string. (struct riscv_csr_extra): New structure to hold all extra information of CSR. (riscv_init_csr_hash): New function. According to the DECLARE_CSR and DECLARE_CSR_ALIAS, insert CSR extra information into csr_extra_hash. Call hash_reg_name to insert CSR address into reg_names_hash. (md_begin): Call riscv_init_csr_hashes for each DECLARE_CSR. (reg_csr_lookup_internal, riscv_csr_class_check): New functions. Decide whether the CSR is valid according to the csr_extra_hash. (init_opcode_hash): Update 'if (hash_error != NULL)' as hash_error is not a boolean. This is same as riscv_init_csr_hash, so keep the consistent usage. * testsuite/gas/riscv/csr-dw-regnums.d: Add -march=rv32if option. * testsuite/gas/riscv/priv-reg.d: Add f-ext by -march option. * testsuite/gas/riscv/priv-reg-fail-fext.d: New testcase. The source file is `priv-reg.s`, and the ISA is rv32i without f-ext, so the f-ext CSR are not allowed. * testsuite/gas/riscv/priv-reg-fail-fext.l: Likewise. * testsuite/gas/riscv/priv-reg-fail-rv32-only.d: New testcase. The source file is `priv-reg.s`, and the ISA is rv64if, so the rv32-only CSR are not allowed. * testsuite/gas/riscv/priv-reg-fail-rv32-only.l: Likewise. include/ * opcode/riscv-opc.h: Extend DECLARE_CSR and DECLARE_CSR_ALIAS to record riscv_csr_class. opcodes/ * riscv-dis.c (print_insn_args): Updated since the DECLARE_CSR is changed. gdb/ * riscv-tdep.c: Updated since the DECLARE_CSR is changed. * riscv-tdep.h: Likewise. * features/riscv/rebuild-csr-xml.sh: Generate the 64bit-csr.xml without rv32-only CSR. * features/riscv/64bit-csr.xml: Regernated. binutils/ * dwarf.c: Updated since the DECLARE_CSR is changed. |
||
---|---|---|
.. | ||
arm | ||
i386 | ||
riscv | ||
rs6000 | ||
sparc | ||
aarch64-core.c | ||
aarch64-core.xml | ||
aarch64-fpu.c | ||
aarch64-fpu.xml | ||
aarch64-pauth.c | ||
aarch64-pauth.xml | ||
aarch64-sve.c | ||
arc-arcompact.c | ||
arc-arcompact.xml | ||
arc-v2.c | ||
arc-v2.xml | ||
btrace-conf.dtd | ||
btrace.dtd | ||
feature_to_c.sh | ||
gdb-target.dtd | ||
gdbserver-regs.xsl | ||
library-list-aix.dtd | ||
library-list-svr4.dtd | ||
library-list.dtd | ||
m68k-core.xml | ||
Makefile | ||
microblaze-core.xml | ||
microblaze-stack-protect.xml | ||
microblaze-with-stack-protect.c | ||
microblaze-with-stack-protect.xml | ||
microblaze.c | ||
microblaze.xml | ||
mips64-cp0.xml | ||
mips64-cpu.xml | ||
mips64-dsp-linux.c | ||
mips64-dsp-linux.xml | ||
mips64-dsp.xml | ||
mips64-fpu.xml | ||
mips64-linux.c | ||
mips64-linux.xml | ||
mips-cp0.xml | ||
mips-cpu.xml | ||
mips-dsp-linux.c | ||
mips-dsp-linux.xml | ||
mips-dsp.xml | ||
mips-fpu.xml | ||
mips-linux.c | ||
mips-linux.xml | ||
nds32-core.xml | ||
nds32-fpu.xml | ||
nds32-system.xml | ||
nds32.c | ||
nds32.xml | ||
nios2-cpu.xml | ||
nios2-linux.xml | ||
nios2.c | ||
nios2.xml | ||
number-regs.xsl | ||
or1k-core.xml | ||
or1k.c | ||
or1k.xml | ||
osdata.dtd | ||
rx.c | ||
rx.xml | ||
s390-acr.xml | ||
s390-core32.xml | ||
s390-core64.xml | ||
s390-fpr.xml | ||
s390-gs-linux64.c | ||
s390-gs-linux64.xml | ||
s390-gs.xml | ||
s390-gsbc.xml | ||
s390-linux32.c | ||
s390-linux32.xml | ||
s390-linux32v1.c | ||
s390-linux32v1.xml | ||
s390-linux32v2.c | ||
s390-linux32v2.xml | ||
s390-linux64.c | ||
s390-linux64.xml | ||
s390-linux64v1.c | ||
s390-linux64v1.xml | ||
s390-linux64v2.c | ||
s390-linux64v2.xml | ||
s390-tdb.xml | ||
s390-te-linux64.c | ||
s390-te-linux64.xml | ||
s390-tevx-linux64.c | ||
s390-tevx-linux64.xml | ||
s390-vx-linux64.c | ||
s390-vx-linux64.xml | ||
s390-vx.xml | ||
s390x-core64.xml | ||
s390x-gs-linux64.c | ||
s390x-gs-linux64.xml | ||
s390x-linux64.c | ||
s390x-linux64.xml | ||
s390x-linux64v1.c | ||
s390x-linux64v1.xml | ||
s390x-linux64v2.c | ||
s390x-linux64v2.xml | ||
s390x-te-linux64.c | ||
s390x-te-linux64.xml | ||
s390x-tevx-linux64.c | ||
s390x-tevx-linux64.xml | ||
s390x-vx-linux64.c | ||
s390x-vx-linux64.xml | ||
sort-regs.xsl | ||
threads.dtd | ||
tic6x-c6xp.c | ||
tic6x-c6xp.xml | ||
tic6x-c62x-linux.xml | ||
tic6x-c64x-linux.xml | ||
tic6x-c64xp-linux.xml | ||
tic6x-core.c | ||
tic6x-core.xml | ||
tic6x-gp.c | ||
tic6x-gp.xml | ||
traceframe-info.dtd | ||
xinclude.dtd |