World's most popular travel blog for travel bloggers.

[Solved]: How does the processor find kernel code after an interrupt?

, , No Comments
Problem Detail: 

When an interrupt occurs, the processor preempts the current process and calls kernel code to handle the interrupt. How does the processor know where to enter the kernel?

I understand that there are interrupt handlers which can be installed for each interrupt line. But since the processor only executes 'hardwired logic', there has to exist some predefined place that points to either an interrupt handler itself, or some code that executes before the handler (since there can be multiple handlers for one interrupt line, I assume the latter).

Asked By : Philipp Murry

Answered By : Adam Maras

On startup, the kernel will initialize an interrupt vector table (called an interrupt descriptor table or IDT on x86) that points to an interrupt handler for each line.

Before the 80286, the IDT was always stored at a fixed address; starting with the 80286, the IDT is loaded using the LIDT instruction.

Interrupt vector tables point to a single handler per interrupt line; that being said, a kernel could choose to, for example, provide an interrupt handler that runs several other interrupt routines, or provide a single handler that covers some or all interrupts. Linux does these things by providing a generic interrupt handler that determines which interrupt line was called and finds the appropriate downstream handler to call.

Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/29848

0 comments:

Post a Comment

Let us know your responses and feedback