开发者

Who initializes the IDT, the kernel or the processor?

开发者 https://www.devze.com 2023-02-13 10:00 出处:网络
This is from Wikipedia... The Interrupt Descriptor Table (IDT) is a data structure used by the x86 architecture to implement an interrupt

This is from Wikipedia...

The Interrupt Descriptor Table (IDT) is a data structure used by the x86 architecture to implement an interrupt vector table. The IDT is used b开发者_运维百科y the processor to determine the correct response to interrupts and exceptions...In the 8086 processor, the IDT resides at a fixed location in memory from address 0x0000 to 0x03ff...

This is from http://www.linuxjournal.com/article/4048?page=0,1

When start_kernel (found in /usr/src/linux/init/main.c) is called, it invokes trap_init (found in /usr/src/linux/kernel/traps.c). trap_init sets up the IDT via the macro set_trap_gate (found in /usr/include/asm/system.h) and initializes the interrupt descriptor table as shown in the “Offset Descriptionis” table.

I am pretty confused because these two descriptions seem contrasting... The first one says that the IDT is related to the processor and is independent of the kernel(in fact it doesn't even lie within the kernel). The second one says that the Linux kernel initializes the IDT and implements the code for the ISRs and all the code for the ISRs lies within the kernel.

Also, when a device generates an interrupt to the CPU, whether it is the kernel or the processor which is responsible for the execution of the interrupt routines? Kindly explain this to me...Thank you in advance


I guess its the kernel who loads & initializes the IDT.[Source]

Remember that before the kernel enables the interrupts, it must load the initial address of the IDT table into the idtr register and initialize all the entries of that table. This activity is done while initializing the system.

The IDT is initialized and used by the BIOS routines while the computer still operates in Real Mode. Once Linux takes over, however, the IDT is moved to another area of RAM and initialized a second time, because Linux does not use any BIOS routine.

Check out following links :

  • Initializing the Interrupt Descriptor Table


The BIOS sets up the initial IDT, which is used by the BIOS and boot loaders. It could also be used by 16-bit operating systems, since it standardizes the hardware interface, such as the INT 10h instruction which handles some video output. When a 32 or 64-bit kernel boots it has to specify its own IDT in order to switch into Protected Mode.


The IDT consists of a number of adresses of interrupt functions at some memory location.

A default IDT is set up by the BIOS when the system boots.

When the kernel boots it normally sets up its own one.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号