Skip to content

Commit

Permalink
SailBugfix: Bit 11 of medeleg is read-only zero
Browse files Browse the repository at this point in the history
In the official specification, the bit at position 11 is a read-only zero, which is currently not the case in Miralis.
  • Loading branch information
francois141 authored and CharlyCst committed Dec 1, 2024
1 parent ea4ee51 commit 1dd9696
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/virt/csr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,8 @@ impl HwRegisterContextSetter<Csr> for VirtContext {
mctx.hw.extensions.is_sstc_enabled = self.csr.menvcfg & menvcfg::STCE_FILTER != 0;
}
Csr::Mseccfg => self.csr.mseccfg = value,
Csr::Mconfigptr => (), // Read-only
Csr::Medeleg => self.csr.medeleg = value, //TODO : some values need to be read-only 0
Csr::Mconfigptr => (), // Read-only
Csr::Medeleg => self.csr.medeleg = value & !(1 << 11),
Csr::Mideleg => {
self.csr.mideleg = (value & hw.interrupts & !mie::MIDELEG_READ_ONLY_ZERO)
| mie::MIDELEG_READ_ONLY_ONE;
Expand Down

0 comments on commit 1dd9696

Please sign in to comment.