Skip to content

Commit 0a4f0b3

Browse files
binnochihminchao
authored andcommitted
zkr: enable write for useed/sseed fileds of mseccfg csr
1 parent 50c89ea commit 0a4f0b3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

riscv/csrs.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,11 @@ bool mseccfg_csr_t::unlogged_write(const reg_t val) noexcept {
322322
new_val |= (val & MSECCFG_MMWP); //MMWP is sticky
323323
new_val |= (val & MSECCFG_MML); //MML is sticky
324324

325+
if (proc->extension_enabled(EXT_ZKR)) {
326+
uint64_t mask = MSECCFG_USEED | MSECCFG_SSEED;
327+
new_val = (new_val & ~mask) | (val & mask);
328+
}
329+
325330
proc->get_mmu()->flush_tlb();
326331

327332
if (proc->extension_enabled(EXT_ZICFILP)) {

0 commit comments

Comments
 (0)