Guardian Procedure Calls Reference Manual

trapstack-addr
input
INT:value
is an address specifying the local data area for the application process' trap handler. The
trapstack-addr parameter also indicates where the trap number and stack marker at the
time of the trap are passed to the application process.
If trapstack-addr has a value < 0, then trap handling is disabled and any trap results in
the process being stopped with a process deletion (ABEND) message.
Functions
Use the ARMTRAP procedure to perform one of these functions:
Arm a trap handler (that is, specify a location in the application program where execution
begins if a trap occurs). To do this, set traphandlr-addr to a value greater than 1 specifying
the address of a label at which the trap handler starts and set trapstack-addr to a
nonnegative value specifying the stack address above which its activation record will go.
Set default handling (that is terminate, but enter the debugger if in a debug session). To do
this, set traphandlr-addr to 1 and set trapstack-addr to zero.
Set traps to enter the debugger. To do this, set traphandlr-addr to 1 and
trapstack-addr to a value greater than zero. By convention, both parameters are normally
set to 1 in such as call.
Disarm all trap handling (that is, specify that no part of the application program is to execute
if a trap occurs). To do this, set traphandlr-addr to a nonzero value and set
trapstack-addr to a negative value. By convention, both parameters are normally set to
-1 in such a call.
Resume the process and rearm the trap handler. This must be done by a call to ARMTRAP
from within a trap handler with traphandlr-addr set to zero (0) and trapstack-addr
set to a nonnegative value specifying the stack address above which its activation record will
go. For details, see Considerations (page 71).
Resume the process and disarm all trap handling. This must be done by a call to ARMTRAP
from within a trap handler with traphandlr-addr set to zero (0) and trapstack-addr
set to a negative value. For details, see Considerations (page 71).
Trap Handler Activation and Termination
When a trap handler has been armed and a trap subsequently occurs, control passes to the trap
handler at the location specified by traphandlr-addr in the same code segment as the original
call to ARMTRAP. Trap handling is automatically disabled. ‘S' and ‘L' are set to trapstack-addr
plus 6; the seven words starting at trapstack-addr are (relative to the new ‘L' setting):
Reserved'L'[-6]
Space ID at the time of the trap'L'[-5]
Trap number:
Invalid address reference0
Instruction failure1
Arithmetic overflow2
Stack overflow3
Process loop timer timeout4
Call from process with PIN > 2555
Memory manager read error11
70 Guardian Procedure Calls (A-B)