Virtual 8086 mode
||This article needs additional citations for verification. (December 2009)|
|Microprocessor modes for the x86 architecture|
|First supported platform shown in parentheses|
In the 80386 microprocessor and later, virtual 8086 mode (also called virtual real mode, V86-mode or VM86) allows the execution of real mode applications that are incapable of running directly in protected mode while the processor is running a protected mode operating system.
VM86 mode uses a segmentation scheme identical to that of real mode (for compatibility reasons) which creates 20-bit linear addresses in the same manner as 20-bit physical addresses are created in real mode, but are subject to protected mode's memory paging mechanism.
It is used to execute DOS programs in Windows/386, Windows 3.x, Windows 9x/Me, and OS/2 2.x and later through virtual DOS machines, in SCO UNIX through Merge, and in Linux through dosemu. NTVDM in x86 Windows NT based operating systems also use VM86 mode, but with very limited direct hardware access.
Protected mode DOS programs, either 16 or 32-bit, do not execute in virtual 8086 mode, but rather in user mode (as long as they are DPMI compatible), so the above emulators actually do more than just supporting the virtual 8086 mode.
Memory addressing 
The most common problem by running 8086 code from protected mode is memory addressing which is totally different between protected mode and real mode. As mentioned, by working under VM86 mode the segmentation mechanism is reconfigured to work just like under real mode, but the paging mechanism is still active, and it is transparent to the real mode code; thus, memory protection is still applicable, and so is the isolation of the address space.
When interrupts (both hardware, software and int instruction) occur, the processor switches off the VM86 mode and returns to work in full protected mode to handle the interrupt. And before servicing the interrupt, the DS, ES, FS, and GS registers are pushed on the new stack and zeroed.
Virtual-8086 Mode Enhancements Identification 
Support of Enhanced Virtual 8086 mode can be identified under Linux by "vme" flag in the /proc/cpuinfo file (Under "flags:" section).
Identification can be generally done also using cpuid instruction, whereas result value of 2nd bit (bit no.1, 0x2 in value) in EDX register represents support of Enhanced Virtual 8086 mode.
64-bit support 
Support for Virtual 8086 mode is not available in x86-64 Long Mode, although it is still present on 64-bit capable processors running in 32-bit protected mode. The removal of this sub-mode means that 16-bit compatibility must be rewritten or removed from 64-bit operating systems. For example, DOS and 16-bit Windows application support is not present in x64 editions of Windows, necessitating the use of 3rd party emulation software such as DOSBox.