From 915f9b7e626afd8811b72736aa28df279618c360 Mon Sep 17 00:00:00 2001
From: "Tsukasa #01 (a4lg)"
Date: Tue, 14 Dec 2021 12:26:04 +0900
Subject: Add new CSRs defined in Privileged Spec version 1.12 (#90)
* Add CSRs defined in Privileged spec 1.12 (non-H)
This commit defines additional CSRs defined in the privileged
specification, version 1.12 (diff is from 1.11) except...
- Those defined in riscv-opcodes:
- mstatush
- mtinst
- mtval2
- mcontext
- Those related to hypervisor extension
cf.
* Add new CSRs defined in Privileged spec 1.12 (H)
New hypervisor-related CSRs, `henvcfg` and `henvcfgh` are added.
All other hypervisor-related CSRs are already implemented in
riscv-opcodes.
cf.
---
parse_opcodes | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 67 insertions(+)
diff --git a/parse_opcodes b/parse_opcodes
index 4eb75a1..97fd725 100755
--- a/parse_opcodes
+++ b/parse_opcodes
@@ -162,6 +162,7 @@ csrs = [
(0x605, 'htimedelta'),
(0x606, 'hcounteren'),
(0x607, 'hgeie'),
+ (0x60A, 'henvcfg'),
(0x643, 'htval'),
(0x644, 'hip'),
(0x645, 'hvip'),
@@ -195,6 +196,7 @@ csrs = [
(0x304, 'mie'),
(0x305, 'mtvec'),
(0x306, 'mcounteren'),
+ (0x30a, 'menvcfg'),
(0x320, 'mcountinhibit'),
(0x340, 'mscratch'),
(0x341, 'mepc'),
@@ -207,6 +209,18 @@ csrs = [
(0x3a1, 'pmpcfg1'),
(0x3a2, 'pmpcfg2'),
(0x3a3, 'pmpcfg3'),
+ (0x3a4, 'pmpcfg4'),
+ (0x3a5, 'pmpcfg5'),
+ (0x3a6, 'pmpcfg6'),
+ (0x3a7, 'pmpcfg7'),
+ (0x3a8, 'pmpcfg8'),
+ (0x3a9, 'pmpcfg9'),
+ (0x3aa, 'pmpcfg10'),
+ (0x3ab, 'pmpcfg11'),
+ (0x3ac, 'pmpcfg12'),
+ (0x3ad, 'pmpcfg13'),
+ (0x3ae, 'pmpcfg14'),
+ (0x3af, 'pmpcfg15'),
(0x3b0, 'pmpaddr0'),
(0x3b1, 'pmpaddr1'),
(0x3b2, 'pmpaddr2'),
@@ -223,6 +237,55 @@ csrs = [
(0x3bd, 'pmpaddr13'),
(0x3be, 'pmpaddr14'),
(0x3bf, 'pmpaddr15'),
+ (0x3c0, 'pmpaddr16'),
+ (0x3c1, 'pmpaddr17'),
+ (0x3c2, 'pmpaddr18'),
+ (0x3c3, 'pmpaddr19'),
+ (0x3c4, 'pmpaddr20'),
+ (0x3c5, 'pmpaddr21'),
+ (0x3c6, 'pmpaddr22'),
+ (0x3c7, 'pmpaddr23'),
+ (0x3c8, 'pmpaddr24'),
+ (0x3c9, 'pmpaddr25'),
+ (0x3ca, 'pmpaddr26'),
+ (0x3cb, 'pmpaddr27'),
+ (0x3cc, 'pmpaddr28'),
+ (0x3cd, 'pmpaddr29'),
+ (0x3ce, 'pmpaddr30'),
+ (0x3cf, 'pmpaddr31'),
+ (0x3d0, 'pmpaddr32'),
+ (0x3d1, 'pmpaddr33'),
+ (0x3d2, 'pmpaddr34'),
+ (0x3d3, 'pmpaddr35'),
+ (0x3d4, 'pmpaddr36'),
+ (0x3d5, 'pmpaddr37'),
+ (0x3d6, 'pmpaddr38'),
+ (0x3d7, 'pmpaddr39'),
+ (0x3d8, 'pmpaddr40'),
+ (0x3d9, 'pmpaddr41'),
+ (0x3da, 'pmpaddr42'),
+ (0x3db, 'pmpaddr43'),
+ (0x3dc, 'pmpaddr44'),
+ (0x3dd, 'pmpaddr45'),
+ (0x3de, 'pmpaddr46'),
+ (0x3df, 'pmpaddr47'),
+ (0x3e0, 'pmpaddr48'),
+ (0x3e1, 'pmpaddr49'),
+ (0x3e2, 'pmpaddr50'),
+ (0x3e3, 'pmpaddr51'),
+ (0x3e4, 'pmpaddr52'),
+ (0x3e5, 'pmpaddr53'),
+ (0x3e6, 'pmpaddr54'),
+ (0x3e7, 'pmpaddr55'),
+ (0x3e8, 'pmpaddr56'),
+ (0x3e9, 'pmpaddr57'),
+ (0x3ea, 'pmpaddr58'),
+ (0x3eb, 'pmpaddr59'),
+ (0x3ec, 'pmpaddr60'),
+ (0x3ed, 'pmpaddr61'),
+ (0x3ee, 'pmpaddr62'),
+ (0x3ef, 'pmpaddr63'),
+ (0x747, 'mseccfg'),
(0x7a0, 'tselect'),
(0x7a1, 'tdata1'),
(0x7a2, 'tdata2'),
@@ -301,11 +364,13 @@ csrs = [
(0xF12, 'marchid'),
(0xF13, 'mimpid'),
(0xF14, 'mhartid'),
+ (0xF15, 'mconfigptr'),
]
csrs32 = [
# Standard Hypervisor R/w
(0x615, 'htimedeltah'),
+ (0x61A, 'henvcfgh'),
# Standard User RO
(0xC80, 'cycleh'),
@@ -343,6 +408,8 @@ csrs32 = [
# Standard Machine RW
(0x310, 'mstatush'),
+ (0x31A, 'menvcfgh'),
+ (0x757, 'mseccfgh'),
(0xB80, 'mcycleh'),
(0xB82, 'minstreth'),
(0xB83, 'mhpmcounter3h'),
--
cgit v1.1