Context switch on RISC-V

Yes, you have to manually save and restore all registers, and handle all interrupts/exceptions details, including dispatching to the handlers.

The RISC-V architecture is not optimised for context switches, like, for example the Cortex-M architecture, which directly calls C/C++ handlers, and delegates the context switching to a single PendSV handler:

1 Like