Interrupt handling does not restore state
The interrupt handler in ivt.S
needs to be rewritten to handle hypervisor mode interrupts (HSRR0
/HSRR1
/hrfid
). With the current design, there is no way to redirect the interrupt to the appropriate hypervisor or kernel mode interrupt while still keeping the stub handler small enough to fit in the IVT. Additionally, the current stub handler clobbers the CR, which will eventually lead to misexecuted code after RFI.
A second stage trampoline may be required to fix this design. The hypervisor mode interrupts were enabled in Microwatt per ISA 3.x specifications back in August of 2023, and post-date the IVT design.
See https://gitlab.raptorengineering.com/kestrel-collaboration/kestrel-litex/litex/-/commit/ef448afd9c11dbb63dda340131a5570223d3b33e for an example of hypervisor mode external interrupt handling.