Guardian Programmer's Guide

Table Of Contents
Debugging, Trap Handling, and Signal Handling
Guardian Programmer’s Guide 421922-014
25 - 15
Trap Handling on Native Systems
Trap Handling on Native Systems
Special restrictions apply to trap handlers that execute on native systems. You should
observe the following rules:
Trap P variable
The TNS trap P variable is only approximate for a process running in accelerated
mode. You should not use it to inspect the code area and determine the failing
instruction.
You should not increment the trap P variable and resume execution; doing so
causes undefined results. However, you can change the trap P variable to a valid
TNS restart point. See Exiting to Another Destination earlier in this section.
Invalid trap ENV fields
ENV.RP is not valid for a process running in accelerated mode. For compatibility
with TNS mode and TNS CPUs, programs must set ENV.RP to an appropriate
value before resuming; to resume at a statement, the appropriate value is usually
7.
The ENV fields N, Z, and K are not reliable for a process running in accelerated
mode.
Register stack R[0:7]
The contents of the TNS register stack are not valid in accelerated mode and are
not dependable in TNS mode. You should never change the register stack when
attempting to resume at the point of the trap.
Functions
A trap handler procedure must not be a function that returns a value.
Resuming from a trap
The following ways of resuming execution from a trap are supported:
Clear the overflow bit in the trap ENV variable and resume from a trap 2
(arithmetic overflow).
Resume after a loop timer interrupt (trap 4).
Jump to a restart point by changing the trap variables P, L, ENV, space ID,
and S. See Exiting to Another Destination earlier in this section.
Terminate the process.