These function attributes are supported on the SH family of processors:
In an application, for a function being called once, this attribute saves at least 8 bytes of code; and if other successive calls are being made to the same function, it saves 2 bytes of code per each of these calls.
interrupt_handlerfunction should not save and restore registers R0..R7. This can be used on SH3* and SH4* targets that have a second R0..R7 register bank for non-reentrant interrupt handlers.
interrupt_handlerroutines. Saving to the bank is performed automatically after the CPU accepts an interrupt that uses a register bank.
The nineteen 32-bit registers comprising general register R0 to R14, control register GBR, and system registers MACH, MACL, and PR and the vector table address offset are saved into a register bank. Register banks are stacked in first-in last-out (FILO) sequence. Restoration from the bank is executed by issuing a RESBANK instruction.
interrupt_handlerfunction should switch to an alternate stack. It expects a string argument that names a global variable holding the address of the alternate stack.
void *alt_stack; void f () __attribute__ ((interrupt_handler, sp_switch ("alt_stack")));
interrupt_handlerto return using
rte. This attribute expects an integer argument specifying the trap number to be used.
interrupt_handlerbut it does not save and restore all registers.