[LLVMdev] LLVM and Interrupt Service Routines.

Jakob Stoklund Olesen stoklund at 2pi.dk
Fri Jul 24 08:47:49 PDT 2009

Duncan Sands <baldrick at free.fr> writes:

> the interrupt handler itself is a parameterless procedure that does not
> return a value.  As such, I guess calling conventions and so forth are
> not very relevant for it :)  In any case llvm-gcc and gcc mainline seem
> to output the interrupt handler as an ordinary function on
> x86-32-linux.

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.

More information about the llvm-dev mailing list