Skip to content

Commit

Permalink
add base verify_permission in counter_proxy_csr_t::verify_permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
Weiwei Li committed Jul 8, 2022
1 parent fdb01a5 commit bc70815
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions riscv/csrs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,8 @@ bool counter_proxy_csr_t::myenable(csr_t_p counteren) const noexcept {
}

void counter_proxy_csr_t::verify_permissions(insn_t insn, bool write) const {
proxy_csr_t::verify_permissions(insn, write);

const bool mctr_ok = (state->prv < PRV_M) ? myenable(state->mcounteren) : true;
const bool hctr_ok = state->v ? myenable(state->hcounteren) : true;
const bool sctr_ok = (proc->extension_enabled('S') && state->prv < PRV_S) ? myenable(state->scounteren) : true;
Expand Down

0 comments on commit bc70815

Please sign in to comment.