System Exceptions

OS/2 defines a class of error conditions called system exceptions, and specifies the default actions that are taken when these system exceptions occur. The default action taken by OS/2 in most cases is to terminate the thread that caused the system exception.

System exceptions include both synchronous and asynchronous exceptions. Synchronous exceptions are caused by events that are internal to the execution of a thread. For example, synchronous exceptions could be caused by invalid parameters, or by the request of a thread to end its own execution.

Asynchronous exceptions are caused by events that are external to the execution of a thread. For example, an asynchronous exception can be caused by a user entering a Ctrl+C or Ctrl+Break key sequence, or by a process calling DosKillProcess to end the execution of another process.

The Ctrl+Break, Ctrl+C, and DosKillProcess-generated exceptions are also known as signals, or as signal exceptions.

OS/2 delivers exceptions that occur in 16-bit as well as 32-bit code. The sequence or hierarchy for delivering exceptions is as follows:

Notification of an exception is usually sent only to the thread that caused the exception. However, if a thread uses DosExit to terminate all the threads in the process, notification of the process-termination exception is sent to every thread in the process. The thread that used DosExit gets a XCPT_PROCESS_TERMINATE exception, all the other threads in the process get a XCPT_ASYNC_PROCESS_TERMINATE exception.

Exit-list processing occurs on a per-process basis after a process-termination exception has been delivered to each thread in the process and each thread has finally ended except Thread 1 (the main thread). Therefore, any thread that handles a process-termination exception must eventually end its own execution voluntarily. Otherwise, the process-termination sequence will not conclude properly.

The following tables briefly list the possible exceptions. For more detailed information about the system exceptions, including default system action, parameters, and related trap numbers, see the Control Program Programming Reference.

Non-Fatal, Software-Generated Exceptions

┌──────────────────────────────────────┬──────────────────────┐│Exception Symbolic Constant           │Description           │
├──────────────────────────────────────┼──────────────────────┤
│XCPT_GUARD_PAGE_VIOLATION             │A guard page has been │
│                                      │accessed.             │
├──────────────────────────────────────┼──────────────────────┤
│XCPT_UNABLE_TO_GROW_STACK             │The system is unable  │
│                                      │to allocate the memory│
│                                      │page directly below   │
│                                      │the guard page just   │
│                                      │accessed.             │
└──────────────────────────────────────┴──────────────────────┘

Fatal, Software-Generated Exceptions

┌──────────────────────────────────────┬──────────────────────┐
│Exception Symbolic Constant           │Description           │
├──────────────────────────────────────┼──────────────────────┤
│XCPT_IN_PAGE_ERROR                    │An I/O error occurred │
│                                      │while reading a memory│
│                                      │page into memory.     │
├──────────────────────────────────────┼──────────────────────┤
│XCPT_PROCESS_TERMINATE                │The thread has        │
│                                      │terminated itself with│
│                                      │DosExit.              │
├──────────────────────────────────────┼──────────────────────┤
│XCPT_ASYNC_PROCESS_TERMINATE          │Another thread in the │
│                                      │process has caused the│
│                                      │thread to terminate.  │
├──────────────────────────────────────┼──────────────────────┤
│XCPT_NONCONTINUABLE_EXCEPTION         │An exception handler  │
│                                      │has attempted to      │
│                                      │continue execution in │
│                                      │response to a         │
│                                      │non-continuable       │
│                                      │exception.            │
├──────────────────────────────────────┼──────────────────────┤
│XCPT_INVALID_DISPOSITION              │An exception handler  │
│                                      │has returned an       │
│                                      │invalid value.        │
└──────────────────────────────────────┴──────────────────────┘

Fatal, Hardware-Generated Exceptions

