Skip to main content
2 of 10
Rephrase to ask what I think is this is intending to ask, using more comprehensible and correct terminology. This is the same edit I made to the first version of the question on SO.

How does the BIOS distinguish Interrupt(08h-12h) from INT instructions, vs. actual exceptions inside the CPU?

This is purely academic, out of date, out of curiosity. Let's back to 1990s, before the Windows, when real-mode DOS programs were common.

The BIOS remapped the INT 08H+ for their own interrupt handler, for instance, int 10H for VGA MODE switch, int 13H for hard driver. (Table of software-interrupt numbers)

But, as we can see in Intel® 64 and IA-32 Architectures Software Developer Manuals, we can know that there are also many real-address exception that can cause interrupt. For example, #DE divide exception raising interrupt vector 0h, or x87 FPU raising 10h (https://wiki.osdev.org/IVT)

If a programmer intentionally or unintentionally makes the CPU raise those exceptions on its own, by running instructions like bound that can trigger a BOUND Range Exceeded exception, how does the BIOS or anything else distinguish that from an INT 5 software interrupt to make a PRINT SCREEN call, for instance. It's the same IVT entry so the same interrupt handler will be invoked for either case.

What's more, IRQ makes if you want to use keyboard you can't trigger those interrupts. (OSdev IRQ assignments table)

As so many Intel's default interrupt is remapped by the bios, things became unreasonable.

(This was originally asked on Stack Overflow).

THS
  • 383
  • 3
  • 7