Share via


Hardware Exceptions

OverviewHow Do IFAQ

Most of the standard exceptions recognized by the operating system are hardware-defined exceptions. Windows 95 and Windows NT recognize a few low-level software exceptions, but these are usually best handled by the operating system.

Windows NT maps the hardware errors of different processors to the exception codes in this section. In some cases, a processor may generate only a subset of these exceptions. Windows NT preprocesses information about the exception and issues the appropriate exception code.

The hardware exceptions recognized by Windows NT are summarized in the following table:

Exception code Cause of exception
STATUS_ACCESS_VIOLATION Reading or writing to an inaccessible memory location.
STATUS_BREAKPOINT Encountering a hardware-defined breakpoint; used only by debuggers.
STATUS_DATATYPE_MISALIGNMENT Reading or writing to data at an address that is not properly aligned; for example, 16-bit entities must be aligned on 2-byte boundaries. (Not applicable to Intel 80x86 processors.)
STATUS_FLOATING_DIVIDE_BY_ZERO Dividing floating-point type by 0.0.
STATUS_FLOATING_OVERFLOW Exceeding maximum positive exponent of floating-point type.
STATUS_FLOATING_UNDERFLOW Exceeding magnitude of lowest negative exponent of floating-point type.
STATUS_FLOATING_RESEVERED_OPERAND Using a reserved floating-point format (invalid use of format).
STATUS_ILLEGAL_INSTRUCTION Attempting to execute an instruction code not defined by the processor.
STATUS_PRIVILEGED_INSTRUCTION Executing an instruction not allowed in current machine mode.
STATUS_INTEGER_DIVIDE_BY_ZERO Dividing an integer type by 0.
STATUS_INTEGER_OVERFLOW Attempting an operation that exceeds the range of the integer.
STATUS_SINGLE_STEP Executing one instruction in single-step mode; used only by debuggers.

Many of the exceptions listed in the previous table are intended to be handled by debuggers, the operating system, or other low-level code. With the exception of integer and floating-point errors, your code should not handle these errors. Thus, you should usually use the exception-handling filter to ignore exceptions (evaluate to 0). Otherwise, you may prevent lower-level mechanisms from responding appropriately. You can, however, take appropriate precautions against the potential effect of these low-level errors by writing termination handlers.