Jump to content

Virtual DOS machine

From Wikipedia, the free encyclopedia

Virtual DOS machines(VDM) refer to a technology that allows running 16-bit/32-bitDOSand16-bit Windowsprograms when there is already anotheroperating systemrunning and controlling the hardware.

Overview[edit]

Virtual DOS machines can operate either exclusively through typicalsoftware emulationmethods (e.g.dynamic recompilation) or can rely on thevirtual 8086 modeof theIntel80386processor, which allowsreal mode8086 software to run in a controlled environment by catching all operations which involve accessing protected hardware and forwarding them to the normal operating system (asexceptions). The operating system can then perform an emulation and resume the execution of the DOS software.

VDMs generally also implement support for running16-and32-bitprotected modesoftware (DOS extenders), which has to conform to theDOS Protected Mode Interface(DPMI).[1]

When a DOS program running inside a VDM needs to access a peripheral,Windowswill either allow this directly (rarely), or will present the DOS program with avirtual device driver(VDD) which emulates the hardware using operating system functions. A VDM will systematically have emulations for the Intel8259Ainterruptcontrollers, the8254timer chips, the 8237 DMA controller, etc.[1]

Concurrent DOS 8086 emulation mode[edit]

In January 1985Digital Researchtogether with Intel previewedConcurrent DOS 286 1.0,[2]a version ofConcurrent DOScapable of running real mode DOS programs in the80286's protected mode.[2]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 undocumentedLOADALLprocessor instruction,[3][4]it was too slow to be practical.Microcodechanges for the E-2 stepping improved the speed again.[5][6]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 becomeFlexOS 286for industrial use in 1986.[7][8]It was also licensed byIBMfor their4680 OSin 1986.[9][10]

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 underConcurrent DOS 386 1.0(February 1987)[11]andFlexOS 386 1.0(June 1987).[12]However, the architecture of these multiuser multitasking protected mode operating systems was not DOS-based by themselves.

Concurrent DOS 386was later developed to becomeMultiuser DOS(since 1991) andREAL/32(since 1995).FlexOS 386later became4690 OSin 1993.

DOS-based VDMs[edit]

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'sWindows/386 2.01in September 1987.[13]DOS-based virtual DOS machines were also present inWindows 3.0,3.1xandWindows for Workgroups 3.1xrunning in386 Enhanced Modeas well as inWindows 95,98,98 SEandME.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,EMM3863.xx ofNovell DOS 7,[1][14]Caldera OpenDOS 7.01,[14][15]DR-DOS 7.02[16](and later) also uses DOS-based VDMs to support pre-emptive multitasking of multiple DOS applications, when theEMM386 /MULTIoption is used.[14][15][16]This component has been under development atDigital Research/Novellsince 1991[nb 1]under the codename "Vladivar" (originally a separate device driverKRNL386.SYS[1][14]instead of a module of EMM386). While primarily developed for the next major version of DR DOS, released as Novell DOS 7 in 1994,[1][14]it was also used in the never releasedDR DOS "Panther"and "Star Trek"project in 1992/1993.

OS/2 MVDM[edit]

Multiple virtual DOS machines (MVDM) are used inOS/2 2.0and later since 1992.[1][4]OS/2 MVDMs are considerably more powerful thanNTVDM.For example, block devices are supported, and various DOS versions can be booted into an OS/2 MVDM.[17]While the OS/2 1.x DOS box was based on DOS 3.0, OS/2 2.x MVDMs emulate DOS 5.0.[1]

Seamless integration ofWindows 3.1and laterWin32sapplications in OS/2 is a concept looking similar on surface to the seamless integration ofXP Modebased onWindows Virtual PCinWindows 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 usenamed pipesfor communication with their "host".[18]

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;[19]this was fixed inArcaOS5.0.4.[20]

Windows NTVDM[edit]

COMMAND.COMrunning in the NTVDM ofWindows 10

NTVDM is a system component of allIA-32editions of theWindows NTfamily since 1993 with the release ofWindows 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 (orWindows 3.x) environment is calledntvdm.exe.[1]

