Jump to content

8086 emulation mode

From Alfawiki
Virtual DOS Machine (VDM)
Company typeSoftware technology
IndustryComputer software
Founded1987
Headquarters
Various (technology used in Microsoft Windows, OS/2, Digital Research products)
ProductsVirtual DOS machine implementations (e.g., NTVDM, OS/2 MVDM, Windows/386 VDM)

Virtual DOS machines (VDM) facilitate the execution of 16-bit and 32-bit DOS as well as 16-bit Windows applications on a host operating system that controls the hardware resources.

Overview

VDMs function either through software emulation techniques such as dynamic recompilation or by utilizing the virtual 8086 mode available on the Intel 80386 processor. This mode executes real mode 8086 software within a safeguarded environment by intercepting hardware operations and redirecting them to the operating system for emulation purposes. Additionally, VDMs accommodate running 16-bit and 32-bit protected mode programs (DOS extenders) that conform to the DOS Protected Mode Interface (DPMI) standard.

When DOS applications running inside a VDM attempt to interact with hardware peripherals, Windows either grants direct access or employs a virtual device driver (VDD) to simulate hardware functionality through OS-level services. VDMs emulate key components such as Intel's 8259A interrupt controllers, the 8254 timer chip, the 8237 DMA controller, among others.

Concurrent DOS 8086 Emulation Mode

In early 1985, Digital Research in collaboration with Intel showcased Concurrent DOS 286 1.0, which enabled running real mode DOS applications within the protected mode of the 80286 CPU. Although initial processor stepping problems postponed its release, improvements using the undocumented LOADALL instruction reinstated functionality despite limited performance. This method served as a precursor to contemporary virtual DOS machine implementations.

The Concurrent DOS 286 platform later evolved into the industrial-oriented FlexOS 286 in 1986 and was licensed by IBM for use in their 4680 OS. With Intel’s introduction of the 80386 processor featuring virtual 8086 mode (prototype chips appeared in late 1985 with widespread availability by mid-1986), Digital Research incorporated this technology into Concurrent DOS 386 1.0 (1987) and its counterpart, FlexOS 386 1.0. These multiuser, multitasking operating systems operated in protected mode but were not based on DOS.

Subsequently, Concurrent DOS 386 was rebranded as Multiuser DOS in 1991 and later as REAL/32 in 1995, while FlexOS 386 transitioned into the 4690 OS by 1993.

DOS-based VDMs

Unlike protected-mode operating systems, DOS inherently runs in real mode and only switches to protected or virtual 86 modes through memory managers or DOS extenders to access extended memory or remap memory into the first megabyte accessible to DOS programs.

DOS-based virtual DOS machines were first introduced by Microsoft with Windows/386 2.01 in September 1987. They were also integrated into versions such as Windows 3.0, 3.1x, and Windows for Workgroups 3.1x running in 386 Enhanced Mode, as well as later editions including Windows 95, 98, 98 SE, and ME. These VDMs create virtualized instances of the DOS environment along with its driver configurations loaded before the multitasking layer, forwarding requests that cannot be processed in protected mode back to the underlying DOS system.

In a manner similar to Windows 3.x’s 386 Enhanced Mode, the EMM386 version 3.xx found in Novell DOS 7, Caldera OpenDOS 7.01, and DR-DOS 7.02 employs DOS-based VDMs to enable preemptive multitasking across multiple DOS applications via the EMM386 /MULTI parameter. Originally developed by Digital Research / Novell starting in 1991 under the codename "Vladivar," this functionality was initially implemented as a distinct device driver (KRNL386.SYS) before being merged into EMM386 itself. It first appeared in Novell DOS 7 (1994) and was intended for projects that never reached release, such as DR DOS "Panther" and the "Star Trek" initiative during 1992–1993.

OS/2 Multiple Virtual DOS Machines (MVDM)

Starting with OS/2 version 2.0 released in 1992, Multiple Virtual DOS Machines (MVDMs) provide enhanced functionality compared to NTVDM, such as support for block devices and the ability to boot different DOS versions within an OS/2 MVDM environment. In contrast to OS/2 1.x, which utilized a DOS box based on DOS 3.0, the MVDMs in OS/2 2.x emulate DOS version 5.0.

OS/2 supports smooth operation of Windows 3.1 and subsequent Win32s applications, conceptually akin to the XP Mode feature in Windows 7 but realized through distinct technological means. Disk access on the OS/2 or NT host is managed by a redirector within the guest VDM or NTVDM, while communication between guest applications and the host system occurs via named pipes.

A technical constraint limited DOS and 16-bit Windows applications running under OS/2 from utilizing more than 2 GB of hard disk space; this restriction was lifted with the release of ArcaOS 5.0.4.

Windows NT Virtual DOS Machine (NTVDM)

Present in all IA-32 versions of the Windows NT platform since its introduction in 1993 with Windows NT 3.1, NTVDM allows execution of both 16-bit Windows programs and 16-/32-bit DOS software. The main component is a 32-bit user-mode executable named .

