DMA

In the MS-DOS environment, applications can use DMA to directly transfer data between application memory and the memory on a device. In Windows NT, applications cannot use DMA to directly access physical memory. If they could, they would subvert the memory protection afforded by the Windows NT memory manager. Therefore, the VDM controls all the DMA ports used by MS-DOS applications. Requests for DMA service from MS-DOS applications do not actually result in the DMA controller being programmed. Instead, the VDM traps the parameters to the request and does not actually transfer the data. It is up to the VDD to pick up the DMA transfer request and complete the operation. Because the VDM keeps track of DMA requests on a per-channel basis, more than one VDD in the same VDM can use DMA as long as they use different channels.

Unlike the callback mechanisms for I/O port access and memory-mapped accesses, the VDD is not notified directly that a DMA transfer has been requested. Instead, the VDD determines the application has requested a DMA operation when the VDD receives a command from the application through the normal I/O port channels on its board. The application and the device must use some sort of synchronization technique to coordinate DMA transfers. Because all possible synchronization messages between an MS-DOS application and its device must pass through the VDD in a Windows NT system, the VDD is notified whenever a DMA transfer is requested. At that point, the VDD must do something to actually transfer the data.

There are two strategies for handling DMA from a VDD. The first strategy involves the least programming work, but it requires two buffer-copy operations and is inherently inefficient. The second strategy is harder to implement but more efficient because it only requires a single buffer-copy operation. These two strategies are described in the following sections.