DOS Protected Mode Interface

Last updated

DOS Protected Mode Interface
AbbreviationDPMI
StatusPublished
Year started1989;35 years ago (1989)
OrganizationDPMI Committee
Domain Application programming interfaces

In computing, the DOS Protected Mode Interface (DPMI) is a specification introduced in 1989 which allows a DOS program to run in protected mode, giving access to many features of the new PC processors of the time not available in real mode. It was initially developed by Microsoft for Windows 3.0, although Microsoft later turned control of the specification over to an industry committee with open membership. [1] [2] Almost all modern DOS extenders are based on DPMI and allow DOS programs to address all memory available in the PC and to run in protected mode (mostly in ring 3, least privileged). [3]

Contents

Overview

DPMI stands for DOS Protected Mode Interface. It is an API that allows a program to run in protected mode on 80286 series and later processors, and do the calls to real mode without having to set up these CPU modes manually. DPMI also provides the functions for managing various resources, notably memory. This allows the DPMI-enabled programs to work in multi-tasking OSes, allowing an OS kernel to distribute such resources between multiple applications. DPMI provides only the functionality that needs to be implemented in supervisor mode. It can be thought of as a single-tasking microkernel. The rest of the functionality is available to DPMI-enabled programs via the calls to real-mode DOS and BIOS services, allowing the DPMI API itself to remain mostly independent of DOS. Things that make DPMI API DOS-specific, are just 3 functions for managing DOS memory, and the letter "D" in the "DPMI" acronym.

A DPMI service can be 16-bit, 32-bit, or "universal" and is called the DPMI kernel, DPMI host, or DPMI server. It is provided either by the host operating system (virtual DPMI host) or by a DOS extender (real DPMI host). The DPMI kernel can be a part of a DOS extender such as in DOS/4GW or DOS/32A, or separate, like CWSDPMI or HDPMI.

The primary use of DPMI API is to allow DOS extenders to provide the host-OS-agnostic environment. DOS extender checks the presence of a DPMI kernel, and installs its own only if the one was not installed already. This allows DOS-extended programs to run either in a multitasking OS that provides its own DPMI kernel, or directly under bare-metal DOS, in which case DOS extender uses its own DPMI kernel. Windows 3.x and 9x's user-mode kernels are built with a DOS extender, so they fully rely on a DPMI API that is provided by Windows's ring-0 kernel.

History

The first DPMI specification drafts were published in 1989 by Microsoft's Ralph Lipe. [4] [1] While based on a prototypical version of DPMI for Windows 3.0 in 386 enhanced mode, several features of this implementation were removed from the official specification, including a feature named MS-DOS Extensions [5] or DOS API translation that had been proposed by Ralph Lipe in the original drafts. [6] Most of it was implementing DOS and BIOS interfaces (due to this history some INT 21h APIs like 4Ch have to be implemented by all DPMI implementations). DPMI version 0.9 was published in 1990 by the newly formed DPMI Committee. The version number 0.9 of the resulting specification was chosen to reflect the stripped-down nature and incomplete status of the standard the members of the DPMI Committee could agree upon. [1] While Windows reports DPMI version 0.9 for compatibility, it actually implements the other parts as well, since they present a vital part of the system. [5] [1] This undocumented full nature of DPMI has become known as "true DPMI" in the industry. [7] The DPMI standard was not the only effort to overcome the shortcomings of the VCPI specification. At the same time that Microsoft developed DPMI for Windows 3.0, another industry alliance including Intel's Software Focus Group, [8] [1] Lotus, [8] Digital Research, Interactive Systems and others developed a specification named Extended VCPI (XVCPI) to make the memory management and multitasking capabilities of the 386 available for extended DOS applications. [8] [1] [9] When it turned out that Microsoft's DPMI proposal addressed a number of similar issues and was supported by Windows, these efforts led to the creation of the DPMI Committee in February 1990 during a meeting at Intel in Santa Clara. [8] [1]