For running DOS applications, NTVDM initiates , which in turn loads , ultimately executing a modified version of to launch the target program. These 16-bit system files are derived from MS-DOS 5.0 but have been altered to eliminate hard-coded FAT file system assumptions; opcode sequence 0xC4 0xC4 is used to delegate BIOS operations to the encompassing 32-bit NTVDM process. Initially, NTDOS reported a DOS version number of 30.00 but soon standardized on versions 5.00 or 5.50 to enhance compatibility, although many features introduced in later MS-DOS editions and Windows 9x remain unsupported.

By default, multiple 16-bit Windows applications execute as threads inside a single NTVDM process, where they cooperate for multitasking while NTVDM itself is pre-emptively multitasked alongside other system processes. Enabling "Run in separate memory space" launches each application within its own distinct NTVDM process, providing full pre-emptive multitasking capabilities. NTVDM emulates BIOS interrupts, Windows 3.1 kernel functions, and stubs for various 16-bit APIs.[1] The translation (thunking) of these API calls to their 32-bit counterparts is handled by the WoW (Windows on Windows) subsystem.

To support the DOS Protected Mode Interface (DPMI) and access to 32-bit memory, NTVDM incorporates a 32-bit DOS emulation layer that maps extended memory requests to their Windows NT equivalents. Additionally, emulates the environment for running 16-bit Windows applications; starting with Windows XP, Sound Blaster 2.0 emulation was added.[2] However, virtual device drivers designed for 16-bit Windows and DOS block device drivers such as RAM disks are not supported. Communication between processes utilizes mechanisms including OLE, DDE, and named pipes.

On processors without virtual 8086 mode support—such as MIPS, DEC Alpha, and PowerPC architectures—NTVDM functions as a full emulator licensed from Insignia's SoftPC. Prior to Windows NT 4.0, only emulation of the 80286 processor was available; with Windows NT 4.0, support for emulating a 486 processor was introduced.[3]

NTVDM is not present in any x64-based Windows editions or ARM32 variants such as Windows RT or Windows 10 IoT Core. Its final inclusion occurred with Windows 10, after which support was discontinued in Windows 11 alongside the cessation of native 32-bit processor compatibility.

Commands

Windows XP provides the following 16-bit commands within its MS-DOS subsystem:

Security issue

In January 2010, a critical security flaw was revealed by Google researcher Tavis Ormandy involving the VDM implementation in Windows NT. This vulnerability allowed users without administrative rights to elevate their privileges to SYSTEM level. It impacted all x86 editions of the Windows NT kernel released since 1993, including Windows NT, 2000, XP, Server 2003, Vista, Server 2008, and Windows 7. Prior to Microsoft's patch release, Ormandy published a proof-of-concept exploit. As a temporary measure, disabling support for 16-bit applications was recommended, which prevented execution of legacy DOS and Windows 3.1 software. It is important to note that 64-bit Windows versions were not affected due to the absence of the NTVDM subsystem. After the update was applied, 16-bit application functionality could be safely re-enabled.

Limitations

The 16-bit subsystem in Windows XP encounters a constraint related to an increased per-session GDI object limit that causes GDI handles to be shifted right by two bits during conversion from 32-bit to 16-bit format. This restricts handles to a maximum of 14 bits; if a handle exceeds the value of 16384 when passed to a 16-bit application, it results in a crash with an error.

More generally, VDM technology offers limited compatibility for older DOS games on modern hardware platforms. It provides only partial emulation of basic peripherals, with sound emulation being especially inadequate. The NT-based Windows versions update the display infrequently during DOS program output and do not emulate higher-resolution graphics modes. Additionally, running these applications at native CPU speeds causes timing loops to complete too rapidly, leading games to run faster than intended or fail to register expected hardware responses.

Absence in x64 and AArch64 architectures

On x86-64 processors, the virtual 8086 mode exists solely in legacy mode used by 16- and 32-bit operating systems; it is not available in native 64-bit long mode. As a result, NTVDM is unsupported on x86-64 editions of Windows because it depends on VM86 CPU mode for enabling 16-bit segment addressing. Similarly, on AArch64 (ARM64) versions such as Windows RT, NTVDM is unavailable since Microsoft has not developed a comprehensive emulator for this incompatible instruction set.

Although NTVDM is absent from x86-64 and AArch64 Windows platforms, legacy application support can be achieved using virtualization tools like Windows XP Mode available on non-home editions of Windows 7 or products such as VMware Workstation. Other options include implementations derived from ReactOS's NTVDM or OTVDM (also known as WineVDM), which is a 16-bit Windows interpreter built upon the i386 emulation in MAME combined with the 16-bit components of the Windows compatibility layer provided by Wine.

WineVDM

WineVDM, also referred to as OTVDM, is incorporated into both Wine and CrossOver for Linux and Mac OS X platforms. It has also been ported to Windows systems to compensate for the lack of NTVDM support in 64-bit Windows editions.

See also

Further reading

  • Matt Pietrek, Under The Hood, Microsoft Systems Journal, August 1998

External links

  1. ↑ Cite error: Invalid <ref> tag; no text was provided for refs named Microsoft_27
  2. ↑ Cite error: Invalid <ref> tag; no text was provided for refs named itPro_2002
  3. ↑ Cite error: Invalid <ref> tag; no text was provided for refs named Microsoft_2006