Virtual 8086 Mode

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:

  • The hardware provides a set of virtual registers (implemented through the TSS), a virtual memory space (the first 1MB of the 32-bit linear address space) and directly executes all instructions that deal with these registers and with this address space.

    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.

  • The operating system software controls the external interfaces of the virtual machine (I/O, interrupts, and exceptions). In the case of I/O, the operating system can choose either to emulate I/O instructions or to let the hardware execute them directly.

    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.


    [Back: Input/Output Processing]
    [Next: Numeric Coprocessor Utilization]