In order to execute DOS programs, NTVDM loadsNTIO.SYSwhich in turn loadsNTDOS.SYS,which executes a modifiedCOMMAND.COMin 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 theirMS-DOS 5.0equivalentsIO.SYS,MSDOS.SYSandCOMMAND.COM[1]with all hard-wired assumptions on theFAT file systemremoved and using theinvalid opcode0xC4 0xC4 tobopdown into the 32-bit NTVDM to handle the requests.[1]Originally, NTDOS reported a DOS version of 30.00 to programs,[1]but this was soon changed to report a version of 5.00 atINT21h/AH=30hand 5.50 atINT21h/AX=3306hto allow more programs to run unmodified.[1]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 inWindows 9xare 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 theRunbox 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.[21]The 32-bitWoWtranslation layerthunks16-bit API routines.

32-bit DOS emulation is present forDOS 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.wowexec.exeis the emulation layer that emulates 16-bit Windows.Windows 2000andWindows XPaddedSound Blaster2.0 emulation.[22]16-bit virtual device drivers andDOSblock device drivers (e.g., RAM disks) are not supported.Inter-process communicationwith other subsystems can take place throughOLE,DDEandnamed pipes.

Since virtual 8086 mode is not available on non-x86-based processors (more specifically,MIPS,DEC Alpha,andPowerPC) NTVDM is instead implemented as a full emulator in these versions of NT, using code licensed from Insignia'sSoftPC.[23][1]Up toWindows NT 3.51,only 80286 emulation is available. WithWindows NT 4.0,486emulation was added.[24]

NTVDM is not included with 64-bit versions of Windows or ARM32 based versions such asWindows RTor Windows 10 IoT Core.Windows 10is the final version of Windows to include this component, as Windows 11 dropped support for32-bitprocessors.

Commands[edit]

The following list ofcommandsis part of the Windows XP MS-DOS subsystem.[18]

Security issue[edit]

In January 2010,Googlesecurity researcherTavis Ormandyrevealed a serious security flaw in Windows NT's VDM implementation that allowed unprivileged users to escalate their privileges toSYSTEMlevel, 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.[25]Ormandy published aproof-of-concept exploitfor the vulnerability.[26]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.[27][28]Once the Microsoft security patches had been applied to the affected operating systems the VDM could be safely reenabled.[nb 2]

