简体   繁体   English

CPU如何知道来自IVT的中断处理程序是BIOS函数还是映射到内存中的子例程

[英]How does the CPU know if an interrupt handler from an IVT is a BIOS function or a subroutine mapped in memory

From my basic understating of how interrupts work, when a software or hardware interrupt is invoked, the CPU looks in the IVT located in the first 1024 bytes of memory (in real mode), gets the interrupt handler address and start executing from that location. 根据我对中断工作原理的基本了解,当调用软件或硬件中断时,CPU查找位于内存的前1024个字节中的IVT(在实模式下),获取中断处理程序地址并从该位置开始执行。 Also, from what I understand, you can override the values in the IVT to point to your custom subroutines which can handle interrupts. 另外,据我了解,您可以覆盖IVT中的值,以指向可以处理中断的自定义子例程。

What I cannot understand is how BIOS functions work. 我不明白的是BIOS功能如何工作。 For example for int 0x10 , how does the CPU know that the interrupt corresponds to a BIOS function, and not a subroutine mapped in memory (calling the interrupt handler, whose address is stored 4 * 0x10 )? 例如对于int 0x10 ,CPU如何知道中断对应于BIOS函数,而不是映射到内存中的子例程(调用中断处理程序,其地址存储为4 * 0x10 )?

The CPU doesn't know. CPU不知道。 The BIOS is mapped into memory. BIOS映射到内存。 The address stored at 4 * 0x10 is the address of the INT 10H handler in the BIOS. 存储在4 * 0x10中的地址是BIOS中INT 10H处理程序的地址。

On startup, the BIOS initializes the interrupt table so that it points to BIOS routines. 启动时,BIOS初始化中断表,使其指向BIOS例程。

You could, if you wanted, save the address that's stored at 4 * 0x10 and replace it with the address of your own INT 10H handler. 如果需要,您可以保存存储在4 * 0x10中的地址,并将其替换为您自己的INT 10H处理程序的地址。 Not something I would suggest, by the way ... but it's possible. 顺便说一下,我没有建议...但是有可能。 That kind of thing was common with DOS interrupts back in the day. 这种事情在DOS中断中很常见。 A little less so with BIOS interrupts, but it was done from time to time. BIOS中断的情况要少一些,但有时会这样做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM