User`s guide

Recommended and Required Source Changes
3.10 Locking Pages into a Working Set
All registers are preserved by both macros unless the error address parameter is
present and one of the calls fail, in which case R0 reflects the status of the failed
call. R1 then contains 0 if the call to lock or unlock the code failed, and 1 if that
call succeeded but the call to lock or unlock the linkage section failed.
Control must enter the code through the $LOCK_PAGE macro, and must leave
through the $UNLOCK_PAGE macro. The local symbol block that is in effect
when the $LOCK_PAGE macro is executed is restored when the $UNLOCK_
PAGE macro is executed, but since the locked code becomes a separate routine,
the locked code itself is a separate local symbol block. Even if named symbols are
used, branches into or out of the locked code section are not allowed, and will be
flagged by the compiler with the following error:
%AMAC-E-MULTLKSEC, Routines which share code must use the same linkage psect.
Note that since the locked code is made into a separate routine, any references
to local stack storage within the routine will have to be changed, as the stack
context is no longer the same.
Note
Because on-the-fly lockdown requires the overhead of four system
service calls plus an extra subroutine call every time it is executed, it
is recommended that this be changed to initialization-time lockdown if
the lockdown is done for any performance-critical code. If other routines
in the image use initialization-time lockdown, then you must change the
on-the-fly lockdown to initialization-time lockdown.
Table 3–2 shows the code changes required to use these macros for on-the-fly
lockdown. Note that the $UNLOCK_PAGE macro precedes the RSB, so that it is
executed. Any status being passed by the routine in R0 and R1 remains intact
because $UNLOCK_PAGE preserves these registers.
Table 3–2 On-the-Fly Lockdown
Code Section On VAX Systems On Alpha Systems
Main code
Routine_A:
.
.
.
SETIPL 100$
.
.
.
RSB
100$: .LONG IPL$SYNCH
Routine_A:
.JSB_ENTRY
.
.
.
$LOCK_PAGE
.
.
.
$UNLOCK_PAGE
RSB
Table 3–3 shows the same original code and the changes necessary for
initialization-time lockdown.
3–22 Recommended and Required Source Changes