Commit 56a447e
committed
[sw-sysemu] Fix rvtimer write_mtimecmp immediate interrupt raise
When mtimecmp is written to a value already in the past (mtime >= mtimecmp)
and the interrupt was not previously asserted, raise the timer interrupt
immediately. This mirrors hardware behavior where the comparator fires as
soon as the condition is met.
If the interrupt was already asserted (MIP bit already set), no action is
needed — the hart already has a pending interrupt.
Without this fix, tickless kernels that write mtimecmp to a nearly-passed
value can deadlock: the internal interrupt flag is set but the hart MIP bit
is never updated, so the ISR never fires and no subsequent write_mtimecmp
call is made.1 parent 94ff61b commit 56a447e
1 file changed
+7
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
60 | 67 | | |
61 | 68 | | |
62 | 69 | | |
| |||
0 commit comments