Skip to content

Commit 019cd2f

Browse files
Fix read value of CSR mip.
The read value of mip should only depend on the two bits, VSEIP and VSTIP of hvip. This PR fix the read value of CSR mip when Sscofpmf extension enabled. After implementing the Sscofpmf extension, hvip.LCOFIP became writable. This caused an issue where the entire value of hvip was OR-ed when reading mip. I revise the mip read logic to make it depend only on the hvip.VSEIP and hvip.VSTIP bits. Co-authored-by: Zhaoyang You <zyyou1998@gmail.com>
1 parent dc09460 commit 019cd2f

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
@@ -781,7 +781,7 @@ mip_csr_t::mip_csr_t(processor_t* const proc, const reg_t addr):
781781
}
782782

783783
reg_t mip_csr_t::read() const noexcept {
784-
return val | state->hvip->basic_csr_t::read();
784+
return val | (state->hvip->basic_csr_t::read() & (MIP_VSEIP | MIP_VSTIP));
785785
}
786786

787787
void mip_csr_t::backdoor_write_with_mask(const reg_t mask, const reg_t val) noexcept {

0 commit comments

Comments
 (0)