KASSERTMSG((csr_read(sstatus) & (SSTATUS_SPP | SSTATUS_SIE)) ==
SSTATUS_SPP, "Came from S mode with interrupts enabled");
+ KASSERTMSG((csr_read(sstatus) & (SSTATUS_SUM)) == 0,
+ "Came from S mode with SUM enabled");
+
if (frame->tf_scause & EXCP_INTR) {
/* Interrupt */
riscv_cpu_intr(frame);
KASSERTMSG((csr_read(sstatus) & (SSTATUS_SPP | SSTATUS_SIE)) == 0,
"Came from U mode with interrupts enabled");
+ KASSERTMSG((csr_read(sstatus) & (SSTATUS_SUM)) == 0,
+ "Came from U mode with SUM enabled");
+
/* Save fpu context before (possibly) calling interrupt handler.
* Could end up context switching in interrupt handler.
*/