Skip to content

Commit 1e01ff4

Browse files
committed
fix(difftest): correct the bits of timer/external interrupts
Previously, spike-difftest would raise the following interrupts under the guide: - For timer interrupts (0xa0): 5 (Supervisor), 7 (Machine) - For external interrupts (0xb00): 8 (user, deprecated), 9 (Supervisor), 11 (Machine). This part was overlooked when supporting H-extension. This patch adds the new interrupts (virtual supervisor timer, virtual supervisor external, supervisor guest external) from H-extension and removes the deprecated user timer interrupt. Now spike-difftest raises the following interrupts under the guide: - For timer interrupts (0xe0): 5 (Supervisor), 6 (Virtual Supervisor), 7 (Machine) - For external interrupts (0x1e00): 9 (Supervisor), 10 (Virtual Supervisor), 11 (Machine), 12 (Supervisor Guest)
1 parent 8db172d commit 1e01ff4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

difftest/difftest.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,10 @@ void DifftestRef::raise_intr(uint64_t no) {
380380
p->halt_request = p->HR_NONE;
381381
} else {
382382
uint64_t mip_bit = 0x1UL << (no & 0xf);
383-
bool is_timer_interrupt = mip_bit & 0xa0UL;
384-
bool is_external_interrupt = mip_bit & 0xb00UL;
383+
bool is_timer_interrupt = mip_bit & 0xe0UL;
384+
// 0xe0: 5 (Supervisor), 6 (Virtual supervisor), 7 (Machine)
385+
bool is_external_interrupt = mip_bit & 0x1e00UL;
386+
// 0x1e00: 9 (Supervisor), 10 (Virtual supervisor), 11 (Machine), 12 (Supervisor guest)
385387
bool from_outside = !(mip_bit & state->mip->read());
386388
bool external_set = (is_timer_interrupt || is_external_interrupt) && from_outside;
387389
if (external_set) {

0 commit comments

Comments
 (0)