问题
i started with device driver for arm ... there i saw for each handler mention --- __attribute__((interrupt( irq )))
-.I am confused how this attribute will place a call to our driver routine ..??
IRQ of arm have following Vector address--- 0x00000018 (or 0xFFFF0018) As there can be many interrupt handler on same line. Suppose if we have 4 device driver each with its own IRQ to be reistered.
Means some startup code will be provided by the GCC compiler for the IRQ handler & compiler will place call to our routine in that startup code for interrupt handler ..... Am i right ...?
回答1:
From GCC docs for interrupt attribute:
The compiler generates function entry and exit sequences suitable for use in an interrupt handler when this attribute is present.
You can use objdump
easily to see how this attribute changes your binary which should clarify the situation for you much better.
回答2:
The attribute should ONLY be used by interrupt handler of the OS and NOT by interrupt handler of a specific driver. The OS will read the IRQ vector/number and call the appropriate driver function to service the IRQ. You only need to register your driver/ISR with the OS.
来源:https://stackoverflow.com/questions/13786605/gcc-attribute-interrupt-irq