In 1991, the DPMI Committee revised DPMI to version 1.0 in order to incorporate a number of clarifications and extensions, but it still did not include the missing "true DPMI" bits implemented in Windows. In fact, "true DPMI" never became part of the official DPMI specification, and Windows likewise never implemented the DPMI 1.0 extensions (and not many DPMI hosts did).

While DPMI is tailored to run extended DOS application software in protected mode and extended memory, [10] it is not particularly well suited for resident system extensions. Another specification named DPMS, [10] developed by Digital Research / Novell around 1992, specifically addresses requirements to easily relocate modified DOS driver software into extended memory and run them in protected mode, thereby reducing their conventional memory footprint down to small stubs. This is also supported by Helix Cloaking.

The DPMI "method" is specific to DOS and the IBM PC. Other computer types were upgraded from 16-bit to 32-bit, and the advanced program support was provided by upgrading the operating system with a new 32-bit API and new memory management/addressing capabilities. For example, the OS/2 core system supports 32-bit programs, and can be run without the GUI. The DPMI solution appears to be mainly needed to address third party need to get DOS protected mode programs running stably on Windows 3.x before the dominant operating system vendor, Microsoft, could or would address the future of 32-bit Windows. In addition, Microsoft didn't see the answer to the 32-bit transition as a 32-bit DOS, but rather a 32-bit Windows with a completely different (and incompatible) API.

Compatibility

While Windows 3.0 implements "true DPMI" [5] and reports support for DPMI 0.9, [11] DPMI version 1.0 was never implemented in Microsoft Windows, so most programs and DOS extenders were mostly only written for version 0.9. Few extenders, however, implement "true DPMI".

Beta versions of Qualitas 386MAX implemented "true DPMI" and could run Windows' KRNL386.EXE from the command line, but it was claimed that was disabled in the released product in an internal email. [5] However, DPMIONE (by Bob Smith based on the 386MAX code) can do it. Currently DPMIONE and 386MAX is also the only DPMI host which supports DPMI 1.0 completely (e.g. uncommitted memory) and they are the main supporter of DPMI 1.0. [12]

The KRNL386.SYS (aka "MultiMAX") of DR DOS "Panther" and "StarTrek", which has been under development since 1991, [nb 1] and the EMM386.EXE memory managers of Novell DOS 7, [10] Caldera OpenDOS and DR-DOS 7.02 and higher have built-in support for DPMI when loaded with the /DPMI[=ON] option. KRNL386.SYS even had a command line option /VER=0.9|1.0 to provide support for either DPMI 1.0 or 0.9. [13] DOS API translation was referred to as "called interrupt 21 from protected mode". Multiuser DOS, System Manager and REAL/32 support DPMI as well.

The most famous separate DPMI kernel is probably CWSDPMI; it supports DPMI 0.9, but no undocumented "DOS API translation". Another variant called PMODE by "TRAN" aka Thomas Pytel was popular with 32-bit programmers during the demo scene of the 1990s. Many games used DOS/4GW, which was developed by Rational Systems as a subset of DOS/4G and was distributed with the Watcom C compiler.

HDPMI (part of HX DOS Extender) provides "DOS API translation" and almost complete DPMI 1.0 implementation.

DPMI Committee

The DPMI 1.0 Committee met between 1990 through 1991 and consisted of 12 groups:

See also

Notes

  1. KRNL386.SYS of DR DOS "Panther" has copyright strings "1991,1992".

Related Research Articles

Real mode, also called real address mode, is an operating mode of all x86-compatible CPUs. The mode gets its name from the fact that addresses in real mode always correspond to real locations in memory. Real mode is characterized by a 20-bit segmented memory address space and unlimited direct software access to all addressable memory, I/O addresses and peripheral hardware. Real mode provides no support for memory protection, multitasking, or code privilege levels.

<span class="mw-page-title-main">Windows API</span> Microsofts core set of application programming interfaces on Windows

The Windows API, informally WinAPI, is the foundational application programming interface (API) that allows a computer program to access the features of the Microsoft Windows operating system in which the program is running.

x86-64 64-bit version of x86 architecture

x86-64 is a 64-bit version of the x86 instruction set, first announced in 1999. It introduced two new modes of operation, 64-bit mode and compatibility mode, along with a new 4-level paging mode.

