Object Code Accelerator Manual
Preparing Your Program for TNS/E Systems
Object Code Accelerator Manual—528144-003
2-5
Trap Handlers That Use the Program Counter
TNS/E systems because the register stack contents are imprecise at the moment of a
trap. (The register stack consists of registers R0 through R7.)
•
On TNS systems, trap handlers can be declared as functions (return a value to a
caller) and they can modify the register stack.
•
On TNS/E systems, trap handlers cannot be declared as functions and they can
reliably examine and change only certain registers. User-written trap handlers must
not alter the register stack.
User-written trap handlers on TNS/E systems can:
•
Print error messages and abend
•
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/E 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.