Guardian Procedure Calls Reference Manual (G06.25+)
Guardian Procedure Calls (A-B)
Guardian Procedure Calls Reference Manual—522629-013
2-38
ARMTRAP Procedure
(Superseded by SIGACTION_INIT_ Procedure )
•
Base-address equivalencing and declaring local variables
Any local variables in the application program’s trap-handling procedure must be
declared relative to the L register by using base-address equivalencing. For
example:
INT I = 'L' + 9;
STRING .EXT X(X_TEMPLATE) = 'L' + 12;
Assuming that the trap handler begins with the statement CODE ( PUSH %777 ),
the first local variable should be placed at ‘L’+9.
For details on base-address equivalencing, refer to the
TAL Reference Manual.
The trap-handling procedure must contain a statement that explicitly allocates
storage for any locally declared variables (see the preceding consideration).
•
Space ID, P register, and hardware ENV register
The space ID consists of a code space bit that signifies system or user space, a
library space bit that signifies code or library space, and a 5-bit index to indicate
which of the 32 possible segments you are referring to. For more information
about space IDs, refer to the appropriate system description manual for your
system.
At the time of a trap, the space ID of the calling procedure is placed in the stack at
‘L’[-5]; the stack marker ENV register at ‘L’[-1] also contains the system code and
library code bits but not the index. When exiting the trap handler, execution
resumes at the location identified by the P register at ‘L’[-2], the space index in the
stack at ‘L’[-5], and the library space and code space bits of ‘L’[-1].
•
Value for the P register
The value for the P register at the time of the trap depends upon the trap condition.
In the following table, I represents the address of the instruction being executed at
the time of the trap, and ? means undefined.
Note. Variables declared in this form cannot be initialized.
Trap P Register
0I
1I
2I + 1
3?
4I
5?
11 I
12 I
13 ?