<span class="mw-page-title-main">DJGPP</span> Implementation of the GNU toolchain for DOS

DJ's GNU Programming Platform (DJGPP) is a software development suite for Intel 80386-level and above, IBM PC compatibles which supports DOS operating systems. It is guided by DJ Delorie, who began the project in 1989. It is a port of the GNU Compiler Collection (GCC), and mostly GNU utilities such as Bash, find, tar, ls, GAWK, sed, and ld to DOS Protected Mode Interface (DPMI). Supported languages include C, C++, Objective-C/C++, Ada, Fortran, and Pascal.

<span class="mw-page-title-main">Extended memory</span>

In DOS memory management, extended memory refers to memory above the first megabyte (220 bytes) of address space in an IBM PC or compatible with an 80286 or later processor. The term is mainly used under the DOS and Windows operating systems. DOS programs, running in real mode or virtual x86 mode, cannot directly access this memory, but are able to do so through an application programming interface called the Extended Memory Specification (XMS). This API is implemented by a driver (such as HIMEM.SYS) or the operating system, which takes care of memory management and copying memory between conventional and extended memory, by temporarily switching the processor into protected mode. In this context, the term "extended memory" may refer to either the whole of the extended memory or only the portion available through this API.

<span class="mw-page-title-main">Expanded memory</span> System of bank switching in DOS memory management

In DOS memory management, expanded memory is a system of bank switching that provided additional memory to DOS programs beyond the limit of conventional memory (640 KiB).

<span class="mw-page-title-main">Conventional memory</span> First 640 KB of RAM under DOS

In DOS memory management, conventional memory, also called base memory, is the first 640 kilobytes of the memory on IBM PC or compatible systems. It is the read-write memory directly addressable by the processor for use by the operating system and application programs. As memory prices rapidly declined, this design decision became a limitation in the use of large memory capacities until the introduction of operating systems and processors that made it irrelevant.

Quarterdeck Expanded Memory Manager (QEMM) is a memory manager produced by Quarterdeck Office Systems in the late 1980s through the late 1990s. It was the most popular third-party memory manager for the MS-DOS and other DOS operating systems.

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.

CEMM, for Compaq Expanded Memory Manager was the first so-called PC "memory manager" for Intel 80386 CPUs, able to provide expanded memory (EMS) emulation by using the virtual memory features and the virtual 8086 mode of the CPU.

A DOS extender is a computer software program running under DOS that enables software to run in a protected mode environment even though the host operating system is only capable of operating in real mode.

<span class="mw-page-title-main">Phar Lap Software</span> Software company

Phar Lap Software, Inc., was a software company specializing in software development tools for DOS operating systems. The company was named after the champion New Zealand racehorse Phar Lap. They were most noted for their software allowing developers to access memory beyond the 640 KiB limit of DOS and were an author of the VCPI standard.

EMM386 is the expanded memory manager of Microsoft's MS-DOS, IBM's PC DOS, Digital Research's DR-DOS, and Datalight's ROM-DOS which is used to create expanded memory using extended memory on Intel 80386 CPUs. There also is an EMM386.EXE available in FreeDOS.

<span class="mw-page-title-main">Upper memory area</span> Physical memory region on IBM PC compatibles

In DOS memory management, the upper memory area (UMA) is the memory between the addresses of 640 KB and 1024 KB (0xA0000–0xFFFFF) in an IBM PC or compatible. IBM reserved the uppermost 384 KB of the 8088 CPU's 1024 KB address space for BIOS ROM, Video BIOS, Option ROMs, video RAM, memory-mapped I/O, and obsoleted ROM BASIC.

<span class="mw-page-title-main">DOS/4G</span>

DOS/4G is a 32-bit DOS extender developed by Rational Systems. It allows DOS programs to eliminate the 640 KB conventional memory limit by addressing up to 64 MB of extended memory on Intel 80386 and above machines.

