Specifications

Operating System Routines
EXE$MODIFY
Description
A driver uses EXE$MODIFY as an FDT routine when the driver must both read
from and write to the user-specified buffer. Because EXE$MODIFY transfers
control to EXE$QIODRVPKT if its operations are successful or EXE$ABORTIO if
they are not, it must be the last FDT routine called to perform the preprocessing
of I/O read/write requests. A driver cannot use EXE$MODIFY for buffered I/O
operations.
EXE$MODIFY performs the following functions:
Sets IRP$V_FUNC in IRP$W_STS to indicate a read function.
Writes the p4 argument of the $QIO request into IRP$L_IOST2 (IRP$B_
CARCON).
Translates logical read and write functions to physical read and write
functions.
Examines the size of the transfer, as specified in the p2 argument of the $QIO
request, and takes one of the following actions:
If the transfer byte count is zero, EXE$MODIFY transfers control to
EXE$QIODRVPKT to deliver the IRP to the drivers start-I/O routine.
The driver start-I/O routine should check for zero-length buffers to avoid
mapping them to UNIBUS, Q22–bus, MASSBUS, or VAXBI node space.
An attempted mapping can cause a system failure.
If the byte count is not zero, EXE$MODIFY loads the byte count and the
starting address of the transfer into R1 and R0, respectively, and calls
EXE$MODIFYLOCK.
EXE$MODIFYLOCK calls EXE$MODIFYLOCKR. EXE$MODIFYLOCKR calls
EXE$READCHKR, which performs the following tasks:
Moves the transfer byte count into IRP$L_BCNT. If the byte count is negative,
it returns SS$_BADPARAM status to EXE$MODIFYLOCKR.
Determines if the specified buffer is write accessible for a read I/O function,
with one of the following results:
If the buffer allows write access, EXE$READCHKR sets IRP$V_FUNC in
IRP$W_STS and returns SS$_NORMAL to EXE$MODIFYLOCKR.
If the buffer does not allow write access, EXE$READCHKR returns SS$_
ACCVIO status to EXE$MODIFYLOCKR.
If EXE$READCHKR succeeds, EXE$MODIFYLOCKR moves into IRP$W_BOFF
the byte offset to the start of the buffer and calls MMG$IOLOCK. MMG$IOLOCK
attempts to lock into memory those pages that contain the buffer, with one of the
following results:
1
If MMG$IOLOCK succeeds, EXE$MODIFYLOCKR stores in IRP$L_SVAPTE
the system virtual address of the process PTE that maps the first page
of the buffer, and returns control to EXE$MODIFY. EXE$MODIFY calls
EXE$QIODRVPKT to deliver the IRP to the drivers start-I/O routine.
1
For read requests, MMG$IOLOCK performs an optimization for any nonvalid page
contained within the buffer. It creates a demand-zero page rather than fault into
memory the requested page. However, if the buffer extends to more than one page, this
optimization is not possible.
3–38