Hardware Exceptions
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Hardware Exceptions

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

Windows 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 preprocesses information about the exception and issues the appropriate exception code.

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

Exception code Cause of exception


Reading or writing to an inaccessible memory location.


Encountering a hardware-defined breakpoint; used only by debuggers.


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.)


Dividing floating-point type by 0.0.


Exceeding maximum positive exponent of floating-point type.


Exceeding magnitude of lowest negative exponent of floating-point type.


Using a reserved floating-point format (invalid use of format).


Attempting to execute an instruction code not defined by the processor.


Executing an instruction not allowed in current machine mode.


Dividing an integer type by 0.


Attempting an operation that exceeds the range of the integer.


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.

© 2015 Microsoft