Specifications

System Macros Invoked by Drivers
SETIPL
Example
DEVICELOCK - ;Secure device lock
LOCKADDR=UCB$L_DLCK(R5),- ;(also raises IPL to device lock’s IPL)
SAVIPL=-(SP) ;Save current IPL on stack
SETIPL #IPL$_POWER,- ;Raise IPL to 31
ENVIRON=UNIPROCESSOR ;Avoid assembly-time warning
BBC #UCB$V_POWER, -
UCB$W_STS(R5),30$ ;If clear, no power failure
;Service power failure
.
.
.
DEVICEUNLOCK - ;Release device lock
LOCKADDR=UCB$L_DLCK(R5),-
NEWIPL=(SP)+ ;Restore old IPL from stack
.
.
.
;Branch
30$: ;Start device
.
.
.
WFIKPCH ;Wait for interrupt
Here, the DEVICELOCK macro achieves synchronized systemwide access to
the device registers. The SETIPL macro then synchronizes the local processor
against its own powerful interrupt event. The code does not need to synchronize
systemwide against powerful events, because its interest is truly limited to the
local processor.
Note that the WFIKPCH macro conditionally releases the device lock and restores
the old IPL prior to returning control to the callers caller.
2–66