From 275c66844358d0603db02d5518c7b3e220653aa6 Mon Sep 17 00:00:00 2001 From: linzhida Date: Wed, 27 Nov 2024 13:39:47 +0800 Subject: [PATCH] Fix WMASK of LCOFI bit(bit 13) in hvip For implementations that support Smcdeleg/Ssccfg, Sscofpmf, Smaia/Ssaia, and the H extension, the LCOFI bit (bit 13) in each of hvip and hvien is implemented and writable. --- riscv/csrs.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/riscv/csrs.cc b/riscv/csrs.cc index a62f63ab9..83b9a4425 100644 --- a/riscv/csrs.cc +++ b/riscv/csrs.cc @@ -1836,7 +1836,8 @@ reg_t hvip_csr_t::read() const noexcept { bool hvip_csr_t::unlogged_write(const reg_t val) noexcept { state->mip->write_with_mask(MIP_VSSIP, val); // hvip.VSSIP is an alias of mip.VSSIP - return basic_csr_t::unlogged_write(val & (MIP_VSEIP | MIP_VSTIP)); + const reg_t lscof_int = proc->extension_enabled(EXT_SSCOFPMF) ? MIP_LCOFIP : 0; + return basic_csr_t::unlogged_write(val & (lscof_int | MIP_VSEIP | MIP_VSTIP)); } ssp_csr_t::ssp_csr_t(processor_t* const proc, const reg_t addr, const reg_t mask, const reg_t init):