Limitations[edit]

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.[29]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.[29]

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 incompletely[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, alltiming loopswill 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 architectures[edit]

In anx86-64CPU,virtual 8086 modeis available as a sub-mode only in its legacy mode (for running 16- and 32-bit operating systems), not in the native 64-bitlong mode.[30]NTVDM is not supported on x86-64 editions of Windows,[31]including DOS programs,[32]because NTVDM uses VM86 CPU mode instead of the Local Descriptor Table in order to enable 16‑bits segment required for addressing.[33]NTVDM is also unavailable onAArch64versions of Windows (such asWindows RT), because Microsoft did not release a full emulator for this incompatible instruction set like it did on previous incompatible architectures.

Whilst NTVDM is not supported on x86-64 and AArch64 versions of Windows, they can still be run usingvirtualizationsoftware, such asWindows XP Modein non-home versions ofWindows 7orVMware Workstation.Other methods include using NTVDMx64,[34]an unofficial port of the emulated implementation of NTVDM from the leakedWindows NT 4.0source code for non-x86 platforms,[23]or OTVDM (WineVDM), a 16-bit Windows interpreter based onMAME's i386 emulation and the 16-bit portion of the popular Windows compatibility layer,Wine.[35]

WineVDM[edit]

A VDM is included inWineandCrossOverfor 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.[36]

See also[edit]

Notes[edit]

  1. ^KRNL386.SYS ofDR DOS "Panther"has copyright strings "1991,1992".
  2. ^A disabled VDM could be reenabled by setting the corresponding registry key back to"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\AppCompat\VDMDisallowed" =dword:00000000.

References[edit]

  1. ^abcdefghijklmSchulman, Andrew;Brown, Ralf D.;Maxey, David; Michels, Raymond J.; Kyle, Jim (1994) [November 1993].Undocumented DOS: A programmer's guide to reserved MS-DOS functions and data structures - expanded to include MS-DOS 6, Novell DOS and Windows 3.1(2 ed.). Reading, Massachusetts:Addison Wesley.ISBN0-201-63287-X.(xviii+856+vi pages, 3.5-inch floppy) Errata:[1][2]
  2. ^ab"Concurrent DOS-286 Challenges Unix".BYTE Magazine.10(5): 375–377. May 1985.Archivedfrom the original on 2018-09-14.Retrieved2017-01-23.[3]
  3. ^"Concurrent DOS 68K 1.2 - Developer Kit for Motorola VME/10 - Disk 2".1986-08-06 [1986-04-08].Retrieved2018-09-13.(NB. This package also includes some header files fromConcurrent DOS 286,including STRUCT.H explicitly mentioningLOADALLfor "8086 emulation".)
  4. ^abDeitel, Harvey M.; Kogan, Michael S. (1992).The Design of OS/2.Addison-Wesley.ISBN0-201-54889-5.
  5. ^Foster, Edward (1985-05-13)."Super DOS awaits new 80286 – Concurrent DOS 286 – delayed until Intel upgrades chip – offers Xenix's power and IBM PC compatibility".InfoWorld.7(19).InfoWorld Media Group:17–18.ISSN0199-6649.Archivedfrom the original on 2019-04-03.Retrieved2019-04-03.
  6. ^Foster, Edward (1985-08-26)."Intel shows new 80286 chip – Future of DRI's Concurrent DOS 286 still unclear after processor fixed".InfoWorld.7(34).InfoWorld Media Group:21.ISSN0199-6649.Archivedfrom the original on 2019-04-03.Retrieved2019-04-03.
  7. ^FlexOS Supplement for Intel iAPX 286-based Computers(PDF).1.3 (1 ed.).Digital Research, Inc.November 1986.Archived(PDF)from the original on 2019-04-03.Retrieved2018-08-14.
  8. ^CBR, ed. (1987-01-15)."Digital Research launches FlexOS 286 Real-Time Manufacturing Operating System".Computer Business Review.Archivedfrom the original on 2013-01-18.Retrieved2018-09-15.
  9. ^Calvo, Melissa; Forbes, Jim (1986-02-10)."IBM to use a DRI operating system".InfoWorld.Archivedfrom the original on 2019-04-03.Retrieved2011-09-06.
  10. ^"IBM selects Concurrent DOS-286 for PC AT retail system"(PDF).European Review(18).Digital Research:1. March 1986.Archived(PDF)from the original on 2019-04-03.Retrieved2018-09-15.
  11. ^Weiss, Jiri (1987-02-16)."DRI To Release Multiuser 80386 Operating System".InfoWorld.9(7): 1, 8.Archivedfrom the original on 2019-04-03.Retrieved2017-01-22.[4]
  12. ^CBR, ed. (1987-06-03)."Digital Research shows off Real-Time FlexOS 386".Computer Business Review.Archivedfrom the original on 2013-06-28.Retrieved2011-09-06.
  13. ^Necasek, Michal (2011-05-21)."Windows/386 2.01".OS/2 Museum.Archivedfrom the original on 2019-04-03.Retrieved2019-04-02.
  14. ^abcdePaul, Matthias R. (1997-07-30) [1994-05-01].NWDOS-TIPs — Tips & Tricks rund um Novell DOS 7, mit Blick auf undokumentierte Details, Bugs und Workarounds.Release 157 (in German) (3 ed.).Archivedfrom the original on 2016-11-03.Retrieved2014-09-06.{{cite book}}:|work=ignored (help)(NB. NWDOSTIP.TXT is a comprehensive work onNovell DOS 7andOpenDOS 7.01,including the description of many undocumented features and internals. It is part of the author's yet larger MPDOSTIP.ZIP collection maintained up to 2001 and distributed on many sites at the time. The provided link points to a HTML-converted older version of the NWDOSTIP.TXT file.)mpdostip.zip
  15. ^abOpenDOS Developer's Reference Series — OpenDOS Multitasking API Guide — Programmer's Guide.UK:Caldera, Inc.August 1997. Caldera Part No. 200-DOMG-004. Archived fromthe originalon 2017-09-10.Retrieved2016-11-02.
  16. ^abCaldera DR-DOS 7.02 User Guide.Caldera, Inc.1998 [1993, 1997]. Archived fromthe originalon 2016-11-05.Retrieved2014-09-06.
  17. ^"OS/2 Workplace Shell Configuration Techniques"(PDF).IBMredbook. 1994. pp. 68–80. Archived fromthe original(PDF)on 2012-03-20.Retrieved2011-07-05.
  18. ^ab"MS-DOS subsystem commands".Microsoft.
  19. ^"Why can't my DOS and Win-OS/2 sessions see more than 2 GB of free space?".Arca Noae, LLC.Archivedfrom the original on 2021-07-07.Retrieved2020-09-03.
  20. ^"ArcaOS Release Notes".2020-08-31 [2017-05-15].Archivedfrom the original on 2021-03-16.Retrieved2020-09-03.
  21. ^"Chapter 27 - Windows Compatibility and Migration".Windows NT 4.0 Resource Kit.Microsoft.2014-02-20.Retrieved2017-07-19.
  22. ^Schulman, Jerold (2002-12-04)."How do I troubleshoot MS-DOS programs running on Windows XP?".ITPro Windows.Retrieved2017-07-19.
  23. ^ab"leecher1337/ntvdmx64".GitHub.Retrieved2018-11-03.Edward Mendelson's additional documentation
  24. ^"INFO: How Windows handles floating-point calculations".Microsoft Support.2006-11-21. Archived fromthe originalon 2013-02-24.Retrieved2017-07-19.
  25. ^"Microsoft Security Bulletin MS10-015 - Important: Vulnerabilities in Windows Kernel Could Allow Elevation of Privilege (977165)".Security TechCenter.Microsoft.2010-03-17.Retrieved2012-11-02.
  26. ^Ormandy, Tavis (2010-01-19)."Microsoft Windows NT #GP Trap Handler Allows Users to Switch Kernel Stack".CVE-2010-0232.Full-disclosure.Retrieved2013-04-13.
  27. ^Farrell, Nick (2010-01-20)."Ancient Windows flaw found after 17 years".The Inquirer.Incisive. Archived from the original on 2010-01-23.Retrieved2010-01-21.{{cite web}}:CS1 maint: unfit URL (link)
  28. ^"Microsoft Security Advisory (979682): Vulnerability in Windows Kernel Could Allow Elevation of Privilege".TechNet.Microsoft.2010-01-20.Retrieved2010-01-21.
  29. ^abThe "Win 16 Subsystem has insufficient resources to continue running" problem on Windows XP
  30. ^Intel 64 and IA-32 Architectures Software Developer's Manual Combined Volumes: 1, 2A, 2B, 2C, 3A, 3B, and 3C(PDF)(PDF).Intel.June 2013 [1997]. 325462-047US.Retrieved2013-07-02.
  31. ^Klein, Helge (2008-03-11)."Windows x64 - All the Same Yet Very Different, Part 5: NTVDM, Services, WoW64".Retrieved2013-07-21.
  32. ^"List of limitations in 64-Bit Windows".Microsoft Corporation. 2007-10-11.Retrieved2017-07-19.
  33. ^"modify_ldt(2)".Linux Programmer's Manual.Retrieved2019-07-21.
  34. ^"NTVDMx64 by Leecher1337".columbia.edu.Retrieved2023-03-25.
  35. ^"Winevdm".GitHub.Retrieved2019-07-21.Edward Mendelson's additional documentation
  36. ^"Otya128/Winevdm".GitHub.

Further reading[edit]

External links[edit]