Specifications

Operating System Routines
EXE$WRITE
Description
A driver uses EXE$WRITE as an FDT routine when the driver must read
from the user-specified buffer. Because EXE$WRITE 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
write I/O requests. A driver cannot use EXE$WRITE for buffered I/O operations.
EXE$WRITE performs the following functions:
Writes the p4 argument of the $QIO request into IRP$L_IOST2 (IRP$B_
CARCON).
Translates a logical write function to a physical write function.
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$WRITE 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$READ loads the byte count and the
starting address of the transfer into R1 and R0, respectively, and calls
EXE$WRITELOCK.
EXE$WRITELOCK calls EXE$WRITELOCKR.
EXE$WRITELOCKR calls EXE$WRITECHKR, 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$WRITELOCKR.
Determines whether the specified buffer is read accessible for a write I/O
function, with one of the following results:
If the buffer allows read access, EXE$WRITECHKR returns SS$_
NORMAL to EXE$WRITELOCKR.
If the buffer does not allow read access, EXE$WRITECHKR returns
SS$_ACCVIO status to EXE$WRITELOCKR.
If EXE$WRITECHKR succeeds, EXE$WRITELOCKR 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:
If MMG$IOLOCK succeeds, EXE$WRITELOCKR 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$WRITE. EXE$WRITE transfers control to
EXE$QIODRVPKT to deliver the IRP to the drivers start-I/O routine.
If MMG$IOLOCK fails, it returns SS$_ACCVIO, SS$_INSFWSL, or page
fault status to EXE$WRITELOCKR.
If either EXE$WRITECHKR or MMG$IOLOCK returns an error status,
EXE$WRITELOCKR transfers control to EXE$ABORTIO.
3–62