The DOS API is an API which originated with 86-DOS and is used in MS-DOS/PC DOS and other DOS-compatible operating systems. Most calls to the DOS API are invoked using software interrupt 21h. By calling INT 21h with a subfunction number in the AH processor register and other parameters in other registers, various DOS services can be invoked. These include handling keyboard input, video output, disk file access, program execution, memory allocation, and various other activities. In the late 1980s, DOS extenders along with the DOS Protected Mode Interface (DPMI) allow the programs to run in either 16-bit or 32-bit protected mode and still have access to the DOS API.

In computing, the Virtual Control Program Interface (VCPI) is a specification published in 1989 by Phar Lap Software that allows a DOS program to run in protected mode, granting access to many features of the processor not available in real mode. It was supplanted by DOS Protected Mode Interface (DPMI) shortly after being introduced, due in large part to VCPI's inability to work in Windows 3.0's protected mode.

Windows NT is a proprietary graphical operating system produced by Microsoft as part of its Windows product line, the first version of which was released on July 27, 1993, and it lives on today since the latest version of Windows, 11, includes its technology.

<span class="mw-page-title-main">DOS</span> Group of closely related IBM PC-compatible operating systems

DOS is a family of disk-based operating systems for IBM PC compatible computers. The DOS family primarily consists of IBM PC DOS and a rebranded version, Microsoft's MS-DOS, both of which were introduced in 1981. Later compatible systems from other manufacturers include DR-DOS (1988), ROM-DOS (1989), PTS-DOS (1993), and FreeDOS (1998). MS-DOS dominated the IBM PC compatible market between 1981 and 1995.

DOS Protected Mode Services (DPMS) is a set of extended DOS memory management services to allow DPMS-enabled DOS drivers to load and execute in extended memory and protected mode.

