Vol. 3 17-17
8086 EMULATION
In virtual-8086 mode, the interrupts and exceptions are divided into three classes for
the purposes of handling:
• Class 1 — All processor-generated exceptions and all hardware interrupts,
including the NMI interrupt and the hardware interrupts sent to the processor’s
external interrupt delivery pins. All class 1 exceptions and interrupts are handled
by the protected-mode exception and interrupt handlers.
• Class 2 — Special case for maskable hardware interrupts (Section 6.3.2,
“Maskable Hardware Interrupts”) when the virtual mode extensions are enabled.
• Class 3 — All software-generated interrupts, that is interrupts generated with
the INT n instruction
1
.
The method the processor uses to handle class 2 and 3 interrupts depends on the
setting of the following flags and fields:
• IOPL field (bits 12 and 13 in the EFLAGS register) — Controls how class 3
software interrupts are handled when the processor is in virtual-8086 mode (see
Section 2.3, “System Flags and Fields in the EFLAGS Register”). This field also
controls the enabling of the VIF and VIP flags in the EFLAGS register when the
VME flag is set. The VIF and VIP flags are provided to assist in the handling of
class 2 maskable hardware interrupts.
• VME flag (bit 0 in control register CR4) — Enables the virtual mode extension
for the processor when set (see Section 2.5, “Control Registers”).
• Software interrupt redirection bit map (32 bytes in the TSS, see
Figure 17-5) — Contains 256 flags that indicates how class 3 software
interrupts should be handled when they occur in virtual-8086 mode. A software
interrupt can be directed either to the interrupt and exception handlers in the
currently running 8086 program or to the protected-mode interrupt and
exception handlers.
• The virtual interrupt flag (VIF) and virtual interrupt pending flag (VIP)
in the EFLAGS register — Provides virtual interrupt support for the handling
of class 2 maskable hardware interrupts (see Section 17.3.2, “Class 2—Maskable
Hardware Interrupt Handling in Virtual-8086 Mode Using the Virtual Interrupt
Mechanism”).
NOTE
The VME flag, software interrupt redirection bit map, and VIF and VIP
flags are only available in IA-32 processors that support the virtual
mode extensions. These extensions were introduced in the IA-32
architecture with the Pentium processor.
The following sections describe the actions that processor takes and the possible
actions of interrupt and exception handlers for the two classes of interrupts described
1. The INT 3 instruction is a special case (see the description of the INT n instruction in Chapter 3,
“Instruction Set Reference, A-M”, of the Intel® 64 and IA-32 Architectures Software Developer’s
Manual, Volume 2A).