User`s guide

Recommended and Required Source Changes
3.10 Locking Pages into a Working Set
These macros reside in LIB.MLB, since anyone needing to lock pages into the
working set should already be executing privileged code.
Note
These two methods (lockdown done at image initialization time and
on-the-fly lockdown) cannot be combined in one image. The $ULWSET
service issued by the on-the-fly lockdown will also unlock the section that
was locked at initialization time. You must choose one method or the
other for the entire image. Be particularly careful in images that contain
modules compiled from different source languages.
How the OpenVMS Alpha and OpenVMS I64 Architectures Affect Locking Pages
Locking pages into a working set is much more complicated on an OpenVMS
Alpha or OpenVMS I64 system than it is on an OpenVMS VAX system, for these
reasons:
• It is not sufficient to lock the code in memory. Since the code will make
references to its linkage section for various values and routine addresses, the
linkage section must also be locked. Note: The linkage section on OpenVMS
Alpha corresponds to, on OpenVMS I64, the Global Data segment or the GP
area. The GP area is the data area for an entire program, not just one routine
as on OpenVMS Alpha.
• Due to the optimization that is done by the compiler, it is not sufficient to put
labels before and after the code to be locked—the compiler may move some of
the code between the labels to an area outside of their scope.
• The poor programmer’s method of raising IPL and specifying the IPL as
a data location at the end of the code to be locked does not work for these
reasons as well as for the following reasons:
The sequence requires the execution of multiple instructions, making it
impossible to reference the IPL and raise IPL atomically.
OpenVMS Alpha and OpenVMS I64 compiler technology prevents code
and data (for example, the longword containing the IPL) from being in the
same program section.
The only way to lock pages into the working set on OpenVMS Alpha or OpenVMS
I64 is to call the system service $LKWSET.
Using Program Sections (Psects) to Delineate Code
The macros provided here use psects to enclose the section of code to be locked.
The macros create three psects, name them sequentially, and use them in the
following way:
• The beginning and ending labels of the code are defined in the first and last
psects, respectively.
• The code itself is put in the middle psect.
Provided that the attributes of all psects are the same, the linker will place them
sequentially in the image. The same thing must be done for the linkage section,
which requires a second $LKWSET call.
Recommended and Required Source Changes 3–19