RISC-V: Add 'Ssstateen' extension and its CSRs
authorTsukasa OI <research_trasio@irq.a4lg.com>
Mon, 24 Oct 2022 10:08:15 +0000 (10:08 +0000)
committerTsukasa OI <research_trasio@irq.a4lg.com>
Sat, 19 Nov 2022 02:57:05 +0000 (02:57 +0000)
commit15253318be0995200cc59929ca32eedbfd041e45
treec17c4334f5d2922430e190eced4626ccca97d40a
parent84bcca538dd74e82bfb7cfde37003d384b3f5daa
RISC-V: Add 'Ssstateen' extension and its CSRs

This commit adds 'Ssstateen' extension, which is a supervisor-visible view
of the 'Smstateen' extension.  It means, this extension implements sstateen*
and hstateen* CSRs of the 'Smstateen' extension.

Note that 'Smstateen' extension itself is unchanged but due to
implementation simplicity, it is implemented so that 'Smstateen' implies
'Ssstateen' (just like 'M' implies 'Zmmul').

This is based on the latest version of RISC-V Profiles
(version 0.9-draft, Frozen):
<https://github.com/riscv/riscv-profiles/commit/226b7f643067b29abc6723fac60d5f6d3f9eb901>

bfd/ChangeLog:

* elfxx-riscv.c (riscv_implicit_subsets): Update implication rules.
(riscv_supported_std_s_ext) Add 'Ssstateen' extension.

gas/ChangeLog:

* config/tc-riscv.c (enum riscv_csr_class): Rename
CSR_CLASS_SMSTATEEN_AND_H{,_32} to CSR_CLASS_SSSTATEEN_...
Add CSR_CLASS_SSSTATEEN.
(riscv_csr_address): Support new/renamed CSR classes.
* testsuite/gas/riscv/csr.s: Add 'Ssstateen' extension to comment.
* testsuite/gas/riscv/csr-version-1p9p1.l: Reflect changes to
error messages.
* testsuite/gas/riscv/csr-version-1p10.l: Likewise.
* testsuite/gas/riscv/csr-version-1p11.l: Likewise.
* testsuite/gas/riscv/csr-version-1p12.l: Likewise.
* testsuite/gas/riscv/ssstateen-csr.s: Test for 'Ssstateen' CSRs.
* testsuite/gas/riscv/ssstateen-csr.d: Likewise.
* testsuite/gas/riscv/smstateen-csr-s.d: Test to make sure that
supervisor/hypervisor part of 'Smstateen' CSRs are accessible from
'RV32IH_Smstateen', not just from 'RV32IH_Ssstateen' that is tested
in ssstateen-csr.d.

include/ChangeLog:

* opcode/riscv-opc.h: Update DECLARE_CSR declarations with
new CSR classes.
bfd/elfxx-riscv.c
gas/config/tc-riscv.c
gas/testsuite/gas/riscv/csr-version-1p10.l
gas/testsuite/gas/riscv/csr-version-1p11.l
gas/testsuite/gas/riscv/csr-version-1p12.l
gas/testsuite/gas/riscv/csr-version-1p9p1.l
gas/testsuite/gas/riscv/csr.s
gas/testsuite/gas/riscv/smstateen-csr-s.d [new file with mode: 0644]
gas/testsuite/gas/riscv/ssstateen-csr.d [new file with mode: 0644]
gas/testsuite/gas/riscv/ssstateen-csr.s [new file with mode: 0644]
include/opcode/riscv-opc.h