简体   繁体   中英

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. Also, from what I understand, you can override the values in the IVT to point to your custom subroutines which can handle interrupts.

What I cannot understand is how BIOS functions work. 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 )?

The CPU doesn't know. The BIOS is mapped into memory. The address stored at 4 * 0x10 is the address of the INT 10H handler in the BIOS.

On startup, the BIOS initializes the interrupt table so that it points to BIOS routines.

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. 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. A little less so with BIOS interrupts, but it was done from time to time.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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