25
25
/* CSRs */
26
26
enum {
27
27
/* floating point */
28
- CSR_FFLAGS = 0x001 , /* Floating-point accrued exceptions */
29
- CSR_FRM = 0x002 , /* Floating-point dynamic rounding mode */
30
- CSR_FCSR = 0x003 , /* Floating-point control and status register */
28
+ CSR_FFLAGS = 0x001 , /* Floating-point accrued exceptions */
29
+ CSR_FRM = 0x002 , /* Floating-point dynamic rounding mode */
30
+ CSR_FCSR = 0x003 , /* Floating-point control and status register */
31
31
32
32
/* Supervisor trap setup */
33
33
CSR_SSTATUS = 0x100 , /* Supervisor status register */
@@ -36,20 +36,20 @@ enum {
36
36
CSR_SCOUNTEREN = 0x106 , /* Supervisor counter enable */
37
37
38
38
/* Supervisor trap handling */
39
- CSR_SSCRATCH = 0x140 , /* Supervisor register for machine trap handlers */
40
- CSR_SEPC = 0x141 , /* Supervisor exception program counter */
41
- CSR_SCAUSE = 0x142 , /* Supervisor trap cause */
42
- CSR_STVAL = 0x143 , /* Supervisor bad address or instruction */
43
- CSR_SIP = 0x144 , /* Supervisor interrupt pending */
39
+ CSR_SSCRATCH = 0x140 , /* Supervisor register for machine trap handlers */
40
+ CSR_SEPC = 0x141 , /* Supervisor exception program counter */
41
+ CSR_SCAUSE = 0x142 , /* Supervisor trap cause */
42
+ CSR_STVAL = 0x143 , /* Supervisor bad address or instruction */
43
+ CSR_SIP = 0x144 , /* Supervisor interrupt pending */
44
44
45
45
/* Supervisor protection and translation */
46
- CSR_SATP = 0x180 , /* Supervisor address translation and protection */
46
+ CSR_SATP = 0x180 , /* Supervisor address translation and protection */
47
47
48
48
/* Machine information registers */
49
- CSR_MVENDORID = 0xF11 , /* Vendor ID */
50
- CSR_MARCHID = 0xF12 , /* Architecture ID */
51
- CSR_MIMPID = 0xF13 , /* Implementation ID */
52
- CSR_MHARTID = 0xF14 , /* Hardware thread ID */
49
+ CSR_MVENDORID = 0xF11 , /* Vendor ID */
50
+ CSR_MARCHID = 0xF12 , /* Architecture ID */
51
+ CSR_MIMPID = 0xF13 , /* Implementation ID */
52
+ CSR_MHARTID = 0xF14 , /* Hardware thread ID */
53
53
54
54
/* Machine trap setup */
55
55
CSR_MSTATUS = 0x300 , /* Machine status register */
@@ -61,15 +61,15 @@ enum {
61
61
CSR_MCOUNTEREN = 0x306 , /* Machine counter enable */
62
62
63
63
/* machine trap handling */
64
- CSR_MSCRATCH = 0x340 , /* Scratch register for machine trap handlers */
65
- CSR_MEPC = 0x341 , /* Machine exception program counter */
66
- CSR_MCAUSE = 0x342 , /* Machine trap cause */
67
- CSR_MTVAL = 0x343 , /* Machine bad address or instruction */
68
- CSR_MIP = 0x344 , /* Machine interrupt pending */
64
+ CSR_MSCRATCH = 0x340 , /* Scratch register for machine trap handlers */
65
+ CSR_MEPC = 0x341 , /* Machine exception program counter */
66
+ CSR_MCAUSE = 0x342 , /* Machine trap cause */
67
+ CSR_MTVAL = 0x343 , /* Machine bad address or instruction */
68
+ CSR_MIP = 0x344 , /* Machine interrupt pending */
69
69
70
70
/* low words */
71
- CSR_CYCLE = 0xC00 , /* Cycle counter for RDCYCLE instruction */
72
- CSR_TIME = 0xC01 , /* Timer for RDTIME instruction */
71
+ CSR_CYCLE = 0xC00 , /* Cycle counter for RDCYCLE instruction */
72
+ CSR_TIME = 0xC01 , /* Timer for RDTIME instruction */
73
73
CSR_INSTRET = 0xC02 ,
74
74
75
75
/* high words */
@@ -142,22 +142,22 @@ struct riscv_internal {
142
142
#endif
143
143
144
144
/* csr registers */
145
- uint64_t csr_cycle ; /* Machine cycle counter */
146
- uint32_t csr_time [2 ]; /* Performance counter */
147
- uint32_t csr_mstatus ; /* Machine status register */
148
- uint32_t csr_mtvec ; /* Machine trap-handler base address */
149
- uint32_t csr_misa ; /* ISA and extensions */
150
- uint32_t csr_mtval ; /* Machine bad address or instruction */
151
- uint32_t csr_mcause ; /* Machine trap cause */
152
- uint32_t csr_mscratch ; /* Scratch register for machine trap handler */
153
- uint32_t csr_mepc ; /* Machine exception program counter */
154
- uint32_t csr_mip ; /* Machine interrupt pending */
155
- uint32_t csr_mie ; /* Machine interrupt enable */
156
- uint32_t csr_mideleg ; /* Machine interrupt delegation register */
157
- uint32_t csr_medeleg ; /* Machine exception delegation register */
158
- uint32_t csr_mvendorid ; /* vendor ID */
159
- uint32_t csr_marchid ; /* Architecture ID */
160
- uint32_t csr_mimpid ; /* Implementation ID */
145
+ uint64_t csr_cycle ; /* Machine cycle counter */
146
+ uint32_t csr_time [2 ]; /* Performance counter */
147
+ uint32_t csr_mstatus ; /* Machine status register */
148
+ uint32_t csr_mtvec ; /* Machine trap-handler base address */
149
+ uint32_t csr_misa ; /* ISA and extensions */
150
+ uint32_t csr_mtval ; /* Machine bad address or instruction */
151
+ uint32_t csr_mcause ; /* Machine trap cause */
152
+ uint32_t csr_mscratch ; /* Scratch register for machine trap handler */
153
+ uint32_t csr_mepc ; /* Machine exception program counter */
154
+ uint32_t csr_mip ; /* Machine interrupt pending */
155
+ uint32_t csr_mie ; /* Machine interrupt enable */
156
+ uint32_t csr_mideleg ; /* Machine interrupt delegation register */
157
+ uint32_t csr_medeleg ; /* Machine exception delegation register */
158
+ uint32_t csr_mvendorid ; /* vendor ID */
159
+ uint32_t csr_marchid ; /* Architecture ID */
160
+ uint32_t csr_mimpid ; /* Implementation ID */
161
161
uint32_t csr_mbadaddr ;
162
162
163
163
uint32_t csr_sstatus ; /* supervisor status register */
@@ -171,7 +171,7 @@ struct riscv_internal {
171
171
uint32_t csr_stval ; /* supervisor trap value register */
172
172
uint32_t csr_satp ; /* supervisor address translation and protection */
173
173
174
- uint32_t priv_mode ; /* U-mode or S-mode or M-mode */
174
+ uint32_t priv_mode ; /* U-mode or S-mode or M-mode */
175
175
176
176
bool compressed ; /**< current instruction is compressed or not */
177
177
#if !RV32_HAS (JIT )
0 commit comments