NonStop S-Series Server Description Manual (G06.24+)
TNS Execution Modes
HP NonStop S-Series Server Description Manual—520331-003
6-44
Actions of the EXIT Instruction
Actions of the EXIT Instruction
The EXIT instruction uses the three-word stack marker to restore the caller’s
environment. The sequence is as follows, with reference to Figure 6-25. (For
simplicity, and continuity with the preceding PCAL description, this sequence assumes
the return is from a procedure that was called with PCAL rather than XCAL.)
1. The S register setting is moved below the local area, the stack marker, and any
parameters to the exiting procedure.
The S^decrement value (which is specified in the EXIT instruction) is subtracted
from the current L register setting and placed in the S register. The value of
S^decrement is 3 (for the stack marker) plus the number of words of parameter
and mask information passed to the exiting procedure.
2. The P register is set with the P register value saved in the stack marker at L[–2].
The next instruction to be executed will be the one following the PCAL instruction.
3. The Environment register is restored from a combination of the current
Environment register setting and the Environment register value saved in the
register stack at
L[–1].
The mode (privileged or nonprivileged) and data area bits are reestablished to be
the lesser of the caller’s and the current settings. This ensures that a
nonprivileged user cannot exit with privileged capability. The caller’s CS (code
space), LS (library space), T (traps), V (overflow), and K (carry) bits are
reestablished from L[-1]. Z and N (Condition Code) are left at their current settings
to reflect the results of the call. RP is left at its current setting so that a value in the
register stack can be returned to the caller as a function result value.
4. The L register is restored from the L register value saved in the stack marker at
L[0]. This moves L back to point to the preceding stack marker, thereby
reestablishing the preceding local data area.
The instruction following the PCAL instruction then executes.