Skip to content

Commit

Permalink
fix(priv): do not check xstimecmp if normal permit is violated (#571)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tang-Haojin authored Oct 10, 2024
1 parent 079a180 commit ffe101a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/isa/riscv64/system/priv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1824,7 +1824,7 @@ static inline void csr_permit_check(uint32_t addr, bool is_write) {
has_vi |= csr_readonly_permit_check(addr, is_write);

// Attempts to access unprivileged counters without s/h/mcounteren
if ((addr >= 0xC00 && addr <= 0xC1F) || (addr == 0x14D) || (addr == 0x24D)) {
if (!has_vi && ((addr >= 0xC00 && addr <= 0xC1F) || (addr == 0x14D) || (addr == 0x24D))) {
has_vi |= csr_counter_enable_check(addr);
}
// check smstateen
Expand Down

0 comments on commit ffe101a

Please sign in to comment.