2

这是来自维基百科...

中断描述符表 (IDT) 是 x86 架构用来实现中断向量表的数据结构。处理器使用 IDT 来确定对中断和异常的正确响应...在 8086 处理器中,IDT 驻留在内存中从地址 0x0000 到 0x03ff 的固定位置...

这是来自http://www.linuxjournal.com/article/4048?page=0,1

当 start_kernel(在 /usr/src/linux/init/main.c 中找到)被调用时,它会调用 trap_init(在 /usr/src/linux/kernel/traps.c 中找到)。trap_init 通过宏 set_trap_gate(位于 /usr/include/asm/system.h)设置 IDT 并初始化中断描述符表,如“Offset Descriptionis”表所示。

我很困惑,因为这两个描述似乎对比...第一个说 IDT 与处理器相关并且独立于内核(实际上它甚至不位于内核中)。第二个说 Linux 内核初始化 IDT 并实现 ISR 的代码,而 ISR 的所有代码都位于内核中。

另外,当设备向 CPU 产生中断时,是内核还是处理器负责执行中断例程?请向我解释一下......提前谢谢你

4

3 回答 3

2

BIOS 设置初始 IDT,供 BIOS 和引导加载程序使用。它也可以被 16 位操作系统使用,因为它标准化了硬件接口,例如处理一些视频输出的 INT 10h 指令。当 32 位或 64 位内核启动时,它必须指定自己的 IDT 才能切换到保护模式。

于 2011-03-01T05:07:41.403 回答
2

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 :

于 2011-02-26T18:34:44.573 回答
0

IDT 由位于某个内存位置的多个中断函数地址组成。

系统启动时,BIOS 会设置默认 IDT。

当内核启动时,它通常会设置自己的内核。

于 2011-02-26T17:53:05.823 回答