Virtual device drivers are installable modules responsible for virtualizing the hardware and ROM BIOS aspects of the DOS environment for virtual DOS machines. A virtual device driver manages shared access to hardware I/O devices for multiple VDMs, allowing an application running in a VDM to act as though it exercised sole control over I/O devices. See also Figure "MVDM System Structure Overview".
Virtual device drivers are implemented whenever possible, allowing the BIOS in the system to perform its functions without interference from DOS applications. Virtual device drivers are used to control hardware, such as the keyboard, mouse, and serial and parallel ports.
The virtual device driver architecture implemented in OS/2 Version 2.0 provides compatible support for all standard hardware utilized by DOS applications and supports installable virtualization, allowing new hardware to be added in the field and supported by VDMs without requiring an upgrade to the operating system.
Virtual device drivers are responsible for the following functions:
Since DOS may be emulated more than once in OS/2 Version 2.0, virtual device drivers must virtualize the following features to maintain a separate hardware state for each VDM:
A virtual device driver typically performs I/O through a physical device driver, using a direct call interface. However, a virtual device driver may directly access an I/O control device; this technique is used by the virtual video device driver, VVIDEO.SYS, for performance reasons. A virtual device driver may simulate hardware interrupts into one or many VDM processes.
Virtual device drivers use a minimal amount of memory. Virtual device drivers do not have to reserve arrays of data structures for each VDM (as did device drivers under previous versions of OS/2). They may be made swappable, so that each device driver does not increase the amount of conventional (or real) memory space consumed. Conventional memory is used only for code and data that must be accessible at hardware interrupt time (for example, when calling a physical device driver).
Under OS/2 Version 2.0, a virtual device driver is inherently protected from a VDM because it is not visible in the VDM address space, although the device driver must be careful to check all parameters coming in from a VDM to ensure that it does not damage itself or some other part of the system by executing an invalid instruction.
Virtual device drivers obtain and release system resources via the Virtual Device Helper (VDH) services provided by the MVDM kernel. These helper services are accessed via a published programming interface so that manufacturers of hardware devices may develop virtual device drivers for their own devices. Virtual device drivers are installed using the DEVICE= statement in CONFIG.SYS.
Note that a virtual device is required only if a device will be shared with other virtual DOS machines. If a particular device is to be used exclusively by one DOS application, a normal DOS device driver (that is, one that is written for DOS) may be used, and a virtual device driver is not required.