Specifications

Introduction
1.5 Driver Context
In general, context is characterized by the following factors:
Actual parameters that are passed to the routine
The current IPL of the executing processor
The range of IPLs that the routine can change and the required IPL on return
from the routine.
The currently owned spinlocks of the executing processor
The data structures available to the routine
The ability or inability to access process space
A complete description of the context of each driver routine appears in the entry
points chapter of the OpenVMS AXP Device Support: Reference. The following
are some general observations:
All device driver routines execute in kernel mode at an elevated IPL.
Only driver FDT routines execute within process context and can access
process space (P0 and P1).
The majority of driver routines execute in interrupt (or system context):
that is, in the sequence of execution that follows a processors grant of an
interrupt request at a given IPL. Such code can refer only to system (S0)
space. Moreover, it cannot incur exceptions, including page faults, without
causing a fatal bugcheck.
Most driver processing of an I/O request (before and after the device acknowledges
the servicing of the request by requesting an interrupt from the processor) occurs
at a fork IPL. This portion of driver code, which includes most of the start-I/O
routine, is commonly known as the drivers fork process.
There are several instances in the processing of an I/O request when a driver
fork process must suspend execution to wait for a resource or a device interrupt.
To make the matter of saving and restoring fork process context as efficient as
possible, the operating system places a restriction on the context of a driver fork
process, in addition to those that apply to any process in interrupt context. Fork
context consists of the following:
The fork routine parameters (FR3 and FR4)
The fork routine address (FPC)
A fork block (usually the unit control block that can contain additional fork
process context
The operating system places the fork block of a suspended fork process in either
a processor-specific fork queue or a resource wait queue where it waits to be
resumed. When it resumes the fork process, the operating system calls the
fork routine with the FR3 value, FR4 value, and a pointer to the fork block as
parameters.
1.5.1 Example of Driver Context-Switching
Because a device driver consists of a number of routines that are activated by
the system, the operating system determines the context in which the routines
execute.
1–7