When I use riscv::register::mstatus::set_mie(); to enable global interrupts, the resulting assembly code is quite puzzling.
It does not use the csrsi instruction, but instead uses the csrs instruction.
The csrs instruction uses an additional register.
This causes two problems:
- Code bloat
- Toggling global interrupts becomes a non-atomic operation (which contradicts the RISC-V Privileges document)
When I use
riscv::register::mstatus::set_mie();to enable global interrupts, the resulting assembly code is quite puzzling.It does not use the
csrsiinstruction, but instead uses thecsrsinstruction.The
csrsinstruction uses an additional register.This causes two problems: