15.4.1 Assembly and ISRs

In certain applications, it may be necessary to insert assembly statements into the ISR immediately prior to the compiler-generated function prologue. For example, it may be required that a semaphore be incremented immediately on entry to an interrupt service routine. This can be done as follows:

void __attribute__((interrupt(auto_psv,preprologue
 (“inc _semaphore”)))) isr0(void);

The context switch leads to latency in interrupt code execution, as described in the 15.7.3 Latency section.