Register Restoration
For macro simulation SVC calls, and for user-handled SVC calls, no error return is
recognized by DMSITS. As a result, DMSITS always returns to the calling routine
by loading the SVC old PSW, which was saved when DMSITS was first entered.
Upon entry to DMSITS, all registers are saved as they were when the SVC instruc­
tion was first executed. Upon exiting from DMSITS, all registers are restored from
the area in which they were saved at entry.
The exception to this is register 15 in the case of SVC 202 and 203. Upon return
to the calling routine, register 15 always contains the value that was in register 15
when the called routine returned to DMSITS after it had completed processing.
Called Routine Modifications to System Area
If the called routine has system status, so that it runs with a PSW storage protect
key of 0, then it may store new values into the System Save Area.
If the called routine wishes to modify the location to which control is to be
returned, it must modify the following fields:
For SVC 202 and 203, it must modify the NUMRET and ERRET (normal and
error return address) fields.
For other SVCs, it must modify the address field of OLDPSW. To modify the registers that are to be returned to the calling routine, the fields EGPRl, EGPR2, through EGPR15 must be modified.
If this action is taken by the called routine, then the SVCTRACE facility may print
misleading information, since SVCTRACE assumes that these fields are exactly as
they were when DMSITS was first entered. Whenever an SVC call is made,
DMSITS allocates two save areas for that particular SVC call. Save areas are allo­
cated as needed. For each SVC call, a system and user save area are needed.
When the SVC-called routine returns, the save areas are not released, but are kept
for the next SVC. At the completion of each command, all SVC save areas allo­
cated by that command are released.
The System Save Area is used by DMSITS to save the value of the SVC old PSW at the time of the SVC call, the calling routine's registers at the time of the call, and
any other necessary control information. Since SVC calls can be nested, there can
be several of these save areas at one time. The system save area is allocated in pro­
tected free storage.
The user save area contains 12 double words (24 words), allocated in unprotected
free storage. DMSITS does not use this area at all, but simply passes a pointer to
this area (via register 13.) The called routine can use this area as a temporary work
area, or as a register save area. There is one user save area for each system save
area. The USAVEPTR field in the system save area points to the user save area.
The exact format of the system save area can be found in the VM / SP Data Areas
and Control Block Logic, Volume 2. The most important fields, and their uses, are
as follows:
Functional Information 345
Dynamic Linkage--Subcom
Field
CALLER
CALLEE CODE OLDPSW NRMRET
ERRET EGPRS EFPRS SSAVENXT SSAVEPRV USAVEPTR Usage
(Fullword) The address of the SVC instruction that resulted in
this call.
(Doubleword) Eight-byte symbolic name of the called routine.
For OS and user-handled SVC calls, this field contains a charac­
ter string of the form SVC nnn, where nnn is the SVC number in
decimal.
(Halfword) For SVC 203, this field contains the halfword code
following the SVC instruction line.
(Doubleword) The SVC old PSW at the time that DMSITS was
entered.
(Fullword) The address of the calling routine to which control is
to be passed in the case of a normal return from the called rou­
tine.
(Fullword) The address of the calling routine to which control is
to be passed in the case of an error return from the called
routine.
(16 Fullwords, separately labeled EGPRO, EGPRl, EGPR2, EGPR3, ... , EGPR15) The entry registers. The contents of the
general registers at entry to DMSITS are stored in these fields.
(4 Doublewords, separately labeled EFPRO, EFPR2, EFPR4, EFPR6) The entry floating-point registers. The contents of the
floating-point registers at entry to DMSITS are stored in these
fields.
(Fullword) The address of the next system save area in the
chain. This points to the system save area that is being used, or
will be used, for any SVC call nested in relation to the current
one.
(Fullword) The address of the previous system save area in the
chain. This points to the system save area for the SVC call in
relation to which the current call is nested.
(Fullword) Pointer to the user save area for this SVC call.
It is possible for a program that has already been loaded from disk to become
known by name to CMS for the duration of the current command; such a program
thus can be called via SVC 202. In addition, a program that has become known
dynamically can make other programs known dynamically (if the first program can
supply the entry points of the other programs).
To become known dynamically to CMS, a program or routine invokes the create
function of SUBCOM. To invoke SUBCOM, issue the following calling sequence
from an assembler language program:
346 VM/SP System Programmer's Guide
Previous Page Next Page