RISC-V Function Attributes (Using the GNU Compiler Collection (GCC)) (original) (raw)
Use this attribute to indicate that the specified function is an interrupt handler. The compiler generates function entry and exit sequences suitable for use in an interrupt handler when this attribute is present.
You can specify the kind of interrupt to be handled by adding an optional parameter to the interrupt attribute like this:
void f (void) attribute ((interrupt ("user")));
Permissible values for this parameter are user
, supervisor
, and machine
. If there is no parameter, then it defaults tomachine
.