UNIX system concepts for DOS programmers

Characteristics of NT drivers

All NT drivers are identical. In other words, there is no distinction between a file system driver, a disk driver, and a host adapter driver. This allows all NT drivers to be ``stacked'' on top of each other modularly.

All driver interaction is overseen by the I/O Manager, so there is no direct communication between drivers. When an I/O request is received from a user process or a protected subsystem, it is handled as follows:

  1. The I/O manager creates an NT kernel object called an I/O Request Package, or IRP. The IRP contains such details as the file handle, process ID, file name, and byte offset.

  2. The I/O manager uses the filename to decide which driver should process the IRP and calls the apropriate driver entry point in the context of the calling process.

    If the driver is not controlling an actual device, it should have a special entry point called a completion routine that will be called by the I/O manager when the IRP has been completed.

  3. An intermediate driver adds an entry onto a stack contained in the IRP. This entry contains information that will be used by the next driver in the chain. For example, a filesystem driver might change a file-relative offset into a partition-relative offset and call the I/O manager to pass the IRP to a host adapter driver.

In some cases, a driver may have only one entry point that provides the functionality of several required entry points.

The NT kernel provides a deferred procedure call mechanism that is used to minimize the amount of time spent in an interrupt handler. When an NT driver receives an interrupt, it should immediately stop the device from interrupting, save all state information necessary to process the interrupt, and then make a deferred procedure call to a function that processes the interrupt. At some later time, the NT kernel will execute the deferred procedure call at a lower interrupt priority than the real interrupt handler.

© 2005 The SCO Group, Inc. All rights reserved.