User`s guide

Recommended and Required Source Changes
3.10 Locking Pages into a Working Set
Table 3–1 shows the code changes necessary for using these macros. The
delineating labels are replaced by the $LOCKED_PAGE_START and $LOCKED_
PAGE_END macros. The descriptor is eliminated, and the $LKWSET call in the
initialization code is replaced by $LOCK_PAGE_INIT.
Table 3–1 Image Initialization-Time Lockdown
Code Section On VAX Systems On Alpha Systems
Data
declaration
LOCK_DESCRIPTOR:
.ADDRESS LOCK_START
.ADDRESS LOCK_END
Nothing. Eliminate the
descriptor altogether.
Initialization
$LKWSET_S LOCK_DESCRIPTOR
BLBC R0,ERROR
$LOCK_PAGE_INIT ERROR
Main code
LOCK_START:
Routine_A:
.
.
.
RSB
LOCK_END:
$LOCKED_PAGE_START
Routine_A:
.
.
.
RSB
$LOCKED_PAGE_END
Locking Code Written in Other Languages
Code written in other programming languages can also be locked down
by using the $LOCK_PAGE_INIT macro in a VAX MACRO module. Any
code in any module written in any language will be locked by this macro
if the psect $LOCK_PAGE_2 is used for the generated code and the psect
$LOCK_LINKAGE_2 is used for the generated linkage section.
On-the-Fly Lockdown
For on-the-fly lockdown, $LOCK_PAGE and $UNLOCK_PAGE, respectively, mark
the beginning and end of a section of code to be locked. The marked code becomes
a separate routine in the locked psect, where all code locked anywhere in the
image is placed.
$LOCK_PAGE locks the pages and linkage section of the locked routine into the
working set and JSRs to it. This macro is placed inline in executable code. All
code between this macro and the matching $UNLOCK_PAGE macro is included
in the locked routine and is locked down.
$UNLOCK_PAGE returns from the locked routine and then unlocks the
pages and linkage section from the working set. The macro is placed inline in
executable code at some point after a $LOCK_PAGE macro.
$LOCK_PAGE and $UNLOCK_PAGE both have an optional parameter, ERROR,
which is an error address to which to branch if the $LKWSET or $ULWSET
calls fail. $UNLOCK_PAGE has a second optional parameter, LINK_SECT.
LINK_SECT is a linkage psect to which to return if the linkage psect in effect
when the $LOCK_PAGE macro was executed was not the default linkage psect,
$LINKAGE.
Recommended and Required Source Changes 3–21