[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: 2.4.17: differences in arch/i386/kernel/entry.S ???
> In short, does anyone know full sequence of steps that take place when
> an interrupt is raised either in kernel or in user mode? Which
> functions get called, and, where are they stored in the source code?
>
Hi Lukas,
that's what I found in the 2.4 Kernel Sources, Linux Kernel Internals,
Understanding the Linux Kernel about interrupt handling on ia32:
All interrupt handlers perform the same 4 basic actions:
1. Save the IRQ value and the registers contents in the
Kernel Mode stack:
Code is stored in 'arch/i386/kernel/i8259.c':
27 /*
28 * Common place to define all x86 IRQ vectors
29 *
30 * This builds up the IRQ handler stubs using some ugly macros in
irq.h
31 *
32 * These macros create the low-level assembly IRQ routines that save
33 * register context and call do_IRQ(). do_IRQ() then does all the
34 * operations that are needed to keep the AT (or SMP IOAPIC)
35 * interrupt-controller happy.
36 */
Saving registers is the first task of the interrupt handler.
The interrupt handler for IRQn is named IRQn_interrupt, its
address is included in the interrupt gate stored in the
proper IDT entry.
The same BUILD_IRQ macro is duplicated 16 times, once for
each IRQ number, so you'll get 16 different interrupt
handler entry points. Each BUILD_IRQ expands to the following
assembly language fragment:
IRQn_interrupt:
pushl $n-256
jmp common_interrupt
This saves on the stack the IRQ number associated with the interrupt
minus 256 (Subtracting 256 from an IRQ number yields a negative number.
Positive numbers are reserved to identify system calls); the same code
for all interrupt handlers can then be executed while referring to this
number. The common code can be found in the BUILD_COMMON_IRQ macro,
which expands to the following assembly language fragment:
common_interrupt:
SAVE_ALL
call do_IRQ
jmp ret_from_intr
________________________________________________________________________
____
2. Send an acknowledgment to the PIC that is servicing the IRQ line,
thus allowing it to issue further interrupts.
Code is stored in ' arch/i386/kernel/irq.c':
That's not clear to me
________________________________________________________________________
3. Execute the interrupt service routines (ISRs) associated with all the
devices that share the IRQ.
Code is stored in ' arch/i386/kernel/irq.c':
558 /*
559 * do_IRQ handles all normal device IRQ's (the special
560 * SMP cross-CPU interrupts have their own specific
561 * handlers).
562 */
________________________________________________________________________
__
4. Terminate by jumping to the ret_from_intr( ) address.
Code is stored in ' arch/i386/kernel/entry.S':
...
248 ENTRY(ret_from_intr)
249 GET_CURRENT(%ebx)
250 ret_from_exception:
251 movl EFLAGS(%esp),%eax # mix EFLAGS and CS
252 movb CS(%esp),%al
253 testl $(VM_MASK | 3),%eax
...
Hope this helps,
Regards,
Thomas
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/