Template:Short description Template:Use dmy dates Template:Use list-defined references Virtual DOS machines (VDM) refer to a technology that allows running 16-bit/32-bit DOS and 16-bit Windows programs when there is already another operating system running and controlling the hardware.
OverviewEdit
Virtual DOS machines can operate either exclusively through typical software emulation methods (e.g. dynamic recompilation) or can rely on the virtual 8086 mode of the Intel 80386 processor, which allows real mode 8086 software to run in a controlled environment by catching all operations which involve accessing protected hardware and forwarding them to the normal operating system (as exceptions). The operating system can then perform an emulation and resume the execution of the DOS software.
VDMs generally also implement support for running 16-bit and 32-bit protected mode software (DOS extenders), which has to conform to the DOS Protected Mode Interface (DPMI).<ref name="Schulman_1994_Undocumented-DOS"/>
When a DOS program running inside a VDM needs to access a peripheral, Windows will either allow this directly (rarely), or will present the DOS program with a virtual device driver (VDD) which emulates the hardware using operating system functions. A VDM will systematically have emulations for the Intel 8259A interrupt controllers, the 8254 timer chips, the 8237 DMA controller, etc.<ref name="Schulman_1994_Undocumented-DOS"/>
Template:AnchorConcurrent DOS 8086 emulation modeEdit
In January 1985 Digital Research together with Intel previewed Concurrent DOS 286 1.0,<ref name="BYTE_1985_CDOS286"/> a version of Concurrent DOS capable of running real mode DOS programs in the 80286's protected mode.<ref name="BYTE_1985_CDOS286"/> The method devised on B-1 stepping processor chips, however, in May 1985 stopped working on the C-1 and subsequent processor steppings shortly before Digital Research was about to release the product. Although with the E-1 stepping Intel started to address the issues in August 1985, so that Digital Research's "8086 emulation mode" worked again utilizing the undocumented LOADALL processor instruction,<ref name="DRI_1986_CDOS68K-2"/><ref name="Deitel_1992"/> it was too slow to be practical. Microcode changes for the E-2 stepping improved the speed again.<ref name="Infoworld_1985_Super"/><ref name="Infoworld_1985_80286"/> This early implementation can be seen as a predecessor to actual virtual DOS machines.
Eventually, Concurrent DOS 286 was reworked from a potential desktop operating system to become FlexOS 286 for industrial use in 1986.<ref name="DRI_1986_FlexOS286"/><ref name="CBR_1987_FlexOS-286"/> It was also licensed by IBM for their 4680 OS in 1986.<ref name="InfoWorld_1986_Concurrent"/><ref name="DRI_1986_IBM"/>
When Intel's 80386 with its virtual 8086 mode became available (as samples since October 1985 and in quantities since June 1986), Digital Research switched to use this to run real mode DOS programs in virtual DOS machines in protected mode under Concurrent DOS 386 1.0 (February 1987)<ref name="Weiss_1987"/> and FlexOS 386 1.0 (June 1987).<ref name="CBR_1987_FlexOS"/> However, the architecture of these multiuser multitasking protected mode operating systems was not DOS-based by themselves.
Concurrent DOS 386 was later developed to become Multiuser DOS (since 1991) and REAL/32 (since 1995). FlexOS 386 later became 4690 OS in 1993.
DOS-based VDMsEdit
In contrast to these protected mode operating systems, DOS, by default, is a real-mode operating system, switching to protected mode and virtual 86 mode only on behalf of memory managers and DOS extenders in order to provide access to extended memory or map in memory into the first megabyte, which is accessible to normal DOS programs.
DOS-based VDMs appeared with Microsoft's Windows/386 2.01 in September 1987.<ref name="Win386_201"/> DOS-based virtual DOS machines were also present in Windows 3.0, 3.1x and Windows for Workgroups 3.1x running in 386 Enhanced Mode as well as in Windows 95, 98, 98 SE and ME. One of the characteristics of these solutions running on top of DOS is that the memory layout shown inside virtual DOS machines are virtual instances of the DOS system and DOS driver configuration run before the multitasker is loaded, and that requests which cannot be handled in protected mode are passed down into the system domain to be executed by the underlying DOS system.
Similar to Windows 3.x 386 Enhanced Mode in architecture, EMM386 3.xx of Novell DOS 7,<ref name="Schulman_1994_Undocumented-DOS"/><ref name="Paul_1997_NWDOSTIP"/> Caldera OpenDOS 7.01,<ref name="Paul_1997_NWDOSTIP"/><ref name="Caldera_1997_Multi"/> DR-DOS 7.02<ref name="Caldera_1998_USER"/> (and later) also uses DOS-based VDMs to support pre-emptive multitasking of multiple DOS applications, when the EMM386 /MULTI option is used.<ref name="Paul_1997_NWDOSTIP"/><ref name="Caldera_1997_Multi"/><ref name="Caldera_1998_USER"/> This component has been under development at Digital Research / Novell since 1991<ref group="nb" name="NB_Panther"/> under the codename "Vladivar" (originally a separate device driver KRNL386.SYS<ref name="Schulman_1994_Undocumented-DOS"/><ref name="Paul_1997_NWDOSTIP"/> instead of a module of EMM386). While primarily developed for the next major version of DR DOS, released as Novell DOS 7 in 1994,<ref name="Schulman_1994_Undocumented-DOS"/><ref name="Paul_1997_NWDOSTIP"/> it was also used in the never released DR DOS "Panther" and "Star Trek" project in 1992/1993.
Template:AnchorOS/2 MVDMEdit
Multiple virtual DOS machines (MVDM) are used in OS/2 2.0 and later since 1992.<ref name="Schulman_1994_Undocumented-DOS"/><ref name="Deitel_1992"/> OS/2 MVDMs are considerably more powerful than NTVDM. For example, block devices are supported, and various DOS versions can be booted into an OS/2 MVDM.<ref name="IBM_WorkplaceShell"/> While the OS/2 1.x DOS box was based on DOS 3.0, OS/2 2.x MVDMs emulate DOS 5.0.<ref name="Schulman_1994_Undocumented-DOS"/>
Seamless integration of Windows 3.1 and later Win32s applications in OS/2 is a concept looking similar on surface to the seamless integration of XP Mode based on Windows Virtual PC in Windows 7. A redirector in a "guest" VDM or NTVDM allows access on the disks of the OS/2 or NT "host". Applications in a "guest" can use named pipes for communication with their "host".<ref name="Microsoft_490895"/>
Due to a technical limitation, DOS and 16-bit Windows applications under OS/2 were unable to see more than 2 GB of hard drive space;<ref name="Arca_2020_1"/> this was fixed in ArcaOS 5.0.4.<ref name="Arca_2020_2"/>
Template:AnchorWindows NTVDMEdit
NTVDM is a system component of all IA-32 editions of the Windows NT family since 1993 with the release of Windows NT 3.1. It allows execution of 16-bit Windows and 16-bit / 32-bit DOS applications. The Windows NT 32-bit user-mode executable which forms the basis for a single DOS (or Windows 3.x) environment is called Template:Mono.<ref name="Schulman_1994_Undocumented-DOS"/>
In order to execute DOS programs, NTVDM loads Template:Mono which in turn loads Template:Mono, which executes a modified Template:Mono in order to run the application that was passed to NTVDM as command-line argument. The 16-bit real-mode system files are stripped down derivations of their MS-DOS 5.0 equivalents Template:Mono, Template:Mono and Template:Mono<ref name="Schulman_1994_Undocumented-DOS"/> with all hard-wired assumptions on the FAT file system removed and using the invalid opcode 0xC4 0xC4 to bop down into the 32-bit NTVDM to handle the requests.<ref name="Schulman_1994_Undocumented-DOS"/> Originally, NTDOS reported a DOS version of 30.00 to programs,<ref name="Schulman_1994_Undocumented-DOS"/> but this was soon changed to report a version of 5.00 at <syntaxhighlight lang="asm" class="" style="" inline="1">INT 21h/AH=30h</syntaxhighlight> and 5.50 at <syntaxhighlight lang="asm" class="" style="" inline="1">INT 21h/AX=3306h</syntaxhighlight> to allow more programs to run unmodified.<ref name="Schulman_1994_Undocumented-DOS"/> This holds true even in the newest releases of Windows; many additional MS-DOS functions and commands introduced in MS-DOS versions 6.x and in Windows 9x are missing.
16-bit Windows applications by default all run in their own thread within a single NTVDM process. Although NTVDM itself is a 32-bit process and pre-emptively multitasked with respect to the rest of the system, the 16-bit applications within it are cooperatively multitasked with respect to each other. When the "Run in separate memory space" option is checked in the Run box or the application's shortcut file, each 16-bit Windows application gets its own NTVDM process and is therefore pre-emptively multitasked with respect to other processes, including other 16-bit Windows applications. NTVDM emulates BIOS calls and tables as well as the Windows 3.1 kernel and 16-bit API stubs.<ref name="Microsoft_27"/> The 32-bit WoW translation layer thunks 16-bit API routines.
32-bit DOS emulation is present for DOS Protected Mode Interface (DPMI) and 32-bit memory access. This layer converts the necessary extended and expanded memory calls for DOS functions into Windows NT memory calls. Template:Mono is the emulation layer that emulates 16-bit Windows. Windows XP added Sound Blaster 2.0 emulation.<ref name="itPro_2002"/> 16-bit virtual device drivers and DOS block device drivers (e.g., RAM disks) are not supported. Inter-process communication with other subsystems can take place through OLE, DDE and named pipes.
Since virtual 8086 mode is not available on non-x86-based processors (more specifically, MIPS, DEC Alpha, and PowerPC) NTVDM is instead implemented as a full emulator in these versions of NT, using code licensed from Insignia's SoftPC.<ref name="Schulman_1994_Undocumented-DOS"/> Up to Windows NT 3.51, only 80286 emulation is available. With Windows NT 4.0, 486 emulation was added.<ref name="Microsoft_2006"/>
NTVDM is not included with 64-bit versions of Windows or ARM32 based versions such as Windows RT or Windows 10 IoT Core. The last version of Windows to include the component is Windows 10, as Windows 11 dropped support for 32-bit processors.
CommandsEdit
The following commands are part of the Windows XP MS-DOS subsystem.<ref name="Microsoft_490895"/>
- APPEND
- DEBUG
- EDIT
- EDLIN
- EXE2BIN
- FASTOPEN
- FORCEDOS
- GRAPHICS
- LOADFIX
- LOADHIGH (LH)
- MEM
- NLSFUNC
- SETVER
- SHARE
Security issueEdit
In January 2010, Google security researcher Tavis Ormandy revealed a serious security flaw in Windows NT's VDM implementation that allowed unprivileged users to escalate their privileges to SYSTEM level, noted as applicable to the security of all x86 versions of the Windows NT kernel since 1993. This included all 32-bit versions of Windows NT, 2000, XP, Server 2003, Vista, Server 2008, and Windows 7.<ref name="Microsoft_MS10-015"/> Ormandy published a proof-of-concept exploit for the vulnerability.<ref name="Ormandy_2010"/> Prior to Microsoft's release of a security patch, the workaround for this issue was to turn off 16-bit application support, which prevented older programs (those written for DOS and Windows 3.1) from running. 64-bit versions of Windows are not affected since the NTVDM subsystem is not included.<ref name="inquirer"/><ref name="technet"/> Once the Microsoft security patches had been applied to the affected operating systems the VDM could be safely reenabled.<ref group="nb" name="VDMReg"/>
LimitationsEdit
A limitation exists in the Windows XP 16-bit subsystem (but not in earlier versions of Windows NT) because of the raised per-session limit for GDI objects which causes GDI handles to be shifted to the right by two bits, when converting them from 32 to 16 bits.<ref name="XPVDM bug"/> As a result, the actual handle cannot be larger than 14 bits and consequently 16-bit applications that happen to be served a handle larger than 16384 by the GDI system crash and terminate with an error message.<ref name="XPVDM bug"/>
In general, VDM and similar technologies do not satisfactorily run most older DOS games on today's computers. Emulation is only provided for the most basic peripherals, often implemented incompletelyTemplate:Citation needed. For example, sound emulation in NTVDM is very limited. NT-family versions of Windows only update the real screen a few times per second when a DOS program writes to it, and they do not emulate higher resolution graphics modes. Because software mostly runs native at the speed of the host CPU, all timing loops will expire prematurely. This either makes a game run much too fast or causes the software not even to notice the emulated hardware peripherals, because it does not wait long enough for an answer.
Absence in x64 and AArch64 architecturesEdit
In an x86-64 CPU, virtual 8086 mode is available as a sub-mode only in its legacy mode (for running 16- and 32-bit operating systems), not in the native 64-bit long mode.<ref name="Intel_2013_Arch-Ref"/> NTVDM is not supported on x86-64 editions of Windows,<ref name="Klein_2008"/> including DOS programs,<ref name="Microsoft_2007_Limitations"/> because NTVDM uses VM86 CPU mode instead of the Local Descriptor Table in order to enable 16‑bits segment required for addressing.<ref name="modify_ldt"/> NTVDM is also unavailable on AArch64 (or ARM64) versions of Windows (such as Windows RT), because Microsoft did not release a full emulator for this incompatible instruction set like it did on previous incompatible architectures.
Template:AnchorWhile NTVDM is not supported on x86-64 and AArch64 versions of Windows, they can still be run using virtualization software, such as Windows XP Mode in non-home versions of Windows 7 or VMware Workstation. Other methods include using ReactOS-derived NTVDM,<ref name="dosEx64"/> or OTVDM (WineVDM), a 16-bit Windows interpreter based on MAME's i386 emulation and the 16-bit portion of the popular Windows compatibility layer, Wine (see the section on WineVDM below).<ref name="Otvdm"/>
WineVDMEdit
A VDM is included in Wine and CrossOver for Linux and Mac OS X, known as WineVDM (also known as OTVDM). It has also been ported to Windows itself, as 64-bit versions of Windows do not include the NTVDM subsystem (see above).<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>
See alsoEdit
- Comparison of platform virtualization software
- DESQview 386 (since 1988)
- Wine (software)
- DOSBox
- DOSEMU
- Merge (software)
- List of Microsoft Windows components
- Hypervisor
- Windows on Windows (WoW)
- Virtual machine (VM)
NotesEdit
ReferencesEdit
Further readingEdit
External linksEdit
- Virtual DOS Machine Structure
- Troubleshooting MS-DOS-based programs in Windows XP
- Troubleshooting an MS-DOS application which hangs the NTVDM subsystem in Windows XP and Windows Server 2003
- Troubleshooting MS-DOS-based serial communication programs in Windows 2000 and later
- NTVDM from ReactOS, the custom standalone variant of NTVDM by Michael Stamper (able to run windowed text mode MS-DOS software in 64 bit Windows NT systems, this NTVDM works by using the following syntax: ntvdm.exe program.exe, like start command in Windows.
- MS-DOS Player for Win32-x64, a Microsoft MS-DOS Emulator, runs many command line DOS programs like compilers or other tools, also packaged into one standalone executable file.
- vDOS, a DOS emulator designed for the running the more serious DOS apps (not games) on 64-bit NT systems (effectively a replacement for NTVDM on modern systems).