You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[mip] MTIP/MEIP is software-writable via CSR write, which is read-only #275
In M-mode, writing mip with software can set the machine timer interrupt pending bit (MTIP, bit 7), which the privileged ISA requires to be read-only in mip.
Minimal trigger:
li t0,0x880 # MTIP | MEIPcsrw mip, t0csrr s0, mip # mismatch here
Write value: 0x880 = MTIP (bit 7) | MEIP (bit 11)
After csrr s0, mip at pc = 0x8000000a:
Sail (expected):s0 = 0x0
NutShell (actual):s0 = 0x80 (MTIP stuck at 1)
MEIP is also specified as read-only in mip (platform interrupt controller only). This seed demonstrates the violation on MTIP; the write attempts both read-only machine pending bits.
MEIP is read-only in mip, and is set and cleared by a platform-specific interrupt controller.
MTIP is read-only in the mip register, and is cleared by writing to the memory-mapped machine-mode timer compare register.
Software CSR writes to mip must not set MTIP/MEIP. With no real timer/external interrupt pending, a write of 0x880 followed by a read must leave those bits clear.
Activity