Virtual 8086 mode

From Wikipedia, the free encyclopedia

In the 80386 and later, Virtual 8086 mode, also called virtual real mode (or VM86), allows the execution of real mode applications that violate the rules under the control of a protected mode operating system.

It used the real mode way for segmentation, but used the 20-bit (actually 21-bit) address resulting from it as a linear address, so it is subject to paging.

It is used to execute DOS programs in Microsoft Windows/386 and Windows 3.x and Windows 9x and Windows Me and OS/2 2.x and later through Virtual DOS machines, in SCO UNIX through Merge and in Linux through dosemu.

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 do actually more than just supporting the virtual 8086 mode.

[edit] 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 returns 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.

[edit] Interrupts

When interrupts (both hardware, software and iret 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.

[edit] See also