Intel 253668-032US User Manual

Page of 806
17-28   Vol. 3
8086 EMULATION
rupt handler in the protected-mode IDT pointed to by the interrupt vector. See 
Section 17.3.1, “Class 1—Hardware Interrupt and Exception Handling in Virtual-8086 
Mode”
, for a complete description of this mechanism and its possible uses.
17.3.3.2   Methods 2 and 3: Software Interrupt Handling
When a software interrupt occurs in virtual-8086 mode and the method 2 or 3 condi-
tions are present, the processor generates a general-protection exception (#GP). 
Method 2 is enabled when the VME flag is set to 0 and the IOPL value is less than 3. 
Here the IOPL value is used to bypass the protected-mode interrupt handlers and 
cause any software interrupt that occurs in virtual-8086 mode to be treated as a 
protected-mode general-protection exception (#GP). The general-protection excep-
tion handler calls the virtual-8086 monitor, which can then emulate an 8086-
program interrupt handler or pass control back to the 8086 program’s handler, as 
described in Section 17.3.1.2, “Handling an Interrupt or Exception With an 8086 
Program Interrupt or Exception Handler”
.
Method 3 is enabled when the VME flag is set to 1, the IOPL value is less than 3, and 
the corresponding bit for the software interrupt in the software interrupt redirection 
bit map is set to 1. Here, the processor performs the same operation as it does for 
method 2 software interrupt handling. If the corresponding bit for the software inter-
rupt in the software interrupt redirection bit map is set to 0, the interrupt is handled 
using method 6 (see Section 17.3.3.5, “Method 6: Software Interrupt Handling”).
17.3.3.3   Method 4: Software Interrupt Handling
Method 4 handling is enabled when the VME flag is set to 1, the IOPL value is 3, and 
the bit for the interrupt vector in the redirection bit map is set to 1. Method 4 soft-
ware interrupt handling allows method 1 style handling when the virtual mode exten-
sion is enabled; that is, the interrupt is directed to a protected-mode handler (see 
Section 17.3.3.1, “Method 1: Software Interrupt Handling”).
17.3.3.4   Method 5: Software Interrupt Handling
Method 5 software interrupt handling provides a streamlined method of redirecting 
software interrupts (invoked with the INT n instruction) that occur in virtual 8086 
mode back to the 8086 program’s interrupt vector table and its interrupt handlers. 
Method 5 handling is enabled when the VME flag is set to 1, the IOPL value is 3, and 
the bit for the interrupt vector in the redirection bit map is set to 0. The processor 
performs the following actions to make an implicit call to the selected 8086 program 
interrupt handler:
1. Pushes the low-order 16 bits of the EFLAGS register onto the stack.
2. Pushes the current values of the CS and EIP registers onto the current stack. 
(Only the 16 least-significant bits of the EIP register are pushed and no stack 
switch occurs.)