Specifications
System Macros Invoked by Drivers
LOCK
LOCK
Achieves synchronized access to a system resource as appropriate to the
processing environment.
Format
LOCK lockname [,lockipl] [,savipl] [,condition] [,preserve=YES]
Parameters
lockname
Name of the resource to lock.
[lockipl]
Location containing the IPL at which the resource is synchronized. Although the
value of this argument is ignored by the macro, Digital recommends that you
specify a lockipl value to facilitate debugging.
[savipl]
Location at which to save the current IPL.
[condition]
Indication of a special use of the macro. The only defined condition is
NOSETIPL, which causes the macro to omit setting IPL.
[preserve=YES]
Indication that the macro should preserve R0 across the invocation. If you do not
need to retain the contents of R0, specifying preserve=NO can enhance system
performance.
Description
In a uniprocessing environment, the LOCK macro sets IPL to the IPL that
corresponds to the constant IPL$_lockname.
In a multiprocessing environment, the LOCK macro performs the following
actions:
• Preserves R0 through the macro call (if preserve=YES is specified).
• Generates a spinlock index of the form SPL$C_lockname and stores it in R0.
• Calls SMP$ACQUIRE to obtain the specified spinlock. SMP$ACQUIRE
indexes into the system spinlock database (a pointer to this database is
located at SMP$AR_SPNLKVEC) to obtain the spinlock. Prior to securing the
spinlock, SMP$ACQUIRE raises IPL to the IPL associated with the spinlock,
determining the appropriate IPL from the spinlock structure (SPL$B_IPL).
In either processing environment, the LOCK macro performs the following tasks:
• Preserves the current IPL at the specified location (if savipl is specified)
• Sets the SMP-modified bit in the driver prologue table (DPT$V_SMPMOD in
DPT$L_FLAGS)
2–47