diff options
author | YenHaoChen <howard25336284@gmail.com> | 2024-07-05 16:35:01 +0800 |
---|---|---|
committer | YenHaoChen <howard25336284@gmail.com> | 2024-07-06 03:30:41 +0800 |
commit | 6cc342bcfae27b398300acdaba2d27ee3ebeb2b1 (patch) | |
tree | 88b1c0c0119439afda96bda23f8594e00da2b72b | |
parent | eea20ae6a2c949079fbb5a8fa547a0f5a609cfc6 (diff) | |
download | spike-6cc342bcfae27b398300acdaba2d27ee3ebeb2b1.zip spike-6cc342bcfae27b398300acdaba2d27ee3ebeb2b1.tar.gz spike-6cc342bcfae27b398300acdaba2d27ee3ebeb2b1.tar.bz2 |
pointer masking: Let menvcfg.PMM be WARL if with Smnpm
-rw-r--r-- | riscv/csrs.cc | 7 | ||||
-rw-r--r-- | riscv/processor.cc | 1 |
2 files changed, 7 insertions, 1 deletions
diff --git a/riscv/csrs.cc b/riscv/csrs.cc index e076bb5..7996082 100644 --- a/riscv/csrs.cc +++ b/riscv/csrs.cc @@ -975,7 +975,12 @@ envcfg_csr_t::envcfg_csr_t(processor_t* const proc, const reg_t addr, const reg_ bool envcfg_csr_t::unlogged_write(const reg_t val) noexcept { const reg_t cbie_reserved = 2; // Reserved value of xenvcfg.CBIE - const reg_t adjusted_val = get_field(val, MENVCFG_CBIE) != cbie_reserved ? val : set_field(val, MENVCFG_CBIE, 0); + reg_t adjusted_val = get_field(val, MENVCFG_CBIE) != cbie_reserved ? val : set_field(val, MENVCFG_CBIE, 0); + + const reg_t pmm_reserved = 1; // Reserved value of xseccfg.PMM + const reg_t pmm = get_field(adjusted_val, MENVCFG_PMM); + adjusted_val = set_field(adjusted_val, MENVCFG_PMM, pmm != pmm_reserved ? pmm : 0); + return masked_csr_t::unlogged_write(adjusted_val); } diff --git a/riscv/processor.cc b/riscv/processor.cc index 7299548..2c3a5ee 100644 --- a/riscv/processor.cc +++ b/riscv/processor.cc @@ -388,6 +388,7 @@ void state_t::reset(processor_t* const proc, reg_t max_isa) if (proc->extension_enabled_const('U')) { const reg_t menvcfg_mask = (proc->extension_enabled(EXT_ZICBOM) ? MENVCFG_CBCFE | MENVCFG_CBIE : 0) | (proc->extension_enabled(EXT_ZICBOZ) ? MENVCFG_CBZE : 0) | + (proc->extension_enabled(EXT_SMNPM) ? MENVCFG_PMM : 0) | (proc->extension_enabled(EXT_SVADU) ? MENVCFG_ADUE: 0) | (proc->extension_enabled(EXT_SVPBMT) ? MENVCFG_PBMTE : 0) | (proc->extension_enabled(EXT_SSTC) ? MENVCFG_STCE : 0) | |