A (Root Phase) xxx xxx
c
B ,:-------Location yyyyyy
Figure 59. An Overlay Structure
The overlay structure shown in Figure 59 could be prestructured using the fol­
lowing sequence of commands (Programs A, B, C" D, and E are the names of
TEXT files; the overlay phases will be named Root, Second, Third, etc.): LOAD A B GENMOD ROOT (FROM A TO B STR) GENMOD SECOND (FROM B) LOADMOD ROOT INCLUDE C D GENMOD THIRD (FROM C TO D) GENMOD FOURTH (FROM D) LOADMOD THIRD INCLUDE E GENMOD FIFTH (FROM E)
The programmer need not know the storage address where each phase begins.
A TEXT file can be made to load at the proper address by reloading earlier
phases. In the foregoing example, the command sequences, "LOADMOD ROOT /INCLUDE C D" and "LOADMOD THIRD/INCLUDE E," cause
TEXT files C, D, and E to load at the proper addresses.
If the root phase contains address constants to the other phases, one copy of
the root must be kept in storage while each of the other phases is brought in by
the LOAD or INCLUDE commands without an intervening GENMOD. The
root phase is then processed by GENMOD after all address constants have
been satisfied. In this case, the programmer must know the address where non­
root phases begin (in Figure 59, locations xxxxxx and yyyyyy). The following
sequence of commands could be used: LOAD A B GENMOD SECOND (FROM B) INCLUDE C D (ORIGIN xxxxxx) GENMOD THIRD (FROM C TO D) GENMOD FOURTH (FROM D) INCLUDE E (ORIGIN yyyyyy) GENMOD FIFTH (FROM E) LOAD A B INCLUDE C D (ORIGIN xxxxxx) INCLUDE E (ORIGIN yyyyyy) GENMOD ROOT (FROM A TO C STR) The ORIGIN option of the INCLUDE command is used to cause the included
file to overlay a previously loaded file. The address at which a phase begins
must be a doubleword boundary. For example, if the root phase were X'2BD'
bytes long, starting at virtual storage location X'20000', then location xxxxxx
would be the next double word boundary, or X'202CO'. Assembler Virtual Storage Requirements 463
Dynamic Load Overlay
464 VM/SP System Programmer's Guide
The STR option, which is specified in the GENMOD of the root phase, speci­
fies that whenever that module is brought into storage with the LOADMOD command, the Storage Initialization routine should be invoked. This routine
initializes user free storage pointers.
At execution time of the prestructured overlay program, each phase is brought
into storage with the LOADMOD command. The phases can call LOADMOD. The OS macros LINK, LOAD, and XCTL normally invoke the INCLUDE
command, which loads TEXT files. These macros will invoke LOAD MOD if a
switch, called COMPSWT, in the CMS Nucleus Constant area, NUCON, is
turned on.
With COMPSWT set, overlay phases that use LINK, LOAD, and XCTL must
be prestructured MODULE files.
The dynamic load method of using an overlay structure is to have all the phases
in the form of relocatable object code in TEXT files or members of a TEXT
library, filetype TXTLIB. The OS macros, LINK, LOAD, and XCTL may then
be used to pass control from one phase to another. The XCTL macro causes
the calling program to be overlayed by the called program except when it is
issued from the root phase. When issued from the root phase, CMS treats
XCTL as it would a LINK macro, adding the new code at the end of the root
phase.
The COMPSWT flag in OSSFLAGS must be off when the dynamic load meth­
od is used.
Previous Page Next Page