Adding the address of an exception/interrupt handler to the vector table

Ian Lance Taylor iant@google.com
Thu Apr 30 00:39:00 GMT 2009


John Farmer <news02@lavabit.com> writes:

> As far as I have been able to find out it is not possible to write an
> interrupt function where its address is added to a selectable position in
> the vector table automatically by the compiler/linker. Just to be certain
> would that be right?

Seems like it could be done pretty easily with a bit of assembly code or
with some linker script magic.

> Would I be correct in thinking that a normal function could be used as an
> ISR in which case I do not need to use the __attribute__((interrupt)) at
> all? If this is the case what is this attribute used for?

It depends on the details of your platform.  For ARM, the different
types of interrupt routines return to their caller in different ways, so
they can not be replaced by a regular function (though I think they
could be replaced by an assembly code wrapper).

Ian



More information about the Gcc-help mailing list