Kernel/riscv64: Only enable interrupts in trap handler if they were on

Always enabling interrupts is in hindsight obviously a bug, as trapping
code that has interrupts disabled very likely expects that they stay
disabled.
This commit is contained in:
Sönke Holz 2024-02-28 15:54:26 +01:00 committed by Andrew Kaster
parent 6a223c6210
commit 1a312f4265

View File

@ -60,7 +60,8 @@ extern "C" void trap_handler(TrapFrame& trap_frame)
// Exception
Processor::current().enter_trap(trap_frame, false);
Processor::enable_interrupts();
if (trap_frame.regs->sstatus.SPIE == 1)
Processor::enable_interrupts();
using enum RISCV64::CSR::SCAUSE;
switch (scause) {