[LLVMdev] LLVM and Interrupt Service Routines.

Duncan Sands baldrick at free.fr
Fri Jul 24 09:29:34 PDT 2009


Hi Jakub,

> There can be significant differences between an interrupt handler and a
> void f(void) function.  An interrupt handler may have to:
> 
> - Save /all/ registers, including those that are normally caller saved.
> - Use a special return instruction (RETI).
> - Step over the "red zone" on the stack.
> - Set up a safe stack frame before calling normal functions.
> 
> I usually write the first level interrupt handler in assembler, and then
> call normal C function from there.

an Ada interrupt handler is registered using an Ada library routine.
The library might in fact route the interrupt to some assembler code
like you describe, which itself would then call the registered handler.
I don't know the details of how it is all made to work.

Ciao,

Duncan.



More information about the llvm-dev mailing list