[OpenVMS documentation]
[Site home] [Send comments] [Help with this site] [How to order documentation] [OpenVMS site] [Compaq site]
Updated: 11 December 1998

OpenVMS Programming Concepts Manual


Previous Contents Index

15.3 Exception Conditions

Exceptions can be generated by any of the following:

Hardware-generated exceptions always result in conditions that require special action if program execution is to continue.

Software-generated exceptions may result in error or warning conditions. These conditions and their message descriptions are documented in the online Help Message utility and in the OpenVMS system messages documentation. To access online message descriptions, use the HELP/MESSAGE command.

More information on using the Help Message utility is available in OpenVMS System Messages: Companion Guide for Help Message Users. That document describes only those messages that occur when the system is not fully operational and you cannot access Help Message.

Some examples of exception conditions are as follows:

There are two standard methods for a Compaq- or user-written routine to indicate that an exception condition has occurred:

15.3.1 System Service Exception Conditions

System service failure exceptions occur when an error or severe error status is returned from a call to a system service. You can choose to handle error returns from system services by using the condition-handling mechanism rather than other error-checking methods. If you want to handle exceptions generated by service failures, you must enable system service failure exception mode with the Set System Service Failure Mode (SYS$SETSFM) system service. For example:


$SETSFM_S ENBFLG=#1 

System service failure exception mode is initially disabled, and it can be enabled or disabled at any time during the execution of an image.

15.3.1.1 Conditions Caused by Exceptions

Table 15-1 summarizes common conditions caused by exceptions. The condition names are listed in the first column. The second column explains each condition more fully by giving information about the type, meaning, and arguments relating to the condition. The condition type is either trap or fault. For more information about traps and faults, refer to the VAX Architecture Reference Manual and Alpha Architecture Reference Manual. The meaning of the exception condition is a short description of each condition. The arguments for the condition handler are listed where applicable; they give specific information about the condition.

Table 15-1 Summary of Exception Conditions
Condition Name Explanation  
SS$_ACCVIO Type: Fault.
  Description Acess Violation.
  Arguments:
  1. Reason for access violation. This is a mask with the following format:
    • Bit <0> = type of access violation
      • 0 = page table entry protection code did not permit intended access
      • + 1 = P0LR, P1LR, or SLR length violation

    • Bit <1> = page table entry reference
      • 0 = specified virtual address not accessible
      • 1 = associated page table entry not accessible

    • Bit <2> = intended access
      • 0 = read
      • 1 = modify
    • §Bit <16> = indicates fault on the pre-fetch of the instruction
      • 0 = successful execution
      • 1 = fault on fetch

    • §Bit <17> =indicates whether instruction is marked as no execute
      • 0 = not market
      • 1 = indicates instruction is marked as a fault on execute in its page table entry
  2. Virtual address to which access was attempted or, on some processors, virtual address within the page to which access was attempted.
+SS$_ARTRES Type:

Description:

Arguments:

Trap.

Reserved arithmetic trap.

None.

SS$_ASTFLT Type: Trap.
  Description: Stack invalid during attempt to deliver an AST.
  Arguments:
  1. Stack pointer value when fault occurred.
  2. AST parameter of failed AST.
  3. Program counter (PC) at AST delivery interrupt.
  4. Processor status longword (PSL) for VAX or processor status (PS) for Alpha at AST delivery interrupt. 1 For PS, it is the low-order 32 bits.
  5. Program counter (PC) to which AST would have been delivered. 1
  6. Processor status longword (PSL) for VAX or processor status (PS) for Alpha to which AST would have been delivered. 1 For PS, it is the low-order 32 bits.
SS$_BREAK Type:

Description:

Arguments:

Fault.

Breakpoint instruction encountered.

None.

SS$_CMODSUPR Type:

Description:

Arguments:

Trap.

Change mode to supervisor instruction encountered. 2

Change mode code. The possible values are --32,768 through 32,767.

SS$_CMODUSER Type:

Description:

Arguments:

Trap.

Change mode to user instruction encountered. 2

Change mode code. The possible values are --32,768 through 32,767.

+SS$_COMPAT Type: Fault.
  Description: Compatibility-mode exception. This exception condition can occur only when executing in compatibility mode. 3
  Arguments: Type of compatibility exception. The possible values are as follows:

0 = Reserved instruction execution

1 = BPT instruction executed

2 = IOT instruction executed

3 = EMT instruction executed

4 = TRAP instruction executed

5 = Illegal instruction executed

6 = Odd address fault

7 = TBIT trap.

+++SS$_DECOVF Type:

Description:

Arguments:

Trap.

Decimal overflow.

None.

+++SS$_FLTDIV Type:

Description:

Arguments:

Trap.

Floating/decimal divide-by-zero.

