自定义中断描述符表混乱

发布于 2024-11-26 13:33:44 字数 404 浏览 1 评论 0原文

我正在编写一个在保护模式下运行的小型操作系统。我现在想要加载自定义中断描述符表,但我不知道从哪里开始。我已经阅读了 OS Dev wiki 上的一些内容,但有一些问题需要回答。

在 OS Dev wiki 上,它说前 32 个 (0-31) 中断被 CPU 保留和使用,作为例外,所以不要将它们用于 API 或 IRQ。 事情是这样的如果我加载自定义中断表,我是否必须为所有这些中断提供条目?

此外,wiki 指出 BIOS 将 IRQ0-7 映射到中断 8-15。如果是这样的话,IRQ中断岂不是和保留中断冲突了?

有什么我没有得到的吗?中断 0-31 是否在单独的表中?有人请给我指出正确的方向并澄清事情。

I'm writing a small OS that runs under protected mode. I am coming to a point where I want to load a custom interrupt descriptor table, and I don't know where to start. I have read some stuff on the OS Dev wiki, but there are a few questions that I need answered.

On the OS Dev wiki, it says that the first 32 (0-31) interrupts are reserved and used by the CPU, as exceptions, so don't use those for APIs or IRQs. The thing is that, if I am loading my custom interrupt table, don't I have to provide entries for all of those interrupts?

Also, the wiki states that the BIOS maps IRQ0-7 to interrupts 8-15. If this is the case, wouldn't the IRQ interrupts conflict with the reserved interrupts?

Is there something that I am not getting? Are interrupts 0-31 in a separate table or something? Someone please point me in the right direction and clear things up.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

九公里浅绿 2024-12-03 13:33:44

当它说不要将这些[中断 0-31] 用于 API 或 IRQ 时,这意味着您不应该将它们用于除它们保留的异常之外的功能。您确实需要为这些中断定义处理程序,以便可以在异常发生时对其进行处理。请参阅OSDev 的异常页面,获取异常列表及其中断号和说明。

当处理器启动时,它处于实模式。在这种模式下,异常情况较少,因此保留处理异常的中断也较少。只要处理器处于实模式,就可以安全地使用中断 8-15 作为 IRQ。在保护模式下启用中断之前,需要将 IRQ 重新映射到不同的中断。请参阅 初始化部分 OSDev 的 PIC(可编程中断控制器)页面,了解如何执行此操作的信息。

When it says don't use those [interrupts 0-31] for APIs or IRQs, it means you shouldn't use them for a function other than the exceptions they are reserved for. You do need to define handlers for these interrupts so that you can handle the exceptions when they occur. See OSDev's exception page for a list of the exceptions with their interrupt number and description.

When the processor starts up, it is in real mode. In this mode, there are fewer exceptions, so fewer interrupts are reserved to handle them. As long as the processor is in real mode, it is safe to use interrupts 8-15 for IRQs. Before you enable interrupts in protected mode, you need to remap the IRQs to different interrupts. See the Initialization section of OSDev's PIC (Programmable Interrupt Controller) page for information on how to do this.

谁许谁一生繁华 2024-12-03 13:33:44

前 32 个 (0-31) 中断被保留并由 CPU 作为例外使用,因此不要将它们用于 API 或 IRQ。

这是关于谁可以发出中断。 0-31用于CPU本身的事件(内部,例如页面错误,除以零..),其他用于外部事件(硬件启动,例如键盘按下,pci中断等)。
这与 IDT 无关。您应该提供表中的所有中断。

the first 32 (0-31) interrupts are reserved and used by the CPU, as exceptions, so don't use those for APIs or IRQs.

This is about WHO can emit the interrupt. 0-31 are for events of CPU itself (internal, e.g. page fault, divide by zero..) and other are for external events (hardware initiated, e.g. keyboard press, pci interrupt, etc).
This is not about IDT. You should provide all interrupts in the table.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文