NonStop S-Series Server Description Manual (G06.24+)
TNS Execution Modes
HP NonStop S-Series Server Description Manual—520331-003
6-42
Actions of the PCAL Instruction
Actions of the PCAL Instruction
The following steps are performed when a Procedure Call (PCAL) instruction is 
executed. The step numbers refer to Figure 6-24. Note that before PCAL executes, 
the program must push the procedure parameters (and the mask word or words, for 
procedures with a variable number of parameters) onto the memory stack.
1. The caller’s environment is saved in a three-word stack marker, which is pushed 
onto the top-of-stack location, as indicated by the address in the S register. The 
stack marker contains the following information:
•
The current P register setting (address of the instruction following PCAL).
•
The current Environment register setting. The stored copy contains the 
complete segment identification of the caller’s segment, even though this call 
and return is within a single segment.
•
The current L register setting (the beginning of the caller’s local data area).
2. If the calling procedure is not executing in privileged mode, the “callability” attribute 
of the procedure being called is checked.
First, the PEP number field of the PCAL instruction is compared with the entry in 
C[0]. If the PEP number is less than the C[0] entry, this is a call to a nonprivileged 
procedure and no special action is taken. However, if the PEP number is greater 
than or equal to the C[0] entry, this is a call to a callable or privileged procedure, so 
a second check is made. The PEP number is compared with the entry in C[1]. If 
the number is greater than or equal to C[1], this is a call to a privileged procedure 
and an instruction failure trap occurs. Otherwise, this is a call to a callable 
procedure, so the PRIV bit is set.
3. The S and L registers are set with the G[0]-relative address of the new top-of-stack 
location (the third word of the stack marker). The new L register setting defines the 
base of the local area for the procedure being called.
4. The new S register setting is tested for being an address within the memory stack 
area, G[0:32767]. If the value is greater than 32,767, control is transferred to the 
operating system’s stack overflow trap (aborting the PCAL instruction).
5. The C-relative address of the procedure being called is obtained from the PEP 
table entry pointed to by the PEP number field in the PCAL instruction. This 
address is put in the P register so that the next instruction executed will be the first 
instruction of the called procedure.
6. Finally, RP is given an initial value of 7 (stack empty).