References

  1. 1 2 3 4 5 6 7 Duncan, Ray (1991-02-12). "Power Programming – An Introduction to the DOS Protected Mode Interface". PC Magazine . Ziff-Davis Publishing Co. 10 (3): 367–371. ISSN   0888-8507 . Retrieved 2016-05-21. […] The creators of the VCPI were well aware of its limitations and were already hard at work on a second generation specification called Extended VCPI (XVCPI), when Microsoft barged onto the scene with the beta-test versions of Windows 3.0 and its DPMI. For a few months it appeared that the fledgling DOS extender market would fragment into two mutually exclusive directions […] Microsoft turned control of the DPMI specification over to an industry committee with open membership, and the backers of the XVCPI effort decided to join forces behind the DPMI. […] Microsoft agreed to delete the portions of the DPMI that crossed into DOS extender territory - specifically, direct support of the DOS and ROM BIOS interrupts in protected mode. Consequently, DPMI, Version 0.9, the first public version, released by the DPMI Committee in May 1990, defines only the low-level or building-block functions […] Naturally, the higher level or DOS extender interface of Windows 3.0 still exists, but it has receded into the twilight zone of undocumented functionality. Undocumented, but hardly unusable […]
  2. Duncan, Ray; Petzold, Charles; Schulman, Andrew; Baker, M. Steven; Nelson, Ross P.; Davis, Stephen R.; Moote, Robert (1992). Extending DOS: A Programmer's Guide to Protected-Mode DOS. 2 (2 ed.). Addison-Wesley Publishing Company, Inc. pp. 433–436. ISBN   0-201-56798-9.
  3. Schmit, Michael L. (1995). Pentium Processor Optimization Tools (1 ed.). Cambridge, Massachusetts, USA: Academic Press, Inc. (AP Professional). ISBN   0-12-627230-1.
  4. Microsoft (Fall 1989), DOS Protected Mode Interface Specification, Revision Prerelease 0.04 (Prerelease ed.)
  5. 1 2 3 4 Cole, Dave (1992-05-04). Neiminen, Bruce (ed.). "Re: MS-DOS DPMI extensions" (PDF) (Court document). Microsoft. pp. 123–124. MSC 00779372/00779373, MX3232616/3232617, Cole Exhibit 10, 2001-06-21. Archived (PDF) from the original on 2018-09-18. Retrieved 2018-09-17 via Comes v. Microsoft - Plaintiff's exhibit 1306. […] [Ralph Lipe:] I think, they're checked into Win386 project. In the root MSDOS.DOC (look at all the .DOC files in the root) […] NO! This is an extremely sensitive matter since it basically tells […] ISVs (AKA DR-DOS and IBM) how to run standard mode Windows. You need to clear it with BradSi[lverberg] before distributing it. [Greg Lowney:] SoftNet makes a limulator. They read in the C7 manual that you can run C7 dos-extended if your limulator supports the MS-DOS extensions to the DPMI specification. So […] they called us to get a spec on exactly what those extensions are. Apparently they are not documented. […] They are not that complicated, mostly just what MS-DOS and BIOS calls we map for the application, and Qualitas had no trouble reverse engineering them. (The new 386MAX was, in beta, able to run KRNL386 from the command line, but I believe they disabled that feature in their final product to avoid stepping on our feet. 386MAX does, of course, support C7.) […] Ralph, was the spec distributed to the members of the DPMI committee? […] [Dave Cole:] We should absolutely NOT document this. […]
  6. Microsoft (1990-10-31). Sokolov, Michael (ed.). "MS-DOS API EXTENSIONS FOR DPMI HOSTS Version Pre-Release 0.02" (Annotated retyped preliminary ed.) (published 1999-04-08). Retrieved 2016-05-23.
  7. Microsoft (1989). Sokolov, Michael (ed.). "DOS PROTECTED MODE INTERFACE (DPMI) – SPECIFICATION Protected Mode API For DOS Extended Applications" (Annotated incompletely reconstructed ed.) (published 1999-04-08). Retrieved 2016-05-23.
  8. 1 2 3 4 Wurthmann, Gerold; Wopperer, Bernhard; Wiesböck, Johann (1991). "Die DPMI-Spezifikation – Eine Einführung" [An introduction to the DPMI specification]. Vorträge und Begleittexte zum 2. Entwicklerforum der Design & Elektronik zum Thema: PC-Architektur, 17. September 1991, München[Presentations and supplemental material for the second developer forum on PC architecture on 17 September 1991, Munich] (book) (in German) (1 ed.). Munich, Germany: Markt & Technik Verlag Aktiengesellschaft. p. 223. (NB. The forum was organized by the German magazine Design & Elektronik and Intel.)
  9. The DPMI Committee (1991-03-12). DOS Protected Mode Interface (DPMI) Specification – Version 1.0 – Application Program Interface (API) for Protected Mode DOS Applications (PDF). 1.0. Intel. pp. 4–5. Intel order code 240977-001. Archived from the original (PDF) on 2013-05-31. Retrieved 2013-05-24. The initial DPMI prototype was developed by Microsoft for Windows version 3.0, with input from Lotus Corporation and Rational Systems, as part of a general effort to enhance Windows' performance by allowing the Windows kernel to run in extended memory. In parallel, Intel was working with manufacturers of multitasking environments, EMS emulators, and DOS extenders to ensure that an extended VCPI specification could fully utilize the 80386's virtualization and protection features. In February 1990, the parties involved in the above activities agreed to form the DPMI Committee and formulate an industry-wide standard for protected-mode DOS applications. The Committee released the first public DPMI Specification, Version 0.9 in May 1990.
  10. 1 2 3 Schneider, Stefanie (1994-06-17). "Das Ende von DOS ist nur noch eine Frage der Zeit" [The end of DOS is only a question of time]. Computerwoche (in German). Munich, Germany: IDG Business Media GmbH. Archived from the original on 2022-01-02. Retrieved 2022-01-02.
  11. "FILE: Windows Int 21h and NetBIOS Support for DPMI". Knowledge Base. Microsoft. 2004-08-04 [1999-12-04]. KB65128. Q65128. Archived from the original on 2020-02-20. Retrieved 2016-05-21.
  12. Sokolov, Michael (1998-05-06). "lA correction to a previous posting". lynx-dev. Archived from the original on 2020-02-20. Retrieved 2020-02-20.
  13. Schulman, 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, USA: Addison Wesley. p.  194. ISBN   0-201-63287-X. (xviii+856+vi pages, 3.5"-floppy) Errata:

Further reading