The 80386 processor supports concurrent execution of one or more 8086 programs within the protected mode environment. There is no longer a need for the processor to switch back to real mode in order to simulate an 8086 machine.
An 8086 program runs in protected mode as part of a virtual 8086 task. Virtual 8086 tasks are able to take advantage of the 80386 hardware support for multitasking, offered in protected mode. Virtual 8086 tasks may execute concurrently with one another and with other protected mode tasks in the system.
The purpose of the virtual 8086 task is to form a virtual machine for running programs written for the 8086 processor. A complete virtual machine consists of the 80386 processor support, plus additional support from operating system software:
While running in virtual-8086 mode the processor does not treat the contents of the segment as an index into a descriptor table, but the linear address is formed in exactly in the same way as it is done by the 8086 processor. With paging, enabled the address is then mapped to a physical address by the address translation hardware. When paging is not being used, the linear address is the physical address. This means that when there is a requirement for multiple virtual-8086 tasks, paging must enabled. Figure "Virtual 8086 Environment - Memory Management" shows the way in which the memory used by virtual 8086 machines is mapped into the system's physical address space.
Virtual 8086 tasks execute at privilege level 3 (lowest) and are subject to all of the protection checks defined in protected mode, thereby preventing an ill-behaved application from accessing and potentially corrupting memory used by other tasks in the system.
All I/O is normally handled through the I/O permission map in the 80386 TSS for both virtual 8086 applications and other protected mode applications. This means that any call to I/O services generates an exception which is trapped by the 80386 and may then be handled by the operating system. Any unauthorized calls may be trapped within the operating system, thus preventing an ill-behaved application from "hanging" the system.
In addition, the 80386 paging hardware allows virtual 8086 tasks to share segments.