|
HP OpenVMS systems documentation |
Previous | Contents | Index |
An executive image is an image that is mapped into system space as part of the OpenVMS executive. It contains data, routines, and initialization code specific to an image's functions and features. An executive image is implemented as a form of shareable image. Like any shareable image, it has a global symbol table, image section descriptors, and an image activator fixup section. Unlike a shareable image, however, an executive image does not usually contain a symbol vector.
Universally available procedures and data cells in system-supplied executive images are accessed through entries provided by the symbol vectors in the system base images SYS$BASE_IMAGE.EXE and SYS$PUBLIC_VECTORS.EXE. References to an executive image are resolved through these symbol vectors, whether from an executive image or from a user executable or shareable image.
Unlike a system-supplied executive image, an executive image that you create cannot provide universally accessible entry points and symbols in this manner. Instead, it must establish its own vector of procedure descriptors for its callable routines and make the address of that vector available systemwide.
The OpenVMS executive loader imposes several requirements on the sections of any executive image. These requirements include the following:
An executive image can contain one or more initialization procedures that are executed when the image is loaded. If the image is listed in SYS$LOADABLE_IMAGES:VMS$SYSTEM_IMAGES.DAT as created by means of System Management utility (SYSMAN) commands, initialization procedures can be run at various stages of system initialization.
An initialization routine performs a variety of functions, some specific to the features supported by the image and others required by many executive images. An executive image declares an initialization routine (see Section 4.7.2.1).
The initialization routine may return information to the caller of
LDR$LOAD_IMAGE via a caller-supplied buffer.
4.7.2.1 INITIALIZATION_ROUTINE Macro (Alpha and I64 Only)
The following describes the invocation format of the INITIALIZATION_ROUTINE macro. An equivalent macro, $INITIALIZATION_ROUTINE is provided for BLISS programmers. For C programmers, INIT_RTN_SETUP.H in SYS$LIB_C.TLB is available.
Declares a routine to be an initialization routine.
INITIALIZATION_ROUTINE name [,system_rtn=0] [,unload=0] [,priority=0]
name
Name of the initialization routine.[system_rtn=0]
Indicates whether the initialization routine is external to the module invoking the macro. The default value of 0, indicating that the initialization routine is part of the current module, is the only option supported.[unload=0]
Indicates whether the name argument specifies an unload routine. The default value of 0, indicating that the argument specifies an initialization routine, is the only option supported.[priority=0]
Indicates the PSECT in which the entry for this initialization routine should be placed. Routines that specify the priority argument as 0 are placed in the first PSECT (EXEC$INIT_000); those that specify a value of 1 are placed in the second (EXEC$INIT_001). The routines in the first PSECT are called before those in the second.
The INITIALIZATION_ROUTINE macro declares a routine to be an initialization routine.
4.7.2.2 Linking an Executive Image (Alpha or I64 Only)
The following template can serve as the basis of a LINK command and
linker options file used to create an OpenVMS executive image. See the
HP OpenVMS Linker Utility Manual for a full description of most linker qualifiers and
options referenced by this example.
Use of the linker to create executive images (specifically the use of the /ATTRIBUTES switch on the COLLECT= option in SYS$LIBRARY:VMS_EXECLET_LINK.OPT) is not documented elsewhere and is not supported by HP. |
! Replace 'execlet' with your image name $ LINK /NATIVE_ONLY/BPAGES=14 - /REPLACE/SECTION/NOTRACEBACK- /SHARE=execlet- /MAP=execlet /FULL /CROSS - /SYMBOL=execlet - SYS$LIBRARY:VMS_EXECLET_LNK /OPTION, - SYS$INPUT/OPTION ! SYMBOL_TABLE=GLOBALS ! Creates .STB for System Dump Analyzer CLUSTER=execlet,,,- (1) ! SYS$LIBRARY:STARLET/INCLUDE:(SYS$DOINIT), - (2) ! Insert executive object code here sys$disk:[]execlet.obj ! end of executive object code here SYS$LOADABLE_IMAGES:SYS$BASE_IMAGE.EXE/SHAREABLE/SELECTIVE |
There are two methods of loading an executive image:
To load an executive image with the System Management utility (SYSMAN), perform the following tasks:
SYSMAN SYS_LOADABLE ADD _LOCAL_ executive-image - /LOAD_STEP = SYSINIT - /SEVERITY = WARNING - /MESSAGE = "failure to load executive-image" |
The following is a description of the callable interface to LDR$LOAD_IMAGE.
Loads an OpenVMS executive image into the system.Module
SYSLDR_DYN
LDR$LOAD_IMAGE filename ,flags ,ref_handle ,user_buf
Contextfilename
OpenVMS usage character string type character string access read only mechanism by descriptor
The longword address of a character string descriptor containing the file name of the executive image to be loaded. The file name can include a directory specification and image name, but no device name. If you omit the directory specification, LDR$LOAD_IMAGE supplies SYS$LOADABLE_IMAGES as the default.flags
OpenVMS usage flags type longword (unsigned) access read only mechanism value
A flags longword, containing the following bit fields. (Symbolic names for these bit fields are defined by the $LDRDEF macro in SYS$LIBRARY:LIB.MLB.)
Bit Field Description LDR$V_PAG When set, indicates that the image should be loaded with its pageable sections resident. The flag is generally based on the value of the bit 0 in the S0_PAGING system parameter. This flag is ignored on I64, as all executive image sections are loaded resident (nonpaged). LDR$V_UNL When set, indicates that the image may be removed from memory. LDR$V_OVR When set, indicates that the image's read-only sections should not be overwritten during bugcheck processing. This flag is not used on OpenVMS Alpha or I64 systems. LDR$V_USER_BUF When set, indicates that the caller has passed the address of a buffer that should be passed to the initialization routine. LDR$V_NO_SLICE When set, indicates that the image's sections should not be loaded into a granularity hint region. This flag is ignored on I64, as all executive image sections may be loaded into a granularity hint region. ref_handle
OpenVMS usage address type longword (signed) access write only mechanism by reference
The longword address of a reference handle, a three-longword buffer to be filled by LDR$LOAD_IMAGE as follows:
+00 Address of loaded image or zero if image was loaded sliced. +04 Address of loaded image data block (LDRIMG). See the $LDRIMGDEF macro definition in SYS$LIBRARY:LIB.MLB and VMS for Alpha Platforms Internals and Data Structures for a description of the LDRIMG structure. +08 Loaded image sequence number. user_buf
OpenVMS usage address type longword (signed) access read only mechanism by reference
The longword address of a user buffer passed to executive image's initialization routine if LDR$V_USER_BUF is set in the flags longword.
LDR$LOAD_IMAGE must be called in executive mode.
OpenVMS usage cond_value type longword (unsigned) access write only mechanism by value
Status indicating the success or failure of the operation.
SS$_ACCVIO Unable to read the character string descriptor containing the file name of the executive image to be loaded or to write the reference handle. LOADER$_BAD_GSD An executive image was loaded containing a global symbol that is not vectored through either the SYS$BASE_IMAGE or the SYS$PUBLIC_VECTORS image. SS$_BADIMGHDR Image header is larger than two blocks or was built with a version of the linker that is incompatible with LDR$LOAD_IMAGE. LOADER$_BADIMGOFF During a sliced image load request, a relocation or fixup operation was attempted on an image offset that has no resultant address within the image. LOADER$_DZRO_ISD A load request was made for an executive image that illegally contains demand zero sections. SS$_INSFARG Fewer than three arguments were passed to LDR$LOAD_IMAGE, or, with LDR$V_USER_BUF set in the flags longword, fewer than four arguments. SS$_INSFMEM Insufficient nonpaged pool for the LDRIMG structure or insufficient physical memory to load nonpageable portion of an executive image (that is, an image loaded as nonsliced). SS$_INSFSPTS Insufficient system page table entries (SPTEs) to describe the address space required for the executive image to be loaded as nonsliced. LOADER$_MULTIPLE_ISDS A load request was made for an image that was not linked correctly because it contains more than one each of the following types of sections: fixup
initialization
nonpaged code
nonpaged data
paged code
paged dataLOADER$_NO_PAGED_ISDS SYSBOOT failed to load the executive image because it contains either paged code or paged data sections. SS$_NOPRIV LDR$LOAD_IMAGE was called from user or supervisor mode. LOADER$_NO_SUCH_IMAGE A load request was made for an executive image that was linked against a shareable image that is not loaded. The only legal shareable images for executive images are SYS$BASE_IMAGE and SYS$PUBLIC_VECTORS. SS$_NORMAL Normal, successful completion. LOADER$_PAGED_GST_TOBIG An executive image has more global symbols in the fixup data than can fit in the loader's internal tables. LOADER$_PSB_FIXUPS A load request was made for an executive image that contains LPPSB fixup because it was linked /NONATIVE_ONLY. Executive images must be linked /NATIVE_ONLY. LOADER$_SPF_TOBIG The loader's internal tables cannot accommodate all of the executive image fixups that must be postponed to later in the bootstrap operation. SS$_SYSVERDIF Image was linked with versions of executive categories incompatible with those of the running system. LOADER$_VEC_TOBIG An attempt to load an executive image failed because the image's symbol vector updates for SYS$BASE_IMAGE and SYS$PUBLC_VECTORS exceed the size of the loader's internal tables. Other Any RMS error status returned from $OPEN failures.
Any I/O error status returned from $QIO failures.
LDR$LOAD_IMAGE loads an executive image into system space and calls its initialization routine. Optionally, LDR$LOAD_IMAGE returns information about the loaded image to its caller.The initialization routine is passed by two or three longword arguments, depending upon the setting of LDR$V_USER_BUF:
- Address of loaded image data block (LDRIMG)
- The flags longword
- The longword address of a user buffer passed to the executive image's initialization routine (if LDR$V_USER_BUF is set in the flags longword)
The following is a description of the callable interface to LDR$UNLOAD_IMAGE.
Unloads a removable executive image. This routine is called to unload an execlet. All resources are returned.Module
SYSLDR_DYN
LDR$UNLOAD_IMAGE filename ,ref_handle
Contextfilename
OpenVMS usage character string type character string access read only mechanism by descriptor
The longword address of a character string descriptor containing the file name of the executive image to be unloaded. The file name must be supplied exactly as it was supplied to LDR$LOAD_IMAGE when the executive image was loaded.ref_handle
OpenVMS usage address type longword (signed) access read only mechanism by reference
The longword address of the reference handle containing the three-longword block returned by LDR$LOAD_IMAGE when the executive image was loaded. You can set the first longword of the block to -1 to bypass reference handle checks and simply unload the named executive image.
LDR$UNLOAD_IMAGE must be called in kernel mode.
OpenVMS usage cond_value type longword (unsigned) access write only mechanism by value
Status indicating the success or failure of the operation.
SS$_INSFARG LDR$UNLOAD_IMAGE was not called with two parameters. SS$_BADPARAMS Reference handle data inconsistent with LDRIMG block that matches the name in the first argument. LOADER$_MARKUNL A call was made to the LDR$UNLOAD_IMAGE routine to unload a removable executive image that already has an outstanding unload request against it. SS$_NOPRIV LDR$UNLOAD_IMAGE was not called in kernel mode. SS$_NORMAL Executive image was successfully removed from the system. LOADER$_NOT_UNL A call was made to LDR$UNLOAD_IMAGE to unload an executive image that is not loaded or that was not loaded with the LDR$V_UNL flag bit set. LOADER$_UNL_PEN A call was made to LDR$UNLOAD_IMAGE to unload an executive image that is in use. The image is marked to be unloaded later.
LDR$UNLOAD_IMAGE removes an executive image from system space and returns all memory resources allocated when the image was loaded. Images can only be removed if they were originally loaded with the bit LDR$V_UNL set in the input flags to LDR$LOAD_IMAGE.
Previous | Next | Contents | Index |