[PATCH 1/1] RISC-V: Add Smepmp CSR 'mseccfg' define and testcases.
jiawei
jiawei@iscas.ac.cn
Mon Dec 27 08:52:08 GMT 2021
Add Smepmp CSR 'mseccfg','mseccfgh' define and testcases. Only enable after
ratified privileged Architecture v1.12(v1.11 and before version not contain this CSR define).
gas/ChangeLog:
* testsuite/gas/riscv/csr-version-1p10.d: Add disassemble info.
* testsuite/gas/riscv/csr-version-1p10.l: Add warning info.
* testsuite/gas/riscv/csr-version-1p11.d: Add disassemble info.
* testsuite/gas/riscv/csr-version-1p11.l: Add warning info.
* testsuite/gas/riscv/csr-version-1p12.d: Add disassemble info.
* testsuite/gas/riscv/csr-version-1p12.l: Add warning info.
* testsuite/gas/riscv/csr-version-1p9p1.d: Add disassemble info.
* testsuite/gas/riscv/csr-version-1p9p1.l: Add warning info.
* testsuite/gas/riscv/csr.s: Add new CSR.
include/ChangeLog:
* opcode/riscv-opc.h (CSR_MSECCFG): Add new CSR.
(CSR_MSECCFGH): Ditto.
(DECLARE_CSR): Add new CSR declare.
---
gas/testsuite/gas/riscv/csr-version-1p10.d | 4 ++++
gas/testsuite/gas/riscv/csr-version-1p10.l | 6 ++++++
gas/testsuite/gas/riscv/csr-version-1p11.d | 4 ++++
gas/testsuite/gas/riscv/csr-version-1p11.l | 6 ++++++
gas/testsuite/gas/riscv/csr-version-1p12.d | 4 ++++
gas/testsuite/gas/riscv/csr-version-1p12.l | 2 ++
gas/testsuite/gas/riscv/csr-version-1p9p1.d | 4 ++++
gas/testsuite/gas/riscv/csr-version-1p9p1.l | 6 ++++++
gas/testsuite/gas/riscv/csr.s | 4 ++++
include/opcode/riscv-opc.h | 6 ++++++
10 files changed, 46 insertions(+)
diff --git a/gas/testsuite/gas/riscv/csr-version-1p10.d b/gas/testsuite/gas/riscv/csr-version-1p10.d
index ee56ae31f0c..8f9df96f604 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p10.d
+++ b/gas/testsuite/gas/riscv/csr-version-1p10.d
@@ -467,6 +467,10 @@ Disassembly of section .text:
[ ]+[0-9a-f]+:[ ]+60559073[ ]+csrw[ ]+0x605,a1
[ ]+[0-9a-f]+:[ ]+61502573[ ]+csrr[ ]+a0,0x615
[ ]+[0-9a-f]+:[ ]+61559073[ ]+csrw[ ]+0x615,a1
+[ ]+[0-9a-f]+:[ ]+74702573[ ]+csrr[ ]+a0,0x747
+[ ]+[0-9a-f]+:[ ]+74759073[ ]+csrw[ ]+0x747,a1
+[ ]+[0-9a-f]+:[ ]+75702573[ ]+csrr[ ]+a0,0x757
+[ ]+[0-9a-f]+:[ ]+75759073[ ]+csrw[ ]+0x757,a1
[ ]+[0-9a-f]+:[ ]+20002573[ ]+csrr[ ]+a0,0x200
[ ]+[0-9a-f]+:[ ]+20059073[ ]+csrw[ ]+0x200,a1
[ ]+[0-9a-f]+:[ ]+20402573[ ]+csrr[ ]+a0,0x204
diff --git a/gas/testsuite/gas/riscv/csr-version-1p10.l b/gas/testsuite/gas/riscv/csr-version-1p10.l
index ed6773e637c..db977e770e2 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p10.l
+++ b/gas/testsuite/gas/riscv/csr-version-1p10.l
@@ -238,6 +238,12 @@
.*Warning: invalid CSR `htimedeltah' for the privileged spec `1.10'
.*Warning: invalid CSR `htimedeltah' for the current ISA
.*Warning: invalid CSR `htimedeltah' for the privileged spec `1.10'
+.*Warning: invalid CSR `mseccfg' for the privileged spec `1.10'
+.*Warning: invalid CSR `mseccfg' for the privileged spec `1.10'
+.*Warning: invalid CSR `mseccfgh' for the current ISA
+.*Warning: invalid CSR `mseccfgh' for the privileged spec `1.10'
+.*Warning: invalid CSR `mseccfgh' for the current ISA
+.*Warning: invalid CSR `mseccfgh' for the privileged spec `1.10'
.*Warning: invalid CSR `vsstatus' for the privileged spec `1.10'
.*Warning: invalid CSR `vsstatus' for the privileged spec `1.10'
.*Warning: invalid CSR `vsie' for the privileged spec `1.10'
diff --git a/gas/testsuite/gas/riscv/csr-version-1p11.d b/gas/testsuite/gas/riscv/csr-version-1p11.d
index a1d8169d7f7..886bf6be882 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p11.d
+++ b/gas/testsuite/gas/riscv/csr-version-1p11.d
@@ -467,6 +467,10 @@ Disassembly of section .text:
[ ]+[0-9a-f]+:[ ]+60559073[ ]+csrw[ ]+0x605,a1
[ ]+[0-9a-f]+:[ ]+61502573[ ]+csrr[ ]+a0,0x615
[ ]+[0-9a-f]+:[ ]+61559073[ ]+csrw[ ]+0x615,a1
+[ ]+[0-9a-f]+:[ ]+74702573[ ]+csrr[ ]+a0,0x747
+[ ]+[0-9a-f]+:[ ]+74759073[ ]+csrw[ ]+0x747,a1
+[ ]+[0-9a-f]+:[ ]+75702573[ ]+csrr[ ]+a0,0x757
+[ ]+[0-9a-f]+:[ ]+75759073[ ]+csrw[ ]+0x757,a1
[ ]+[0-9a-f]+:[ ]+20002573[ ]+csrr[ ]+a0,0x200
[ ]+[0-9a-f]+:[ ]+20059073[ ]+csrw[ ]+0x200,a1
[ ]+[0-9a-f]+:[ ]+20402573[ ]+csrr[ ]+a0,0x204
diff --git a/gas/testsuite/gas/riscv/csr-version-1p11.l b/gas/testsuite/gas/riscv/csr-version-1p11.l
index 44d9611fe49..f6b534cf1b6 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p11.l
+++ b/gas/testsuite/gas/riscv/csr-version-1p11.l
@@ -236,6 +236,12 @@
.*Warning: invalid CSR `htimedeltah' for the privileged spec `1.11'
.*Warning: invalid CSR `htimedeltah' for the current ISA
.*Warning: invalid CSR `htimedeltah' for the privileged spec `1.11'
+.*Warning: invalid CSR `mseccfg' for the privileged spec `1.11'
+.*Warning: invalid CSR `mseccfg' for the privileged spec `1.11'
+.*Warning: invalid CSR `mseccfgh' for the current ISA
+.*Warning: invalid CSR `mseccfgh' for the privileged spec `1.11'
+.*Warning: invalid CSR `mseccfgh' for the current ISA
+.*Warning: invalid CSR `mseccfgh' for the privileged spec `1.11'
.*Warning: invalid CSR `vsstatus' for the privileged spec `1.11'
.*Warning: invalid CSR `vsstatus' for the privileged spec `1.11'
.*Warning: invalid CSR `vsie' for the privileged spec `1.11'
diff --git a/gas/testsuite/gas/riscv/csr-version-1p12.d b/gas/testsuite/gas/riscv/csr-version-1p12.d
index c4c211829b2..11baf6b12ce 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p12.d
+++ b/gas/testsuite/gas/riscv/csr-version-1p12.d
@@ -467,6 +467,10 @@ Disassembly of section .text:
[ ]+[0-9a-f]+:[ ]+60559073[ ]+csrw[ ]+htimedelta,a1
[ ]+[0-9a-f]+:[ ]+61502573[ ]+csrr[ ]+a0,htimedeltah
[ ]+[0-9a-f]+:[ ]+61559073[ ]+csrw[ ]+htimedeltah,a1
+[ ]+[0-9a-f]+:[ ]+74702573[ ]+csrr[ ]+a0,mseccfg
+[ ]+[0-9a-f]+:[ ]+74759073[ ]+csrw[ ]+mseccfg,a1
+[ ]+[0-9a-f]+:[ ]+75702573[ ]+csrr[ ]+a0,mseccfgh
+[ ]+[0-9a-f]+:[ ]+75759073[ ]+csrw[ ]+mseccfgh,a1
[ ]+[0-9a-f]+:[ ]+20002573[ ]+csrr[ ]+a0,vsstatus
[ ]+[0-9a-f]+:[ ]+20059073[ ]+csrw[ ]+vsstatus,a1
[ ]+[0-9a-f]+:[ ]+20402573[ ]+csrr[ ]+a0,vsie
diff --git a/gas/testsuite/gas/riscv/csr-version-1p12.l b/gas/testsuite/gas/riscv/csr-version-1p12.l
index 237cb8a1699..6d324b3ef15 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p12.l
+++ b/gas/testsuite/gas/riscv/csr-version-1p12.l
@@ -202,6 +202,8 @@
.*Warning: invalid CSR `henvcfgh' for the current ISA
.*Warning: invalid CSR `htimedeltah' for the current ISA
.*Warning: invalid CSR `htimedeltah' for the current ISA
+.*Warning: invalid CSR `mseccfgh' for the current ISA
+.*Warning: invalid CSR `mseccfgh' for the current ISA
.*Warning: invalid CSR `ubadaddr' for the privileged spec `1.12'
.*Warning: invalid CSR `ubadaddr' for the privileged spec `1.12'
.*Warning: invalid CSR `sbadaddr' for the privileged spec `1.12'
diff --git a/gas/testsuite/gas/riscv/csr-version-1p9p1.d b/gas/testsuite/gas/riscv/csr-version-1p9p1.d
index 01e05ae4fbc..7eeca120421 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p9p1.d
+++ b/gas/testsuite/gas/riscv/csr-version-1p9p1.d
@@ -467,6 +467,10 @@ Disassembly of section .text:
[ ]+[0-9a-f]+:[ ]+60559073[ ]+csrw[ ]+0x605,a1
[ ]+[0-9a-f]+:[ ]+61502573[ ]+csrr[ ]+a0,0x615
[ ]+[0-9a-f]+:[ ]+61559073[ ]+csrw[ ]+0x615,a1
+[ ]+[0-9a-f]+:[ ]+74702573[ ]+csrr[ ]+a0,0x747
+[ ]+[0-9a-f]+:[ ]+74759073[ ]+csrw[ ]+0x747,a1
+[ ]+[0-9a-f]+:[ ]+75702573[ ]+csrr[ ]+a0,0x757
+[ ]+[0-9a-f]+:[ ]+75759073[ ]+csrw[ ]+0x757,a1
[ ]+[0-9a-f]+:[ ]+20002573[ ]+csrr[ ]+a0,0x200
[ ]+[0-9a-f]+:[ ]+20059073[ ]+csrw[ ]+0x200,a1
[ ]+[0-9a-f]+:[ ]+20402573[ ]+csrr[ ]+a0,0x204
diff --git a/gas/testsuite/gas/riscv/csr-version-1p9p1.l b/gas/testsuite/gas/riscv/csr-version-1p9p1.l
index 00d46f509de..82bb5078c17 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p9p1.l
+++ b/gas/testsuite/gas/riscv/csr-version-1p9p1.l
@@ -290,6 +290,12 @@
.*Warning: invalid CSR `htimedeltah' for the privileged spec `1.9.1'
.*Warning: invalid CSR `htimedeltah' for the current ISA
.*Warning: invalid CSR `htimedeltah' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mseccfg' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mseccfg' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mseccfgh' for the current ISA
+.*Warning: invalid CSR `mseccfgh' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mseccfgh' for the current ISA
+.*Warning: invalid CSR `mseccfgh' for the privileged spec `1.9.1'
.*Warning: invalid CSR `vsstatus' for the privileged spec `1.9.1'
.*Warning: invalid CSR `vsstatus' for the privileged spec `1.9.1'
.*Warning: invalid CSR `vsie' for the privileged spec `1.9.1'
diff --git a/gas/testsuite/gas/riscv/csr.s b/gas/testsuite/gas/riscv/csr.s
index 568328d70d9..b15360f31c8 100644
--- a/gas/testsuite/gas/riscv/csr.s
+++ b/gas/testsuite/gas/riscv/csr.s
@@ -270,6 +270,10 @@
csr htimedelta
csr htimedeltah
+ # Machine Security Configuration Registers (1.12)
+ csr mseccfg # 0x747, RV64 or low 32bits on RV32
+ csr mseccfgh # 0x757, high 32bits on RV32
+
# Virtual Supervisor Registers (1.12)
csr vsstatus
csr vsie
diff --git a/include/opcode/riscv-opc.h b/include/opcode/riscv-opc.h
index 6ca2f8d9309..09af88f17d2 100644
--- a/include/opcode/riscv-opc.h
+++ b/include/opcode/riscv-opc.h
@@ -2277,6 +2277,9 @@
#define CSR_MDBOUND 0x385
#define CSR_MSCOUNTEREN 0x321
#define CSR_MHCOUNTEREN 0x322
+/* Smepmp (Privileged spec 1.12). */
+#define CSR_MSECCFG 0x747
+#define CSR_MSECCFGH 0x757
/* Unprivileged CSR addresses. */
#define CSR_FFLAGS 0x1
#define CSR_FRM 0x2
@@ -2870,6 +2873,9 @@ DECLARE_CSR(vscause, CSR_VSCAUSE, CSR_CLASS_I, PRIV_SPEC_CLASS_1P12, PRIV_SPEC_C
DECLARE_CSR(vstval, CSR_VSTVAL, CSR_CLASS_I, PRIV_SPEC_CLASS_1P12, PRIV_SPEC_CLASS_DRAFT)
DECLARE_CSR(vsip, CSR_VSIP, CSR_CLASS_I, PRIV_SPEC_CLASS_1P12, PRIV_SPEC_CLASS_DRAFT)
DECLARE_CSR(vsatp, CSR_VSATP, CSR_CLASS_I, PRIV_SPEC_CLASS_1P12, PRIV_SPEC_CLASS_DRAFT)
+/* Smepmp CSRs. */
+DECLARE_CSR(mseccfg, CSR_MSECCFG, CSR_CLASS_I, PRIV_SPEC_CLASS_1P12, PRIV_SPEC_CLASS_DRAFT)
+DECLARE_CSR(mseccfgh, CSR_MSECCFGH, CSR_CLASS_I_32, PRIV_SPEC_CLASS_1P12, PRIV_SPEC_CLASS_DRAFT)
/* Dropped CSRs. */
DECLARE_CSR(mbase, CSR_MBASE, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_1P10)
DECLARE_CSR(mbound, CSR_MBOUND, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_1P10)
--
2.25.1
More information about the Binutils
mailing list