[LLVMdev] LLVM and Interrupt Service Routines.
Chris Lattner
clattner at apple.com
Fri Jul 24 09:01:29 PDT 2009
On Jul 24, 2009, at 8:47 AM, Jakob Stoklund Olesen wrote:
> 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.
Wouldn't a custom calling convention work for all of these requirements?
-Chris
More information about the llvm-dev
mailing list