Skip to content

Commit

Permalink
Add Smcdeleg CSR+constants
Browse files Browse the repository at this point in the history
Adds CSR scountinhibit (0x120), MSTATEEN0.CD (bit 56), and siselect
range (0x40 - 0x5F).
  • Loading branch information
atulkharerivos committed Jul 12, 2023
1 parent be53d24 commit 37c3b7d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
(0x10D, 'sstateen1'), # Smstateen
(0x10E, 'sstateen2'), # Smstateen
(0x10F, 'sstateen3'), # Smstateen
(0x120, 'scountinhibit'), # Smcdeleg
(0x140, 'sscratch'),
(0x141, 'sepc'),
(0x142, 'scause'),
Expand Down
12 changes: 12 additions & 0 deletions encoding.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@
#define MSTATEEN0_FCSR 0x00000002
#define MSTATEEN0_JVT 0x00000004
#define MSTATEEN0_HCONTEXT 0x0200000000000000
#define MSTATEEN0_CD 0x0100000000000000
#define MSTATEEN0_HENVCFG 0x4000000000000000
#define MSTATEEN_HSTATEEN 0x8000000000000000

Expand Down Expand Up @@ -195,6 +196,17 @@
#define HENVCFGH_HADE 0x20000000
#define HENVCFGH_PBMTE 0x40000000
#define HENVCFGH_STCE 0x80000000
#define SISELECT_SMCDELEG_START 0x40
#define SISELECT_SMCDELEG_UNUSED 0x41
#define SISELECT_SMCDELEG_INSTRET 0x42
#define SISELECT_SMCDELEG_INSTRETCFG 0x42
/*
* ?iselect values for hpmcounters4..31 and hpmevent4..31
* can easily computed, and were elided for brevity.
*/
#define SISELECT_SMCDELEG_HPMCOUNTER_3 0x43
#define SISELECT_SMCDELEG_HPMEVENT_3 0x43
#define SISELECT_SMCDELEG_END 0x5f

#define HSTATEEN0_CS 0x00000001
#define HSTATEEN0_FCSR 0x00000002
Expand Down

0 comments on commit 37c3b7d

Please sign in to comment.