diff options
author | Tsukasa OI <research_trasio@irq.a4lg.com> | 2022-10-24 10:08:15 +0000 |
---|---|---|
committer | Tsukasa OI <research_trasio@irq.a4lg.com> | 2022-11-19 02:57:05 +0000 |
commit | 15253318be0995200cc59929ca32eedbfd041e45 (patch) | |
tree | c17c4334f5d2922430e190eced4626ccca97d40a | |
parent | 84bcca538dd74e82bfb7cfde37003d384b3f5daa (diff) | |
download | gdb-15253318be0995200cc59929ca32eedbfd041e45.zip gdb-15253318be0995200cc59929ca32eedbfd041e45.tar.gz gdb-15253318be0995200cc59929ca32eedbfd041e45.tar.bz2 |
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.
-rw-r--r-- | bfd/elfxx-riscv.c | 4 | ||||
-rw-r--r-- | gas/config/tc-riscv.c | 20 | ||||
-rw-r--r-- | gas/testsuite/gas/riscv/csr-version-1p10.l | 48 | ||||
-rw-r--r-- | gas/testsuite/gas/riscv/csr-version-1p11.l | 48 | ||||
-rw-r--r-- | gas/testsuite/gas/riscv/csr-version-1p12.l | 48 | ||||
-rw-r--r-- | gas/testsuite/gas/riscv/csr-version-1p9p1.l | 48 | ||||
-rw-r--r-- | gas/testsuite/gas/riscv/csr.s | 2 | ||||
-rw-r--r-- | gas/testsuite/gas/riscv/smstateen-csr-s.d | 22 | ||||
-rw-r--r-- | gas/testsuite/gas/riscv/ssstateen-csr.d | 22 | ||||
-rw-r--r-- | gas/testsuite/gas/riscv/ssstateen-csr.s | 13 | ||||
-rw-r--r-- | include/opcode/riscv-opc.h | 26 |
11 files changed, 182 insertions, 119 deletions
diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c index cfec9a6..afbde56 100644 --- a/bfd/elfxx-riscv.c +++ b/bfd/elfxx-riscv.c @@ -1097,9 +1097,10 @@ static struct riscv_implicit_subset riscv_implicit_subsets[] = {"zks", "zbkx", check_implicit_always}, {"zks", "zksed", check_implicit_always}, {"zks", "zksh", check_implicit_always}, + {"smstateen", "ssstateen", check_implicit_always}, {"smepmp", "zicsr", check_implicit_always}, - {"smstateen", "zicsr", check_implicit_always}, {"sscofpmf", "zicsr", check_implicit_always}, + {"ssstateen", "zicsr", check_implicit_always}, {"sstc", "zicsr", check_implicit_always}, {NULL, NULL, NULL} }; @@ -1219,6 +1220,7 @@ static struct riscv_supported_ext riscv_supported_std_s_ext[] = {"smepmp", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, {"smstateen", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, {"sscofpmf", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, + {"ssstateen", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, {"sstc", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, {"svinval", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, {"svnapot", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c index 2dc92ec..0195451 100644 --- a/gas/config/tc-riscv.c +++ b/gas/config/tc-riscv.c @@ -69,9 +69,10 @@ enum riscv_csr_class CSR_CLASS_H, /* hypervisor */ CSR_CLASS_H_32, /* hypervisor, rv32 only */ CSR_CLASS_SMSTATEEN, /* Smstateen only */ - CSR_CLASS_SMSTATEEN_AND_H, /* Smstateen only (with H) */ CSR_CLASS_SMSTATEEN_32, /* Smstateen RV32 only */ - CSR_CLASS_SMSTATEEN_AND_H_32, /* Smstateen RV32 only (with H) */ + CSR_CLASS_SSSTATEEN, /* S[ms]stateen only */ + CSR_CLASS_SSSTATEEN_AND_H, /* S[ms]stateen only (with H) */ + CSR_CLASS_SSSTATEEN_AND_H_32, /* S[ms]stateen RV32 only (with H) */ CSR_CLASS_SSCOFPMF, /* Sscofpmf only */ CSR_CLASS_SSCOFPMF_32, /* Sscofpmf RV32 only */ CSR_CLASS_SSTC, /* Sstc only */ @@ -1029,15 +1030,18 @@ riscv_csr_address (const char *csr_name, extension = "zve32x"; break; case CSR_CLASS_SMSTATEEN: - case CSR_CLASS_SMSTATEEN_AND_H: case CSR_CLASS_SMSTATEEN_32: - case CSR_CLASS_SMSTATEEN_AND_H_32: - is_rv32_only = (csr_class == CSR_CLASS_SMSTATEEN_32 - || csr_class == CSR_CLASS_SMSTATEEN_AND_H_32); - is_h_required = (csr_class == CSR_CLASS_SMSTATEEN_AND_H - || csr_class == CSR_CLASS_SMSTATEEN_AND_H_32); + is_rv32_only = (csr_class == CSR_CLASS_SMSTATEEN_32); extension = "smstateen"; break; + case CSR_CLASS_SSSTATEEN: + case CSR_CLASS_SSSTATEEN_AND_H: + case CSR_CLASS_SSSTATEEN_AND_H_32: + is_rv32_only = (csr_class == CSR_CLASS_SSSTATEEN_AND_H_32); + is_h_required = (csr_class == CSR_CLASS_SSSTATEEN_AND_H + || csr_class == CSR_CLASS_SSSTATEEN_AND_H_32); + extension = "ssstateen"; + break; case CSR_CLASS_SSCOFPMF_32: is_rv32_only = true; /* Fall through. */ diff --git a/gas/testsuite/gas/riscv/csr-version-1p10.l b/gas/testsuite/gas/riscv/csr-version-1p10.l index 999e9af..03af32d 100644 --- a/gas/testsuite/gas/riscv/csr-version-1p10.l +++ b/gas/testsuite/gas/riscv/csr-version-1p10.l @@ -419,30 +419,30 @@ .*Warning: invalid CSR `mstateen2', needs `smstateen' extension .*Warning: invalid CSR `mstateen3', needs `smstateen' extension .*Warning: invalid CSR `mstateen3', needs `smstateen' extension -.*Warning: invalid CSR `sstateen0', needs `smstateen' extension -.*Warning: invalid CSR `sstateen0', needs `smstateen' extension -.*Warning: invalid CSR `sstateen1', needs `smstateen' extension -.*Warning: invalid CSR `sstateen1', needs `smstateen' extension -.*Warning: invalid CSR `sstateen2', needs `smstateen' extension -.*Warning: invalid CSR `sstateen2', needs `smstateen' extension -.*Warning: invalid CSR `sstateen3', needs `smstateen' extension -.*Warning: invalid CSR `sstateen3', needs `smstateen' extension +.*Warning: invalid CSR `sstateen0', needs `ssstateen' extension +.*Warning: invalid CSR `sstateen0', needs `ssstateen' extension +.*Warning: invalid CSR `sstateen1', needs `ssstateen' extension +.*Warning: invalid CSR `sstateen1', needs `ssstateen' extension +.*Warning: invalid CSR `sstateen2', needs `ssstateen' extension +.*Warning: invalid CSR `sstateen2', needs `ssstateen' extension +.*Warning: invalid CSR `sstateen3', needs `ssstateen' extension +.*Warning: invalid CSR `sstateen3', needs `ssstateen' extension .*Warning: invalid CSR `hstateen0', needs `h' extension -.*Warning: invalid CSR `hstateen0', needs `smstateen' extension +.*Warning: invalid CSR `hstateen0', needs `ssstateen' extension .*Warning: invalid CSR `hstateen0', needs `h' extension -.*Warning: invalid CSR `hstateen0', needs `smstateen' extension +.*Warning: invalid CSR `hstateen0', needs `ssstateen' extension .*Warning: invalid CSR `hstateen1', needs `h' extension -.*Warning: invalid CSR `hstateen1', needs `smstateen' extension +.*Warning: invalid CSR `hstateen1', needs `ssstateen' extension .*Warning: invalid CSR `hstateen1', needs `h' extension -.*Warning: invalid CSR `hstateen1', needs `smstateen' extension +.*Warning: invalid CSR `hstateen1', needs `ssstateen' extension .*Warning: invalid CSR `hstateen2', needs `h' extension -.*Warning: invalid CSR `hstateen2', needs `smstateen' extension +.*Warning: invalid CSR `hstateen2', needs `ssstateen' extension .*Warning: invalid CSR `hstateen2', needs `h' extension -.*Warning: invalid CSR `hstateen2', needs `smstateen' extension +.*Warning: invalid CSR `hstateen2', needs `ssstateen' extension .*Warning: invalid CSR `hstateen3', needs `h' extension -.*Warning: invalid CSR `hstateen3', needs `smstateen' extension +.*Warning: invalid CSR `hstateen3', needs `ssstateen' extension .*Warning: invalid CSR `hstateen3', needs `h' extension -.*Warning: invalid CSR `hstateen3', needs `smstateen' extension +.*Warning: invalid CSR `hstateen3', needs `ssstateen' extension .*Warning: invalid CSR `mstateen0h', needs rv32i extension .*Warning: invalid CSR `mstateen0h', needs `smstateen' extension .*Warning: invalid CSR `mstateen0h', needs rv32i extension @@ -461,28 +461,28 @@ .*Warning: invalid CSR `mstateen3h', needs `smstateen' extension .*Warning: invalid CSR `hstateen0h', needs rv32i extension .*Warning: invalid CSR `hstateen0h', needs `h' extension -.*Warning: invalid CSR `hstateen0h', needs `smstateen' extension +.*Warning: invalid CSR `hstateen0h', needs `ssstateen' extension .*Warning: invalid CSR `hstateen0h', needs rv32i extension .*Warning: invalid CSR `hstateen0h', needs `h' extension -.*Warning: invalid CSR `hstateen0h', needs `smstateen' extension +.*Warning: invalid CSR `hstateen0h', needs `ssstateen' extension .*Warning: invalid CSR `hstateen1h', needs rv32i extension .*Warning: invalid CSR `hstateen1h', needs `h' extension -.*Warning: invalid CSR `hstateen1h', needs `smstateen' extension +.*Warning: invalid CSR `hstateen1h', needs `ssstateen' extension .*Warning: invalid CSR `hstateen1h', needs rv32i extension .*Warning: invalid CSR `hstateen1h', needs `h' extension -.*Warning: invalid CSR `hstateen1h', needs `smstateen' extension +.*Warning: invalid CSR `hstateen1h', needs `ssstateen' extension .*Warning: invalid CSR `hstateen2h', needs rv32i extension .*Warning: invalid CSR `hstateen2h', needs `h' extension -.*Warning: invalid CSR `hstateen2h', needs `smstateen' extension +.*Warning: invalid CSR `hstateen2h', needs `ssstateen' extension .*Warning: invalid CSR `hstateen2h', needs rv32i extension .*Warning: invalid CSR `hstateen2h', needs `h' extension -.*Warning: invalid CSR `hstateen2h', needs `smstateen' extension +.*Warning: invalid CSR `hstateen2h', needs `ssstateen' extension .*Warning: invalid CSR `hstateen3h', needs rv32i extension .*Warning: invalid CSR `hstateen3h', needs `h' extension -.*Warning: invalid CSR `hstateen3h', needs `smstateen' extension +.*Warning: invalid CSR `hstateen3h', needs `ssstateen' extension .*Warning: invalid CSR `hstateen3h', needs rv32i extension .*Warning: invalid CSR `hstateen3h', needs `h' extension -.*Warning: invalid CSR `hstateen3h', needs `smstateen' extension +.*Warning: invalid CSR `hstateen3h', needs `ssstateen' extension .*Warning: invalid CSR `scountovf', needs `sscofpmf' extension .*Warning: invalid CSR `scountovf', needs `sscofpmf' extension .*Warning: read-only CSR is written `csrw scountovf,a1' diff --git a/gas/testsuite/gas/riscv/csr-version-1p11.l b/gas/testsuite/gas/riscv/csr-version-1p11.l index a099e4e..0766c22 100644 --- a/gas/testsuite/gas/riscv/csr-version-1p11.l +++ b/gas/testsuite/gas/riscv/csr-version-1p11.l @@ -417,30 +417,30 @@ .*Warning: invalid CSR `mstateen2', needs `smstateen' extension .*Warning: invalid CSR `mstateen3', needs `smstateen' extension .*Warning: invalid CSR `mstateen3', needs `smstateen' extension -.*Warning: invalid CSR `sstateen0', needs `smstateen' extension -.*Warning: invalid CSR `sstateen0', needs `smstateen' extension -.*Warning: invalid CSR `sstateen1', needs `smstateen' extension -.*Warning: invalid CSR `sstateen1', needs `smstateen' extension -.*Warning: invalid CSR `sstateen2', needs `smstateen' extension -.*Warning: invalid CSR `sstateen2', needs `smstateen' extension -.*Warning: invalid CSR `sstateen3', needs `smstateen' extension -.*Warning: invalid CSR `sstateen3', needs `smstateen' extension +.*Warning: invalid CSR `sstateen0', needs `ssstateen' extension +.*Warning: invalid CSR `sstateen0', needs `ssstateen' extension +.*Warning: invalid CSR `sstateen1', needs `ssstateen' extension +.*Warning: invalid CSR `sstateen1', needs `ssstateen' extension +.*Warning: invalid CSR `sstateen2', needs `ssstateen' extension +.*Warning: invalid CSR `sstateen2', needs `ssstateen' extension +.*Warning: invalid CSR `sstateen3', needs `ssstateen' extension +.*Warning: invalid CSR `sstateen3', needs `ssstateen' extension .*Warning: invalid CSR `hstateen0', needs `h' extension -.*Warning: invalid CSR `hstateen0', needs `smstateen' extension +.*Warning: invalid CSR `hstateen0', needs `ssstateen' extension .*Warning: invalid CSR `hstateen0', needs `h' extension -.*Warning: invalid CSR `hstateen0', needs `smstateen' extension +.*Warning: invalid CSR `hstateen0', needs `ssstateen' extension .*Warning: invalid CSR `hstateen1', needs `h' extension -.*Warning: invalid CSR `hstateen1', needs `smstateen' extension +.*Warning: invalid CSR `hstateen1', needs `ssstateen' extension .*Warning: invalid CSR `hstateen1', needs `h' extension -.*Warning: invalid CSR `hstateen1', needs `smstateen' extension +.*Warning: invalid CSR `hstateen1', needs `ssstateen' extension .*Warning: invalid CSR `hstateen2', needs `h' extension -.*Warning: invalid CSR `hstateen2', needs `smstateen' extension +.*Warning: invalid CSR `hstateen2', needs `ssstateen' extension .*Warning: invalid CSR `hstateen2', needs `h' extension -.*Warning: invalid CSR `hstateen2', needs `smstateen' extension +.*Warning: invalid CSR `hstateen2', needs `ssstateen' extension .*Warning: invalid CSR `hstateen3', needs `h' extension -.*Warning: invalid CSR `hstateen3', needs `smstateen' extension +.*Warning: invalid CSR `hstateen3', needs `ssstateen' extension .*Warning: invalid CSR `hstateen3', needs `h' extension -.*Warning: invalid CSR `hstateen3', needs `smstateen' extension +.*Warning: invalid CSR `hstateen3', needs `ssstateen' extension .*Warning: invalid CSR `mstateen0h', needs rv32i extension .*Warning: invalid CSR `mstateen0h', needs `smstateen' extension .*Warning: invalid CSR `mstateen0h', needs rv32i extension @@ -459,28 +459,28 @@ .*Warning: invalid CSR `mstateen3h', needs `smstateen' extension .*Warning: invalid CSR `hstateen0h', needs rv32i extension .*Warning: invalid CSR `hstateen0h', needs `h' extension -.*Warning: invalid CSR `hstateen0h', needs `smstateen' extension +.*Warning: invalid CSR `hstateen0h', needs `ssstateen' extension .*Warning: invalid CSR `hstateen0h', needs rv32i extension .*Warning: invalid CSR `hstateen0h', needs `h' extension -.*Warning: invalid CSR `hstateen0h', needs `smstateen' extension +.*Warning: invalid CSR `hstateen0h', needs `ssstateen' extension .*Warning: invalid CSR `hstateen1h', needs rv32i extension .*Warning: invalid CSR `hstateen1h', needs `h' extension -.*Warning: invalid CSR `hstateen1h', needs `smstateen' extension +.*Warning: invalid CSR `hstateen1h', needs `ssstateen' extension .*Warning: invalid CSR `hstateen1h', needs rv32i extension .*Warning: invalid CSR `hstateen1h', needs `h' extension -.*Warning: invalid CSR `hstateen1h', needs `smstateen' extension +.*Warning: invalid CSR `hstateen1h', needs `ssstateen' extension .*Warning: invalid CSR `hstateen2h', needs rv32i extension .*Warning: invalid CSR `hstateen2h', needs `h' extension -.*Warning: invalid CSR `hstateen2h', needs `smstateen' extension +.*Warning: invalid CSR `hstateen2h', needs `ssstateen' extension .*Warning: invalid CSR `hstateen2h', needs rv32i extension .*Warning: invalid CSR `hstateen2h', needs `h' extension -.*Warning: invalid CSR `hstateen2h', needs `smstateen' extension +.*Warning: invalid CSR `hstateen2h', needs `ssstateen' extension .*Warning: invalid CSR `hstateen3h', needs rv32i extension .*Warning: invalid CSR `hstateen3h', needs `h' extension -.*Warning: invalid CSR `hstateen3h', needs `smstateen' extension +.*Warning: invalid CSR `hstateen3h', needs `ssstateen' extension .*Warning: invalid CSR `hstateen3h', needs rv32i extension .*Warning: invalid CSR `hstateen3h', needs `h' extension -.*Warning: invalid CSR `hstateen3h', needs `smstateen' extension +.*Warning: invalid CSR `hstateen3h', needs `ssstateen' extension .*Warning: invalid CSR `scountovf', needs `sscofpmf' extension .*Warning: invalid CSR `scountovf', needs `sscofpmf' extension .*Warning: read-only CSR is written `csrw scountovf,a1' diff --git a/gas/testsuite/gas/riscv/csr-version-1p12.l b/gas/testsuite/gas/riscv/csr-version-1p12.l index cf8f2e2..c13efcc 100644 --- a/gas/testsuite/gas/riscv/csr-version-1p12.l +++ b/gas/testsuite/gas/riscv/csr-version-1p12.l @@ -279,30 +279,30 @@ .*Warning: invalid CSR `mstateen2', needs `smstateen' extension .*Warning: invalid CSR `mstateen3', needs `smstateen' extension .*Warning: invalid CSR `mstateen3', needs `smstateen' extension -.*Warning: invalid CSR `sstateen0', needs `smstateen' extension -.*Warning: invalid CSR `sstateen0', needs `smstateen' extension -.*Warning: invalid CSR `sstateen1', needs `smstateen' extension -.*Warning: invalid CSR `sstateen1', needs `smstateen' extension -.*Warning: invalid CSR `sstateen2', needs `smstateen' extension -.*Warning: invalid CSR `sstateen2', needs `smstateen' extension -.*Warning: invalid CSR `sstateen3', needs `smstateen' extension -.*Warning: invalid CSR `sstateen3', needs `smstateen' extension +.*Warning: invalid CSR `sstateen0', needs `ssstateen' extension +.*Warning: invalid CSR `sstateen0', needs `ssstateen' extension +.*Warning: invalid CSR `sstateen1', needs `ssstateen' extension +.*Warning: invalid CSR `sstateen1', needs `ssstateen' extension +.*Warning: invalid CSR `sstateen2', needs `ssstateen' extension +.*Warning: invalid CSR `sstateen2', needs `ssstateen' extension +.*Warning: invalid CSR `sstateen3', needs `ssstateen' extension +.*Warning: invalid CSR `sstateen3', needs `ssstateen' extension .*Warning: invalid CSR `hstateen0', needs `h' extension -.*Warning: invalid CSR `hstateen0', needs `smstateen' extension +.*Warning: invalid CSR `hstateen0', needs `ssstateen' extension .*Warning: invalid CSR `hstateen0', needs `h' extension -.*Warning: invalid CSR `hstateen0', needs `smstateen' extension +.*Warning: invalid CSR `hstateen0', needs `ssstateen' extension .*Warning: invalid CSR `hstateen1', needs `h' extension -.*Warning: invalid CSR `hstateen1', needs `smstateen' extension +.*Warning: invalid CSR `hstateen1', needs `ssstateen' extension .*Warning: invalid CSR `hstateen1', needs `h' extension -.*Warning: invalid CSR `hstateen1', needs `smstateen' extension +.*Warning: invalid CSR `hstateen1', needs `ssstateen' extension .*Warning: invalid CSR `hstateen2', needs `h' extension -.*Warning: invalid CSR `hstateen2', needs `smstateen' extension +.*Warning: invalid CSR `hstateen2', needs `ssstateen' extension .*Warning: invalid CSR `hstateen2', needs `h' extension -.*Warning: invalid CSR `hstateen2', needs `smstateen' extension +.*Warning: invalid CSR `hstateen2', needs `ssstateen' extension .*Warning: invalid CSR `hstateen3', needs `h' extension -.*Warning: invalid CSR `hstateen3', needs `smstateen' extension +.*Warning: invalid CSR `hstateen3', needs `ssstateen' extension .*Warning: invalid CSR `hstateen3', needs `h' extension -.*Warning: invalid CSR `hstateen3', needs `smstateen' extension +.*Warning: invalid CSR `hstateen3', needs `ssstateen' extension .*Warning: invalid CSR `mstateen0h', needs rv32i extension .*Warning: invalid CSR `mstateen0h', needs `smstateen' extension .*Warning: invalid CSR `mstateen0h', needs rv32i extension @@ -321,28 +321,28 @@ .*Warning: invalid CSR `mstateen3h', needs `smstateen' extension .*Warning: invalid CSR `hstateen0h', needs rv32i extension .*Warning: invalid CSR `hstateen0h', needs `h' extension -.*Warning: invalid CSR `hstateen0h', needs `smstateen' extension +.*Warning: invalid CSR `hstateen0h', needs `ssstateen' extension .*Warning: invalid CSR `hstateen0h', needs rv32i extension .*Warning: invalid CSR `hstateen0h', needs `h' extension -.*Warning: invalid CSR `hstateen0h', needs `smstateen' extension +.*Warning: invalid CSR `hstateen0h', needs `ssstateen' extension .*Warning: invalid CSR `hstateen1h', needs rv32i extension .*Warning: invalid CSR `hstateen1h', needs `h' extension -.*Warning: invalid CSR `hstateen1h', needs `smstateen' extension +.*Warning: invalid CSR `hstateen1h', needs `ssstateen' extension .*Warning: invalid CSR `hstateen1h', needs rv32i extension .*Warning: invalid CSR `hstateen1h', needs `h' extension -.*Warning: invalid CSR `hstateen1h', needs `smstateen' extension +.*Warning: invalid CSR `hstateen1h', needs `ssstateen' extension .*Warning: invalid CSR `hstateen2h', needs rv32i extension .*Warning: invalid CSR `hstateen2h', needs `h' extension -.*Warning: invalid CSR `hstateen2h', needs `smstateen' extension +.*Warning: invalid CSR `hstateen2h', needs `ssstateen' extension .*Warning: invalid CSR `hstateen2h', needs rv32i extension .*Warning: invalid CSR `hstateen2h', needs `h' extension -.*Warning: invalid CSR `hstateen2h', needs `smstateen' extension +.*Warning: invalid CSR `hstateen2h', needs `ssstateen' extension .*Warning: invalid CSR `hstateen3h', needs rv32i extension .*Warning: invalid CSR `hstateen3h', needs `h' extension -.*Warning: invalid CSR `hstateen3h', needs `smstateen' extension +.*Warning: invalid CSR `hstateen3h', needs `ssstateen' extension .*Warning: invalid CSR `hstateen3h', needs rv32i extension .*Warning: invalid CSR `hstateen3h', needs `h' extension -.*Warning: invalid CSR `hstateen3h', needs `smstateen' extension +.*Warning: invalid CSR `hstateen3h', needs `ssstateen' extension .*Warning: invalid CSR `scountovf', needs `sscofpmf' extension .*Warning: invalid CSR `scountovf', needs `sscofpmf' extension .*Warning: read-only CSR is written `csrw scountovf,a1' diff --git a/gas/testsuite/gas/riscv/csr-version-1p9p1.l b/gas/testsuite/gas/riscv/csr-version-1p9p1.l index 5f298c1..bc35630 100644 --- a/gas/testsuite/gas/riscv/csr-version-1p9p1.l +++ b/gas/testsuite/gas/riscv/csr-version-1p9p1.l @@ -469,30 +469,30 @@ .*Warning: invalid CSR `mstateen2', needs `smstateen' extension .*Warning: invalid CSR `mstateen3', needs `smstateen' extension .*Warning: invalid CSR `mstateen3', needs `smstateen' extension -.*Warning: invalid CSR `sstateen0', needs `smstateen' extension -.*Warning: invalid CSR `sstateen0', needs `smstateen' extension -.*Warning: invalid CSR `sstateen1', needs `smstateen' extension -.*Warning: invalid CSR `sstateen1', needs `smstateen' extension -.*Warning: invalid CSR `sstateen2', needs `smstateen' extension -.*Warning: invalid CSR `sstateen2', needs `smstateen' extension -.*Warning: invalid CSR `sstateen3', needs `smstateen' extension -.*Warning: invalid CSR `sstateen3', needs `smstateen' extension +.*Warning: invalid CSR `sstateen0', needs `ssstateen' extension +.*Warning: invalid CSR `sstateen0', needs `ssstateen' extension +.*Warning: invalid CSR `sstateen1', needs `ssstateen' extension +.*Warning: invalid CSR `sstateen1', needs `ssstateen' extension +.*Warning: invalid CSR `sstateen2', needs `ssstateen' extension +.*Warning: invalid CSR `sstateen2', needs `ssstateen' extension +.*Warning: invalid CSR `sstateen3', needs `ssstateen' extension +.*Warning: invalid CSR `sstateen3', needs `ssstateen' extension .*Warning: invalid CSR `hstateen0', needs `h' extension -.*Warning: invalid CSR `hstateen0', needs `smstateen' extension +.*Warning: invalid CSR `hstateen0', needs `ssstateen' extension .*Warning: invalid CSR `hstateen0', needs `h' extension -.*Warning: invalid CSR `hstateen0', needs `smstateen' extension +.*Warning: invalid CSR `hstateen0', needs `ssstateen' extension .*Warning: invalid CSR `hstateen1', needs `h' extension -.*Warning: invalid CSR `hstateen1', needs `smstateen' extension +.*Warning: invalid CSR `hstateen1', needs `ssstateen' extension .*Warning: invalid CSR `hstateen1', needs `h' extension -.*Warning: invalid CSR `hstateen1', needs `smstateen' extension +.*Warning: invalid CSR `hstateen1', needs `ssstateen' extension .*Warning: invalid CSR `hstateen2', needs `h' extension -.*Warning: invalid CSR `hstateen2', needs `smstateen' extension +.*Warning: invalid CSR `hstateen2', needs `ssstateen' extension .*Warning: invalid CSR `hstateen2', needs `h' extension -.*Warning: invalid CSR `hstateen2', needs `smstateen' extension +.*Warning: invalid CSR `hstateen2', needs `ssstateen' extension .*Warning: invalid CSR `hstateen3', needs `h' extension -.*Warning: invalid CSR `hstateen3', needs `smstateen' extension +.*Warning: invalid CSR `hstateen3', needs `ssstateen' extension .*Warning: invalid CSR `hstateen3', needs `h' extension -.*Warning: invalid CSR `hstateen3', needs `smstateen' extension +.*Warning: invalid CSR `hstateen3', needs `ssstateen' extension .*Warning: invalid CSR `mstateen0h', needs rv32i extension .*Warning: invalid CSR `mstateen0h', needs `smstateen' extension .*Warning: invalid CSR `mstateen0h', needs rv32i extension @@ -511,28 +511,28 @@ .*Warning: invalid CSR `mstateen3h', needs `smstateen' extension .*Warning: invalid CSR `hstateen0h', needs rv32i extension .*Warning: invalid CSR `hstateen0h', needs `h' extension -.*Warning: invalid CSR `hstateen0h', needs `smstateen' extension +.*Warning: invalid CSR `hstateen0h', needs `ssstateen' extension .*Warning: invalid CSR `hstateen0h', needs rv32i extension .*Warning: invalid CSR `hstateen0h', needs `h' extension -.*Warning: invalid CSR `hstateen0h', needs `smstateen' extension +.*Warning: invalid CSR `hstateen0h', needs `ssstateen' extension .*Warning: invalid CSR `hstateen1h', needs rv32i extension .*Warning: invalid CSR `hstateen1h', needs `h' extension -.*Warning: invalid CSR `hstateen1h', needs `smstateen' extension +.*Warning: invalid CSR `hstateen1h', needs `ssstateen' extension .*Warning: invalid CSR `hstateen1h', needs rv32i extension .*Warning: invalid CSR `hstateen1h', needs `h' extension -.*Warning: invalid CSR `hstateen1h', needs `smstateen' extension +.*Warning: invalid CSR `hstateen1h', needs `ssstateen' extension .*Warning: invalid CSR `hstateen2h', needs rv32i extension .*Warning: invalid CSR `hstateen2h', needs `h' extension -.*Warning: invalid CSR `hstateen2h', needs `smstateen' extension +.*Warning: invalid CSR `hstateen2h', needs `ssstateen' extension .*Warning: invalid CSR `hstateen2h', needs rv32i extension .*Warning: invalid CSR `hstateen2h', needs `h' extension -.*Warning: invalid CSR `hstateen2h', needs `smstateen' extension +.*Warning: invalid CSR `hstateen2h', needs `ssstateen' extension .*Warning: invalid CSR `hstateen3h', needs rv32i extension .*Warning: invalid CSR `hstateen3h', needs `h' extension -.*Warning: invalid CSR `hstateen3h', needs `smstateen' extension +.*Warning: invalid CSR `hstateen3h', needs `ssstateen' extension .*Warning: invalid CSR `hstateen3h', needs rv32i extension .*Warning: invalid CSR `hstateen3h', needs `h' extension -.*Warning: invalid CSR `hstateen3h', needs `smstateen' extension +.*Warning: invalid CSR `hstateen3h', needs `ssstateen' extension .*Warning: invalid CSR `scountovf', needs `sscofpmf' extension .*Warning: invalid CSR `scountovf', needs `sscofpmf' extension .*Warning: read-only CSR is written `csrw scountovf,a1' diff --git a/gas/testsuite/gas/riscv/csr.s b/gas/testsuite/gas/riscv/csr.s index 128aeb8..397fe0b 100644 --- a/gas/testsuite/gas/riscv/csr.s +++ b/gas/testsuite/gas/riscv/csr.s @@ -337,7 +337,7 @@ csr vsip csr vsatp - # Smstateen extension + # Smstateen/Ssstateen extensions csr mstateen0 csr mstateen1 csr mstateen2 diff --git a/gas/testsuite/gas/riscv/smstateen-csr-s.d b/gas/testsuite/gas/riscv/smstateen-csr-s.d new file mode 100644 index 0000000..44b6dd6 --- /dev/null +++ b/gas/testsuite/gas/riscv/smstateen-csr-s.d @@ -0,0 +1,22 @@ +#as: -march=rv32ih_smstateen -mcsr-check -mpriv-spec=1.12 +#source: ssstateen-csr.s +#objdump: -dr + +.*:[ ]+file format .* + + +Disassembly of section .text: + +0+000 <target>: +[ ]+[0-9a-f]+:[ ]+10c02573[ ]+csrr[ ]+a0,sstateen0 +[ ]+[0-9a-f]+:[ ]+10d02573[ ]+csrr[ ]+a0,sstateen1 +[ ]+[0-9a-f]+:[ ]+10e02573[ ]+csrr[ ]+a0,sstateen2 +[ ]+[0-9a-f]+:[ ]+10f02573[ ]+csrr[ ]+a0,sstateen3 +[ ]+[0-9a-f]+:[ ]+60c02573[ ]+csrr[ ]+a0,hstateen0 +[ ]+[0-9a-f]+:[ ]+60d02573[ ]+csrr[ ]+a0,hstateen1 +[ ]+[0-9a-f]+:[ ]+60e02573[ ]+csrr[ ]+a0,hstateen2 +[ ]+[0-9a-f]+:[ ]+60f02573[ ]+csrr[ ]+a0,hstateen3 +[ ]+[0-9a-f]+:[ ]+61c02573[ ]+csrr[ ]+a0,hstateen0h +[ ]+[0-9a-f]+:[ ]+61d02573[ ]+csrr[ ]+a0,hstateen1h +[ ]+[0-9a-f]+:[ ]+61e02573[ ]+csrr[ ]+a0,hstateen2h +[ ]+[0-9a-f]+:[ ]+61f02573[ ]+csrr[ ]+a0,hstateen3h diff --git a/gas/testsuite/gas/riscv/ssstateen-csr.d b/gas/testsuite/gas/riscv/ssstateen-csr.d new file mode 100644 index 0000000..29b286a --- /dev/null +++ b/gas/testsuite/gas/riscv/ssstateen-csr.d @@ -0,0 +1,22 @@ +#as: -march=rv32ih_ssstateen -mcsr-check -mpriv-spec=1.12 +#source: ssstateen-csr.s +#objdump: -dr + +.*:[ ]+file format .* + + +Disassembly of section .text: + +0+000 <target>: +[ ]+[0-9a-f]+:[ ]+10c02573[ ]+csrr[ ]+a0,sstateen0 +[ ]+[0-9a-f]+:[ ]+10d02573[ ]+csrr[ ]+a0,sstateen1 +[ ]+[0-9a-f]+:[ ]+10e02573[ ]+csrr[ ]+a0,sstateen2 +[ ]+[0-9a-f]+:[ ]+10f02573[ ]+csrr[ ]+a0,sstateen3 +[ ]+[0-9a-f]+:[ ]+60c02573[ ]+csrr[ ]+a0,hstateen0 +[ ]+[0-9a-f]+:[ ]+60d02573[ ]+csrr[ ]+a0,hstateen1 +[ ]+[0-9a-f]+:[ ]+60e02573[ ]+csrr[ ]+a0,hstateen2 +[ ]+[0-9a-f]+:[ ]+60f02573[ ]+csrr[ ]+a0,hstateen3 +[ ]+[0-9a-f]+:[ ]+61c02573[ ]+csrr[ ]+a0,hstateen0h +[ ]+[0-9a-f]+:[ ]+61d02573[ ]+csrr[ ]+a0,hstateen1h +[ ]+[0-9a-f]+:[ ]+61e02573[ ]+csrr[ ]+a0,hstateen2h +[ ]+[0-9a-f]+:[ ]+61f02573[ ]+csrr[ ]+a0,hstateen3h diff --git a/gas/testsuite/gas/riscv/ssstateen-csr.s b/gas/testsuite/gas/riscv/ssstateen-csr.s new file mode 100644 index 0000000..82707a4 --- /dev/null +++ b/gas/testsuite/gas/riscv/ssstateen-csr.s @@ -0,0 +1,13 @@ +target: + csrr a0, sstateen0 + csrr a0, sstateen1 + csrr a0, sstateen2 + csrr a0, sstateen3 + csrr a0, hstateen0 + csrr a0, hstateen1 + csrr a0, hstateen2 + csrr a0, hstateen3 + csrr a0, hstateen0h + csrr a0, hstateen1h + csrr a0, hstateen2h + csrr a0, hstateen3h diff --git a/include/opcode/riscv-opc.h b/include/opcode/riscv-opc.h index f36b06d..cdc0919 100644 --- a/include/opcode/riscv-opc.h +++ b/include/opcode/riscv-opc.h @@ -3504,27 +3504,27 @@ DECLARE_CSR(vscause, CSR_VSCAUSE, CSR_CLASS_H, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_C DECLARE_CSR(vstval, CSR_VSTVAL, CSR_CLASS_H, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE) DECLARE_CSR(vsip, CSR_VSIP, CSR_CLASS_H, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE) DECLARE_CSR(vsatp, CSR_VSATP, CSR_CLASS_H, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE) -/* Smstateen extension */ +/* Smstateen/Ssstateen extensions. */ DECLARE_CSR(mstateen0, CSR_MSTATEEN0, CSR_CLASS_SMSTATEEN, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE) DECLARE_CSR(mstateen1, CSR_MSTATEEN1, CSR_CLASS_SMSTATEEN, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE) DECLARE_CSR(mstateen2, CSR_MSTATEEN2, CSR_CLASS_SMSTATEEN, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE) DECLARE_CSR(mstateen3, CSR_MSTATEEN3, CSR_CLASS_SMSTATEEN, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE) -DECLARE_CSR(sstateen0, CSR_SSTATEEN0, CSR_CLASS_SMSTATEEN, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE) -DECLARE_CSR(sstateen1, CSR_SSTATEEN1, CSR_CLASS_SMSTATEEN, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE) -DECLARE_CSR(sstateen2, CSR_SSTATEEN2, CSR_CLASS_SMSTATEEN, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE) -DECLARE_CSR(sstateen3, CSR_SSTATEEN3, CSR_CLASS_SMSTATEEN, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE) -DECLARE_CSR(hstateen0, CSR_HSTATEEN0, CSR_CLASS_SMSTATEEN_AND_H, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE) -DECLARE_CSR(hstateen1, CSR_HSTATEEN1, CSR_CLASS_SMSTATEEN_AND_H, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE) -DECLARE_CSR(hstateen2, CSR_HSTATEEN2, CSR_CLASS_SMSTATEEN_AND_H, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE) -DECLARE_CSR(hstateen3, CSR_HSTATEEN3, CSR_CLASS_SMSTATEEN_AND_H, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE) +DECLARE_CSR(sstateen0, CSR_SSTATEEN0, CSR_CLASS_SSSTATEEN, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE) +DECLARE_CSR(sstateen1, CSR_SSTATEEN1, CSR_CLASS_SSSTATEEN, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE) +DECLARE_CSR(sstateen2, CSR_SSTATEEN2, CSR_CLASS_SSSTATEEN, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE) +DECLARE_CSR(sstateen3, CSR_SSTATEEN3, CSR_CLASS_SSSTATEEN, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE) +DECLARE_CSR(hstateen0, CSR_HSTATEEN0, CSR_CLASS_SSSTATEEN_AND_H, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE) +DECLARE_CSR(hstateen1, CSR_HSTATEEN1, CSR_CLASS_SSSTATEEN_AND_H, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE) +DECLARE_CSR(hstateen2, CSR_HSTATEEN2, CSR_CLASS_SSSTATEEN_AND_H, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE) +DECLARE_CSR(hstateen3, CSR_HSTATEEN3, CSR_CLASS_SSSTATEEN_AND_H, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE) DECLARE_CSR(mstateen0h, CSR_MSTATEEN0H, CSR_CLASS_SMSTATEEN_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE) DECLARE_CSR(mstateen1h, CSR_MSTATEEN1H, CSR_CLASS_SMSTATEEN_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE) DECLARE_CSR(mstateen2h, CSR_MSTATEEN2H, CSR_CLASS_SMSTATEEN_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE) DECLARE_CSR(mstateen3h, CSR_MSTATEEN3H, CSR_CLASS_SMSTATEEN_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE) -DECLARE_CSR(hstateen0h, CSR_HSTATEEN0H, CSR_CLASS_SMSTATEEN_AND_H_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE) -DECLARE_CSR(hstateen1h, CSR_HSTATEEN1H, CSR_CLASS_SMSTATEEN_AND_H_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE) -DECLARE_CSR(hstateen2h, CSR_HSTATEEN2H, CSR_CLASS_SMSTATEEN_AND_H_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE) -DECLARE_CSR(hstateen3h, CSR_HSTATEEN3H, CSR_CLASS_SMSTATEEN_AND_H_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE) +DECLARE_CSR(hstateen0h, CSR_HSTATEEN0H, CSR_CLASS_SSSTATEEN_AND_H_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE) +DECLARE_CSR(hstateen1h, CSR_HSTATEEN1H, CSR_CLASS_SSSTATEEN_AND_H_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE) +DECLARE_CSR(hstateen2h, CSR_HSTATEEN2H, CSR_CLASS_SSSTATEEN_AND_H_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE) +DECLARE_CSR(hstateen3h, CSR_HSTATEEN3H, CSR_CLASS_SSSTATEEN_AND_H_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE) /* Sscofpmf extension */ DECLARE_CSR(scountovf, CSR_SCOUNTOVF, CSR_CLASS_SSCOFPMF, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE) DECLARE_CSR(mhpmevent3h, CSR_MHPMEVENT3H, CSR_CLASS_SSCOFPMF_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE) |