None.

+SS$_FLTDIV_F Type:

Description:

Arguments:

Fault.

Floating divide-by-zero.

None.

+++SS$_FLTOVF Type:

Description:

Arguments:

Trap.

Floating-point overflow.

None.

+SS$_FLTOVF_F Type:

Description:

Arguments:

Fault.

Floating-point overflow fault.

None.

+++SS$_FLTUND Type:

Description:

Arguments:

Trap.

Floating-point underflow.

None.

+SS$_FLTUND_F Type:

Description:

Arguments:

Fault.

Floating-point underflow fault.

None.

+++SS$_INTDIV Type:

Description:

Arguments:

Trap.

Integer divide-by-zero.

None.

+++SS$_INTOVF Type:

Description:

Arguments:

Trap.

Integer overflow.

None.

+SS$_OPCCUS Type:

Description:

Arguments:

Fault.

Opcode reserved for customer fault.

None.

SS$_OPCDEC Type:

Description:

Arguments:

Fault.

Opcode reserved for Digital fault.

None.

SS$_PAGRDERR Type: Fault.
  Description: Read error occurred during an attempt to read a faulted page from disk.
  Arguments:
  1. Translation not valid reason. This is a mask with the following format:
    • Bit <0> = 0
    • Bit <1> = page table entry reference
      • 0 = specified virtual address not valid
      • 1 = associated page table entry not valid

    • Bit <2> = intended access
      • 0 = read
      • 1 = modify
  2. Virtual address of referenced page.
+SS$_RADRMOD Type:

Description:

Arguments:

Fault.

Attempt to use a reserved addressing mode.

None.

SS$_ROPRAND Type:

Description:

Arguments:

Fault.

Attempt to use a reserved operand.

None.

SS$_SSFAIL Type:

Description:

Arguments:

Fault.

System service failure (when system service failure exception mode is enabled).

Status return from system service (R0). (The same value is in R0 of the mechanism array.)

+++SS$_SUBRNG Type:

Description:

Arguments:

Trap.

Subscript range trap.

None.

+SS$_TBIT Type:

Description:

Arguments:

Fault.

Trace bit is pending following an instruction.

None.


+On VAX systems, this condition is generated by hardware.
++On Alpha systems, this condition is generated by software.
§Alpha systems only
1The PC and PSL (or PS) normally included in the signal array are not included in this argument list. The stack pointer of the access mode receiving this exception is reset to its initial value.
2If a change mode handler has been declared for user or supervisor mode with the Declare Change Mode or Compatibility Mode Handler (SYS$DCLCMH) system service, that routine receives control when the associated trap occurs.
3If a compatibility-mode handler has been declared with the Declare Change Mode or Compatibility Mode Handler (SYS$DCLCMH) system service, that routine receives control when this fault occurs.

Change-Mode and Compatibility-Mode Handlers

Two types of hardware exception can be handled in a way different from the normal condition-handling mechanism described in this chapter. The two types of hardware exception are as follows:

You can use the Declare Change Mode or Compatibility Mode Handler (SYS$DCLCMH) system service to establish procedures to receive control when one of these conditions occurs. The SYS$DCLCMH system service is described in the OpenVMS System Services Reference Manual.

15.3.2 Exception Conditions

On Alpha systems, the condition values that your condition-handling routine expects to receive on VAX systems may no longer be meaningful, even though the format of the 32-bit condition value and its location in the signal array are the same as they are on VAX systems. Because of architectural differences, some exception conditions that are returned on VAX systems are not supported on Alpha systems.

On Alpha systems, because hardware exceptions are more architecture specific than software exceptions, only a subset of the hardware exceptions supported on VAX systems are also supported on Alpha systems. In addition, the Alpha architecture defines several additional exceptions that are not supported on VAX systems.

Table 15-2 lists the Alpha exceptions that are not supported on VAX systems and VAX hardware exceptions that are not supported on Alpha systems. For some arithmetic exceptions, Alpha software produces VAX compatible exceptions which are not supported by the hardware itself. See Section 15.3.3 for a discussion of SS$_HPARITH, a generic Alpha exception condition which software may replace with specific VAX exceptions.