┌──────────────────────────────────────┬──────────────────────┐
│Exception Symbolic Constant           │Description           │
├──────────────────────────────────────┼──────────────────────┤
│XCPT_ACCESS_VIOLATION                 │An access violation or│
│                                      │page fault has        │
│                                      │occurred.             │
├──────────────────────────────────────┼──────────────────────┤
│XCPT_INTEGER_DIVIDE_BY_ZERO           │An attempt to divide  │
│                                      │by 0 has occurred in  │
│                                      │an integer operation. │
├──────────────────────────────────────┼──────────────────────┤
│XCPT_FLOAT_DIVIDE_BY_ZERO             │An attempt to divide  │
│                                      │by 0 has occurred in a│
│                                      │floating point        │
│                                      │operation.            │
├──────────────────────────────────────┼──────────────────────┤
│XCPT_FLOAT_INVALID_OPERATION          │An invalid floating   │
│                                      │point operation was   │
│                                      │attempted.            │
├──────────────────────────────────────┼──────────────────────┤
│XCPT_ILLEGAL_INSTRUCTION              │An attempt was made to│
│                                      │execute an instruction│
│                                      │that is not defined on│
│                                      │the host machine's    │
│                                      │architecture.         │
├──────────────────────────────────────┼──────────────────────┤
│XCPT_PRIVILEGED_INSTRUCTION           │An attempt was made to│
│                                      │execute an instruction│
│                                      │that is not permitted │
│                                      │in the current machine│
│                                      │mode or that the      │
│                                      │application does not  │
│                                      │have permission to    │
│                                      │execute.              │
├──────────────────────────────────────┼──────────────────────┤
│XCPT_INTEGER_OVERFLOW                 │An integer operation  │
│                                      │generated a carry-out │
│                                      │of the most           │
│                                      │significant bit.      │
├──────────────────────────────────────┼──────────────────────┤
│XCPT_FLOAT_OVERFLOW                   │A floating point      │
│                                      │operation generated a │
│                                      │resulting exponent    │
│                                      │that is greater than  │
│                                      │the magnitude         │
│                                      │permitted for the     │
│                                      │operands.             │
├──────────────────────────────────────┼──────────────────────┤
│XCPT_FLOAT_UNDERFLOW                  │A floating point      │
│                                      │operation generated a │
│                                      │resulting exponent    │
│                                      │that is less than the │
│                                      │magnitude provided for│
│                                      │the operands.         │
├──────────────────────────────────────┼──────────────────────┤
│XCPT_FLOAT_DENORMAL_OPERAND           │An attempt was made to│
│                                      │perform an arithmetic │
│                                      │operation on a        │
│                                      │denormal operand.     │
├──────────────────────────────────────┼──────────────────────┤
│XCPT_FLOAT_INEXACT_RESULT             │The result of an      │
│                                      │operation is not      │
│                                      │exactly representable │
│                                      │in the target format. │
├──────────────────────────────────────┼──────────────────────┤
│XCPT_FLOAT_STACK_CHECK                │An illegal stack      │
│                                      │operation was         │
│                                      │attempted by the      │
│                                      │floating point        │
│                                      │coprocessor.          │
├──────────────────────────────────────┼──────────────────────┤
│XCPT_DATATYPE_MISALIGNMENT            │An attempt was made to│
│                                      │store a data in an    │
│                                      │address that is not   │
│                                      │naturally aligned on a│
│                                      │hardware architecture │
│                                      │that does not provide │
│                                      │alignment hardware.   │
├──────────────────────────────────────┼──────────────────────┤
│XCPT_BREAKPOINT                       │A breakpoint          │
│                                      │instruction was       │
│                                      │executed.             │
├──────────────────────────────────────┼──────────────────────┤
│XCPT_SINGLE_STEP                      │One instruction has   │
│                                      │been executed in      │
│                                      │single-step mode.     │
└──────────────────────────────────────┴──────────────────────┘

Fatal Exceptions

┌──────────────────────────────────────┬──────────────────────┐
│Exception Symbolic Constant           │Description           │
├──────────────────────────────────────┼──────────────────────┤
│XCPT_INVALID_LOCK_SEQUENCE            │An invalid operation  │
│                                      │was attempted within  │
│                                      │an interlocked section│
│                                      │of code.              │
├──────────────────────────────────────┼──────────────────────┤
│XCPT_ARRAY_BOUNDS_EXCEEDED            │An array index outside│
│                                      │its upper and lower   │
│                                      │boundary was detected.│
└──────────────────────────────────────┴──────────────────────┘

Unwind Operation Exceptions

┌──────────────────────────────────────┬────────────────────────────┐
│Exception Symbolic Constant           │Description                 │
├──────────────────────────────────────┼────────────────────────────┤
│XCPT_UNWIND                           │An unwind operation is in   │
│                                      │process.                    │
├──────────────────────────────────────┼────────────────────────────┤
│XCPT_BAD_STACK                        │An                          │
│                                      │EXCEPTIONREGISTRATIONRECORD │
│                                      │data structure was reached  │
│                                      │that is not properly aligned│
│                                      │or that is not within the   │
│                                      │current stack boundaries.   │
├──────────────────────────────────────┼────────────────────────────┤
│XCPT_INVALID_UNWIND_TARGET            │The address of the target   │
│                                      │EXCEPTIONREGISTRATIONRECORD │
│                                      │is below the current stack  │
│                                      │pointer or not in the       │
│                                      │exception handler chain.    │
└──────────────────────────────────────┴────────────────────────────┘

Fatal Signal Exceptions

┌──────────────────────────────────────┬──────────────────────┐
│Exception Symbolic Constant           │Description           │
├──────────────────────────────────────┼──────────────────────┤
│XCPT_SIGNAL                           │A signal was made to  │
│                                      │your process (usually │
│                                      │to stop). All the     │
│                                      │signal exceptions     │
│                                      │(Ctrl+Break, Ctrl+C,  │
│                                      │and                   │
│                                      │XCPT_SIGNAL_KILLPROC) │
│                                      │come under this       │
│                                      │exception.            │
└──────────────────────────────────────┴──────────────────────┘


[Back: About Exception Management]
[Next: Signal Exceptions]