Reputation: 3949
Interrupt handlers occur asynchronously and hence cannot be called by other functions. Then, why do interrupt handlers in the linux kernel return a value ? How are the input arguments passed to it ?
Upvotes: 2
Views: 8327
Reputation: 1
Interrupt vector code vs. multiple attached interrupt handlers (OS-specific) to an interrupt—handlers can return a value (which typically goes into a register like EAX on x86), so that vector code can manage a chain of handlers.
Upvotes: 0
Reputation: 702
Interrupt handlers have a return value for a couple of reasons.
Upvotes: 4
Reputation: 15406
Interrupt handlers are not interrupt vector. Interrupt vector is the code the processor jumps to when an interrupt is triggered. This is a gross simplification, but here is how it looks :
interrupt_vector {
num = check_interrupt_number()
f = get_interrupt_handler_func(num);
d = get_interrupt_handler_data(num);
/* call interrupt handler */
ret = f(d);
}
So handler and data are registered together, and the interrupt vector code call the registererd handler, passing the registered data, and checks the return value. Of course, here we have a single level of handler, but you can have several, with for example one handler for all PCI Irq, that in turns checks for registered handler for a specific PCI irq and eventually calls itn passing registered data etc...
Of course, real code tends to be much more complicated. You can try this lxr link to navigate through the linux kernel sources
Upvotes: 1