RISC-V Topic Guide

Trap Handling

RISC-V trap handling covers mtvec/stvec entry selection, interrupt bits and cause codes in mcause/scause, trap state recorded in mepc/sepc and mtval/stval, context handoff through mscratch/sscratch, medeleg/mideleg delegation, and MRET/SRET return rules.

mtvecstvecmcausescausemepcsepcmtvalstvalmscratchsscratchMRETSRETmedelegmidelegmstatussstatus

Core Concepts

Related Entries

Official References

RISC-V behavior on this topic should be checked against the official specifications; content additions should only use facts verifiable in these documents.