General
Application area: | Linking and loading; see "Linking and loading" |
Macro type: | Type O; see "O-type macros" |
Macro description
The SEGLD macro permits automatic loading of a segment, even if it already resides in memory. Further segments within the same path of the overlay structure are loaded automatically.
A continuation address can be specified.
Macro format and description of operands
SEGLD |
symbol1[,symbol2] |
symbol1
Symbolic address within the segment to be loaded. A 4-byte V-type constant is generated for this symbol.
symbol2
Symbolic address in the calling or another module to which control is passed once loading has been completed (no V-type constant). If this operand is omitted, control is returned to the instruction following the SEGLD macro.
Functional description
The SEGLD macro (and also the CALL macro) causes the automatic loading of segments (nonautomatic loading is performed by the LPOV macro).
A statement in the SEGLD macro causes the Assembler to generate a V-type constant from the symbolic address specified. This constant identifies the segment to be loaded. Based on the V-type constant in the SEGLD macro (and on the CONTROL=YES operand in the PROGRAM control statement) the linkage editor generates an overlay control module required for automatic loading which satisfies the V-type constant with an address. When the SEGLD macro is executed, control is passed to the overlay control module. The segment that contains the symbolic address as well as all further segments within the same path of the overlay structure are then brought into memory by the overlay control module. This takes place regardless of whether or not the segments are already in memory.
Upon completion of the loading process control is returned to the instruction following the SEGLD macro (if the “symbol2” operand is omitted). The optional address provided by the “symbol2” operand can be present within the calling module or may be an external reference. In the latter case the user must issue the corresponding ENTRY and EXTRN statements as well as making sure that the module that contains “symbol2” is in memory after completion of the loading process (see the “Utility Routines” manual [27 (Related publications)]).
Notes on the macro call
The overlay structure of a program in which automatic loading of segments is performed should be designed in such a way as to allow for additional memory requirements for the overlay control module, for ENTAB and for SEGTAB (see the “Utility Routines” manual [27 (Related publications)]).
The SEGLD macro must be contained in a program area that is covered by a USING statement. As register 15 is used by the SEGLD macro for segment loading, it must not be used as the base register for the program section that contains the SEGLD macro.
Return information and error flags
If an error occurs while an overlay segment is being loaded, the Executive continues the program with the command following SEGLD. If no error occurs, the continuation address specified in the macro applies.
R15:
+---------------+ | | | | | | | | | | | |a|a| +---------------+
A return code relating to the execution of the SEGLD macro is transferred in the rightmost byte of register R15.
X'aa' | Meaning |
X'00' | Segment has been loaded |
X'04' | Incorrect read-only modification record |
X'08' | Incorrect record code in text/modification block, or there is a modification record before the |
X'0C' | Too many read-only modification records present, or segment name cannot be found in any |
X'10' | There is no index record for load modules with segment name %ROOT |
X'14' | There is insufficient memory space to load the segment |
X'18' | Incorrect code information, or error in reading PAM load module file, or error in message |
X'1C' | Incorrect segment name |
X'20' | Error in loading AID |
X'24' | Error in reading a C element of a PLAM library |