Table 15-2 Architecture-Specific Hardware Exceptions
Exception Condition Code Comment
New Alpha Exceptions
SS$_HPARITH--High-performance arithmetic exception Generated for most Alpha arithmetic exceptions (see Section 15.3.3)
SS$_ALIGN--Data alignment trap No VAX equivalent
VAX Specific Hardware Exceptions
SS$_ARTRES--Reserved arithmetic trap No Alpha system equivalent
SS$_COMPAT--Compatibility fault No Alpha system equivalent
++SS$_DECOVF--Decimal overflow Replaced by SS$_HPARITH
(see Section 15.3.3)
++SS$_FLTDIV--Float divide-by-zero (trap) Replaced by SS$_HPARITH
(see Section 15.3.3)
SS$_FLTDIV_F--Float divide-by-zero (fault) Replaced by SS$_HPARITH (see Section 15.3.3)
++SS$_FLTOVF--Float overflow (trap) Replaced by SS$_HPARITH
(see Section 15.3.3)
SS$_FLTOVF_F--Float overflow (fault) Replaced by SS$_HPARITH (see Section 15.3.3)
++SS$_FLTUND--Float underflow (trap) Replaced by SS$_HPARITH
(see Section 15.3.3)
SS$_FLTUND_F--Float underflow (fault) Replaced by SS$_HPARITH
(see Section 15.3.3)
++SS$_INTDIV--Integer divide-by-zero Replaced by SS$_HPARITH
(see Section 15.3.3)
++SS$_INTOVF--Integer overflow Replaced by SS$_HPARITH
(see Section 15.3.3)
SS$_TBIT--Trace pending No Alpha system equivalent
SS$_OPCCUS--Opcode reserved to customer No Alpha system equivalent
SS$_RADMOD--Reserved addressing mode No Alpha system equivalent
SS$_SUBRNG--INDEX subscript range check No Alpha system equivalent


++On Alpha systems, this condition may be generated by software.

15.3.3 Arithmetic Exceptions

On VAX systems, the architecture ensures that arithmetic exceptions are reported synchronously; that is, a VAX arithmetic instruction that causes an exception (such as an overflow) enters any exception handlers immediately, and subsequent instructions are not executed. The program counter (PC) reported to the exception handler is that of the failing arithmetic instruction. This allows application programs, for example, to resume the main sequence, with the failing operation being emulated or replaced by some equivalent or alternative set of operations.

On Alpha systems, arithmetic exceptions are reported asynchronously; that is, implementations of the architecture can allow a number of instructions (including branches and jumps) to execute beyond that which caused the exception. These instructions may overwrite the original operands used by the failing instruction, thus causing the loss of information that is integral to interpreting or rectifying the exception. The program counter (PC) reported to the exception handler is not that of the failing instruction, but rather is that of some subsequent instruction. When the exception is reported to an application's exception handler, it may be impossible for the handler to fix up the input data and restart the instruction.

Because of this fundamental difference in arithmetic exception reporting, Alpha systems define a new condition code, SS$_HPARITH, to indicate most arithmetic exceptions. Thus, if your application contains a condition-handling routine that performs processing when an integer overflow exception occurs, on VAX systems the application expects to receive the SS$_INTOVF condition code. On Alpha systems, this exception may be indicated by the condition code SS$_HPARITH. It is possible, however, that some higher level languages using RTL routines, for example, LIB$ routines, might convert the SS$_HPARITH into a more precise exception code such as SS$_INTOVF, or generate a precise exception code directly in an arthmetic emulation routine. If a SS$_HPARITH is received as the condition code, it indicates an imprecise Alpha system exception. If a precise integer overflow is received, SS$_INTOVF, it indicates either a VAX system condition or a precise Alpha system condition.

Figure 15-1 shows the format of the SS$_HPARITH exception signal array.

Figure 15-1 SS$_HPARITH Exception Signal Array


This signal array contains three arguments that are specific to the SS$_HPARITH exception: the integer register write mask, floating register write mask, and exception summary arguments of the exception pc and exception ps. The integer register write mask and floating register write mask arguments indicate the registers that were targets of instructions that set bits in the exception summary argument. Each bit in the mask represents a register. The exception summary argument indicates the type of exceptions that are being signaled by setting flags in the first 7 bits. Table 15-3 lists the meaning of each of these bits when set.

Table 15-3 Exception Summary Argument Fields
Bit Meaning When Set
0 Software completion.
1 Invalid floating arithmetic, conversion, or comparison operation.
2 Invalid attempt to perform a floating divide operation with a divisor of zero. Note that integer divide-by-zero is not reported.
3 Floating arithmetic or conversion operation overflowed the destination exponent.
4 Floating arithmetic or conversion operation underflowed the destination exponent.
5 Floating arithmetic or conversion operation gave a result that differed from the mathematically exact result.
6 Integer arithmetic or conversion operation from floating point to integer overflowed the destination precision.

For more information and recommendations about using arithmetic exceptions on Alpha systems, see Migrating to an OpenVMS AXP System: Recompiling and Relinking Applications.


Previous Next Contents Index

[Site home] [Send comments] [Help with this site] [How to order documentation] [OpenVMS site] [Compaq site]
[OpenVMS documentation]

Copyright © Compaq Computer Corporation 1998. All rights reserved.

Legal
5841PRO_039.HTML