Skip to content

Commit c629231

Browse files
YenHaoChenSuHo-llrr
authored andcommitted
typo: HPM counters consider previous privilege mode if changed
1 parent 13d7aa9 commit c629231

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

riscv/csrs.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1039,7 +1039,7 @@ reg_t wide_counter_csr_t::written_value() const noexcept {
10391039
// Note that minstretcfg / mcyclecfg / mhpmevent* share the same inhibit bits.
10401040
bool wide_counter_csr_t::is_counting_enabled() const noexcept {
10411041
auto prv = state->prv_changed ? state->prev_prv : state->prv;
1042-
auto v = state->v_changed ? state->v : state->prev_v;
1042+
auto v = state->v_changed ? state->prev_v : state->v;
10431043
auto mask = MHPMEVENT_MINH;
10441044
if (prv == PRV_S) {
10451045
mask = v ? MHPMEVENT_VSINH : MHPMEVENT_SINH;

0 commit comments

Comments
 (0)