多处理器系统中的中断描述符表(Interrupt descriptor table in multiprocessor system)

编程入门 行业动态 更新时间:2024-10-24 01:54:15
多处理器系统中的中断描述符表(Interrupt descriptor table in multiprocessor system)

我在多处理器系统中读到,每个处理器都有自己的中断描述符表(IDT)副本,并使用全局描述符表(GDT)的一个副本。

为什么处理器不能使用IDT的一个副本?

I read that in multiprocessor system each processor has its own copy of interrupt descriptor table (IDT) and they use one copy of global descriptor table (GDT).

Why processors can't use one copy of IDT?

最满意答案

我从使用术语GDT的角度来假设您正在询问x86和/或x86-64处理器。

每个x86处理器(准确地说,硬件线程)都有自己独立的IDTR和GDTR寄存器。 这允许,但不要求操作系统在每个处理器上使用不同的IDT和GDT。

x86中的中断向量空间为8位,其中32位保留,留下224个中断。 在许多平台中,这不是足够明显的中断向量。 通过在每个处理器上使用不同的IDT,操作系统可以为每个处理器分配最多224个不同的中断向量。 (但是,你不应该假设所有的操作系​​统都这么做。)

相比之下,GDT最多可以容纳8191个描述符*,远远超过大多数操作系统使用的数量,所以几乎不需要操作系统在每个处理器上使用单独的GDT。

* GDT条目0不能使用,因为索引为0的选择器被认为是空选择器。 在64位模式下,系统描述符扩展为16字节,而代码和数据描述符保留8个字节,所以GDT中可能的条目总数取决于当前描述符的类型。

I assume from the use of the term GDT that you are asking about an x86 and/or x86-64 processor.

Each x86 processor (hardware thread, to be precise) has its own separate IDTR and GDTR registers. This allows, but does not require, the OS to use a distinct IDT and GDT on each processor.

The interrupt vector space in x86 is 8 bits, of which 32 are reserved, leaving 224 interrupts. In many platforms this is not enough distinct interrupt vectors. By using a distinct IDT on each processor, the OS can assign up to 224 distinct interrupt vectors per processor. (However, you should not assume that all OSes do this.)

In contrast, the GDT can hold up to 8191 descriptors*, which is far, far more than most OSes use, so there is rarely any need for an OS to use separate GDTs on each processor.

* GDT entry 0 cannot be used, because a selector with index 0 is considered a null selector. In 64-bit mode, system descriptors are extended to 16 bytes, while code and data descriptors remain 8 bytes, so the total number of entries possible in the GDT depends on the types of descriptors present.

更多推荐

本文发布于:2023-08-06 15:17:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1450374.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:多处   系统   Interrupt   descriptor   multiprocessor

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!