From 99d5c26cec50c6bd4ac6d409691e909ba37b20c4 Mon Sep 17 00:00:00 2001 From: Atul Khare Date: Fri, 7 Jul 2023 10:47:46 -0700 Subject: Add Smcdeleg CSR+constants Adds CSR scountinhibit (0x120), MSTATEEN0.CD (bit 56), and siselect range (0x40 - 0x5F). --- constants.py | 1 + encoding.h | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/constants.py b/constants.py index 98c4b7c..d345454 100644 --- a/constants.py +++ b/constants.py @@ -108,6 +108,7 @@ csrs = [ (0x10D, 'sstateen1'), # Smstateen (0x10E, 'sstateen2'), # Smstateen (0x10F, 'sstateen3'), # Smstateen + (0x120, 'scountinhibit'), # Smcdeleg (0x140, 'sscratch'), (0x141, 'sepc'), (0x142, 'scause'), diff --git a/encoding.h b/encoding.h index d2dc4c2..40cf2f7 100644 --- a/encoding.h +++ b/encoding.h @@ -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 @@ -196,6 +197,18 @@ #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 #define HSTATEEN0_JVT 0x00000004 -- cgit v1.1