HP 3000 Manuals

XARITRAP [ Trap Handling Programmer's Guide ] MPE/iX 5.0 Documentation


Trap Handling Programmer's Guide

XARITRAP 

Arms or disarms the user-written arithmetic trap handling procedure.
Although you can arm the trap for any desired combination of events, at
any given time there can be only one user-written trap handler armed for
all arithmetic traps.


NOTE By default, all traps except IEEE floating-point exceptions are enabled, and the system trap handler is armed. Many floating-point operations result in an inexact result. Consequently, most compiler libraries doing floating-point operations will result in an inexact trap if the IEEE Inexact Result trap is enabled. Therefore, you should enable the IEEE Inexact Result trap only if absolutely necessary.
Syntax The XARITRAP intrinsic is called as follows: XARITRAP(mask,plabel,oldmask; Parameters The XARITRAP intrinsic has four required parameters: mask 32-bit signed integer by value (required) A value determining which trap conditions, if enabled, invoke the user-written software trap handler, and which do not. plabel 32-bit signed integer by value (required) The address of your trap handling procedure. If the value is 0, the user-written arithmetic trap handler is disarmed. oldmask 32-bit signed integer by reference (required) Returns the value of the previous mask to your program. oldplabel 32-bit signed integer by reference (required) Returns the plabel of your process' previous arithmetic trap handler. If no plabel was previously configured, oldplabel returns 0 (indicating the MPE XL trap subsystem was in effect). If a mask bit is on (=1), the corresponding trap condition becomes armed. If a bit is off (=0), the corresponding trap condition is disarmed. The bits and their associated arithmetic errors are as follows: Bit Trap Condition --------------------------------------------------------------------------------------- (0:1) Assertion Trap. (1:6) Reserved for MPE XL. (7:1) 3000 Mode Packed Decimal Error (8:1) Paragraph Stack Overflow. (9:1) Unimplemented Condition Traps. (10:1) Software-detected Misaligned Result Of Pointer Arithmetic or Error In Conversion From Long Pointer To Short Pointer. (11:1) Software-detected NIL Pointer Reference. (12:1) Range Errors. (13:1) IEEE Floating Point, Invalid Operation. (14:1) IEEE Floating Point Divide By Zero. (15:1) IEEE Floating Point Overflow. (16:1) IEEE Floating Point Underflow. (17:1) IEEE Floating Point, Inexact Result. (18:1) Decimal Divide By Zero. (19:2) Reserved for MPE XL. (21:1) Invalid Decimal Digit. (22:1) Invalid ASCII Digit. (23:1) Decimal Overflow. (24:1) 3000 Mode Double Precision Divide By Zero. (25:1) 3000 Mode Double Precision Underflow. (26:1) 3000 Mode Double Precision Overflow. (27:1) Integer Overflow. (28:1) 3000 Mode Floating Point Overflow. (29:1) 3000 Mode Floating Point Underflow. (30:1) Integer Divide By Zero. (31:1) 3000 Mode Floating Point Divide By Zero.
NOTE The following apply to the preceding trap conditions represented in the mask: 1. Native Mode supports two floating-point formats: IEEE and 3000 Mode. Both execute in Native Mode, but 3000 Mode performs HP 3000 type manipulations. Since it is possible to use both formats during program execution, there are separate bits in the mask for arming/disarming traps of these formats. 2. Some of the error conditions specified here are not strictly arithmetic traps (for example, range errors, nil pointers, and paragraph stack overflow). However, they and many arithmetic traps are caught by reserved instructions that raise the conditional traps. For this reason, all are armed/disarmed by XARITRAP. 3. Some of the instructions that raise conditional traps are reserved to indicate some of the above trap conditions. A nonreserved instruction is one not generated by a compiler. If a nonreserved instruction causes a conditional trap, this is reported as an Unimplemented Condition Trap. This trap can be produced by incorrect patches, corrupt code, or invalid code sequences.
Condition Codes The XARITRAP intrinsic can return one of the following condition codes: CCE Request granted. The desired traps are now armed. CCG Request granted. All traps are now disarmed. CCL Not returned by this intrinsic.
CAUTION CCL is defined differently on MPE V/E systems.


MPE/iX 5.0 Documentation