Specifications
Introduction
1.5 Driver Context
As an example, consider the following write request that occurs without error:
1. A user process executing in user mode calls the $QIO system service to write
data to a device.
2. The $QIO system service gains control in process context but in kernel mode.
It performs device-independent preprocessing of the I/O request.
3. The system service uses the driver’s function decision table (FDT) to call the
appropriate FDT routines to perform device-dependent preprocessing. These
FDT routines execute in full process context in kernel mode.
4. When preprocessing is complete, a system routine creates a fork process to
execute the driver’s start-I/O routine in kernel mode.
5. The start-I/O routine activates the device unit and suspends itself. At this
point, the operating system suspends the fork process executing the start-I/O
routine and saves sufficient context to reactivate the start-I/O routine at the
point of suspension.
6. When the device completes the data transfer, it requests an interrupt. The
interrupt causes the system to activate the driver’s interrupt service routine.
7. The interrupt service routine executes to handle the device interrupt. It then
causes the start-I/O routine to resume in interrupt context.
8. The start-I/O routine regains control in interrupt context but almost
immediately issues a request to the operating system to transform its
context to that of a fork process. This action dismisses the interrupt.
9. When reactivated in fork process context, the start-I/O routine performs
device-specific I/O completion and passes control to the system for additional
I/O postprocessing.
10. System I/O postprocessing runs in interrupt context at a lower IPL and issues
a special kernel-mode asynchronous system trap (AST) for the user process
requesting I/O.
11. When the special kernel-mode AST is delivered, the AST routine executes in
full process context in kernel mode to deliver data and status to the process.
If the original request specified a user-mode AST, the special kernel-mode
AST queues it.
12. When the user process gains control, the user’s AST routine executes in full
process context in user mode.
1.6 Programmed-I/O and Direct-Memory-Access Transfers
Devices are equipped with various registers that initiate, control, and monitor
the progress of data transfer, seek operation, or other requests for device activity.
When it completes a request, the device posts an interrupt to the processor. The
size of the transfer concluded by a device interrupt depends upon the capabilities
of the device.
1–8










