Accelerator Manual (G06.24+, H06.03+)
Preparing Your Program for TNS/R Systems
Accelerator Manual—527303-002
2-5
Trap Handlers That Use the Program Counter
•
Clear overflow and resume
•
Resume after a loop timer
•
Put values into global variables
•
Jump to a restart point by changing the trap variables P, L, ENV, space ID, and S
•
Save the register stack with the usual code statement of:
CODE (PUSH %777); ! Save register stack contents
However, the contents of the register stack are imprecise at the moment of a trap
for programs executing on TNS/R systems. The contents of the register stack
might not be the same as on TNS systems.
Refer to the Guardian Programmer’s Guide for information on writing overflow traps.
Detection Guideline
•
Find trap handlers by looking for calls to the ARMTRAP system procedure with
parameters (address of label, address of data area). The ARMTRAP procedure
specifies an entry point into the application program where execution is to begin if
a trap occurs. You do not need to change ARMTRAP procedures with parameters
of (-1,-1). These parameters cause programs to abend on traps. Trap handlers are
usually small enough in both size and number to check visually.
Required Change
•
Change your programs to comply with the preceding restrictions.
Trap Handlers That Use the Program Counter
The reported program counter register, P, is imprecise for all code. Do not rely on the
value of P to determine program flow, to inspect the TNS instruction word which
triggered the trap, or to calculate the target of a jump.
You can change the P trap variable to a valid restart point such as a cleanup point in
the outer block, but do not perform arithmetic on P. For example, the results of the
following operations are undefined:
INT trap_p = 'L' - 2; ! Location of the P register
trap_p := trap_p '+' 1; ! Undefined
trap_p := trap_p '-' 1; ! Undefined
Refer to Trap Handlers That Use the Register Stack on page 2-4 for guidelines on
writing trap handlers.
Detection Guideline
•
Find trap handlers by looking for calls to the system procedure ARMTRAP with
parameters (address of label, address of data area). The ARMTRAP procedure