Visible to Intel only — GUID: hnz1733389935501
Ixiasoft
Visible to Intel only — GUID: hnz1733389935501
Ixiasoft
9.2.2.2.3. Exception Dispatcher
Upon an exception, the CLINT-Vectored passes control to the exception dispatcher in vector table. As stated in the RISC-V specification, the exception dispatcher is at the vector table base address.
- Switches to the separate exception stack (if enabled)
- Stores register values onto the stack
- Stores all register values if the shadow register is disabled
- Stores the lower 16 general-purpose registers only if the shadow register is enabled. (This is not implemented in Altera HAL firmware.)
- Checks for a registered instruction-related exception handler.
- If an instruction-related handler is registered, the exception dispatcher calls it, then restores context and returns.
- If no instruction-related exception handler is registered,
- If processor debug module is enabled, the processor enters Debug Mode using the ebreak instruction. Allowing the debugger to take control.
- If there is no debug module, the processor enters an infinite loop.
Once the exception is serviced, and the exception handler returns to the exception dispatcher, it performs the following tasks:
- Restores the registers from the stack
- Restores all the registers if the shadow register is disabled
- Restores the lower 16 general-purpose registers only if the shadow register is enabled. (This is not implemented in Altera HAL firmware.)
- Restores the stack pointer (if a separate exception stack is used)
- Exits by issuing an MRET (exception return in machine mode) instruction
For more information on registering an instruction-related exception handler, refer to the Instruction-Related Exception Handler chapter.
For more information about the RISCV-based processor EBREAK instruction, refer to the The RISC-V Instruction Set Manual in RISC-V International website.