aboutsummaryrefslogtreecommitdiff
path: root/encoding.h
diff options
context:
space:
mode:
Diffstat (limited to 'encoding.h')
-rw-r--r--encoding.h70
1 files changed, 37 insertions, 33 deletions
diff --git a/encoding.h b/encoding.h
index 32ededa..dca31a5 100644
--- a/encoding.h
+++ b/encoding.h
@@ -3,37 +3,41 @@
#ifndef RISCV_CSR_ENCODING_H
#define RISCV_CSR_ENCODING_H
-#define MSTATUS_IE 0x00000001
-#define MSTATUS_PRV 0x00000006
-#define MSTATUS_IE1 0x00000008
-#define MSTATUS_PRV1 0x00000030
-#define MSTATUS_IE2 0x00000040
-#define MSTATUS_PRV2 0x00000180
-#define MSTATUS_IE3 0x00000200
-#define MSTATUS_PRV3 0x00000C00
-#define MSTATUS_FS 0x00003000
-#define MSTATUS_XS 0x0000C000
-#define MSTATUS_MPRV 0x00010000
-#define MSTATUS_VM 0x003E0000
+#define MSTATUS_UIE 0x00000001
+#define MSTATUS_SIE 0x00000002
+#define MSTATUS_HIE 0x00000004
+#define MSTATUS_MIE 0x00000008
+#define MSTATUS_UPIE 0x00000010
+#define MSTATUS_SPIE 0x00000020
+#define MSTATUS_HPIE 0x00000040
+#define MSTATUS_MPIE 0x00000080
+#define MSTATUS_SPP 0x00000100
+#define MSTATUS_HPP 0x00000600
+#define MSTATUS_MPP 0x00001800
+#define MSTATUS_FS 0x00006000
+#define MSTATUS_XS 0x00018000
+#define MSTATUS_MPRV 0x00020000
+#define MSTATUS_VM 0x007C0000
#define MSTATUS32_SD 0x80000000
#define MSTATUS64_SD 0x8000000000000000
-#define SSTATUS_IE 0x00000001
-#define SSTATUS_PIE 0x00000008
-#define SSTATUS_PS 0x00000010
-#define SSTATUS_FS 0x00003000
-#define SSTATUS_XS 0x0000C000
-#define SSTATUS_MPRV 0x00010000
-#define SSTATUS_TIE 0x01000000
+#define SSTATUS_UIE 0x00000001
+#define SSTATUS_SIE 0x00000002
+#define SSTATUS_UPIE 0x00000010
+#define SSTATUS_SPIE 0x00000020
+#define SSTATUS_SPP 0x00000100
+#define SSTATUS_FS 0x00006000
+#define SSTATUS_XS 0x00018000
+#define SSTATUS_VM 0x007C0000
#define SSTATUS32_SD 0x80000000
#define SSTATUS64_SD 0x8000000000000000
-#define MIP_SSIP 0x00000002
-#define MIP_HSIP 0x00000004
-#define MIP_MSIP 0x00000008
-#define MIP_STIP 0x00000020
-#define MIP_HTIP 0x00000040
-#define MIP_MTIP 0x00000080
+#define MIP_SSIP (1 << IRQ_S_SOFT)
+#define MIP_HSIP (1 << IRQ_H_SOFT)
+#define MIP_MSIP (1 << IRQ_M_SOFT)
+#define MIP_STIP (1 << IRQ_S_TIMER)
+#define MIP_HTIP (1 << IRQ_H_TIMER)
+#define MIP_MTIP (1 << IRQ_M_TIMER)
#define SIP_SSIP MIP_SSIP
#define SIP_STIP MIP_STIP
@@ -50,14 +54,14 @@
#define VM_SV39 9
#define VM_SV48 10
-#define UA_RV32 0
-#define UA_RV64 4
-#define UA_RV128 8
-
-#define IRQ_SOFT 0
-#define IRQ_TIMER 1
-#define IRQ_HOST 2
-#define IRQ_COP 3
+#define IRQ_S_SOFT 1
+#define IRQ_H_SOFT 2
+#define IRQ_M_SOFT 3
+#define IRQ_S_TIMER 5
+#define IRQ_H_TIMER 6
+#define IRQ_M_TIMER 7
+#define IRQ_COP 8
+#define IRQ_HOST 9
#define IMPL_ROCKET 1