一个 32 位的 APIC ID 怎么能放在一个 8 位的 IOAPIC 目标字段中的 4 位之内?

How can a 32-bit APIC ID fit inside 4 bits out of an 8-bit IOAPIC destination field?

阅读 OSDev Wiki article 和英特尔文档中关于两种不同的可用 APIC 类型的文章链接给我留下的问题多于答案,特别是在涉及字段长度时。根据这两个消息来源,IOAPIC 目标字段应该在第 56-59 位中包含一个本地 APIC ID——这是 8 位字段中的 4 位:

Destination field. If the destination mode bit was clear, then the lower 4 bits contain the bit APIC ID to sent the interrupt to. If the bit was set, the upper 4 bits also contain a set of processors. (See below)

然而,根据相同的消息来源,LAPIC 寄存器中的 ID 和其他所有内容都是 32 位长:

The local APIC registers are memory mapped to an address that can be found in the MP/MADT tables. Make sure you map these to virtual memory if you are using paging. Each register is 32 bits long, and expects to be written and read as a 32 bit integer. Although each register is 4 bytes, they are all aligned on a 16 byte boundary.

这引出了一个问题:发送中断的 APIC 的 ID 怎么可能适合那里?

同样有趣的是,如果 IOAPIC 配置为逻辑模式,那些高 4 位应该包含一个 CPU 内核列表以发送中断,考虑到大多数现代 CPUs 有超过 4 个内核(尽管我自己的 i5-8400)但这是一个完全不同的话题。

通过查看 here 解决了我自己的问题。事实证明,只有 ID 值的第 24-32 位是实际 ID;其他的都只是填充。