Intel 64 and IA-32 Architectures Software Developers Manual Volume 1, Basic Architecture
Vol. 1 D-1
APPENDIX D
GUIDELINES FOR WRITING X87 FPU
EXCEPTION HANDLERS
As described in Chapter 8, “Programming with the x87 FPU,” the IA-32 Architecture
supports two mechanisms for accessing exception handlers to handle unmasked x87
FPU exceptions: native mode and MS-DOS compatibility mode. The primary purpose
of this appendix is to provide detailed information to help software engineers design
and write x87 FPU exception-handling facilities to run on PC systems that use the
MS-DOS compatibility mode
1
for handling x87 FPU exceptions. Some of the informa-
tion in this appendix will also be of interest to engineers who are writing native-mode
x87 FPU exception handlers. The information provided is as follows:
• Discussion of the origin of the MS-DOS x87 FPU exception handling mechanism
and its relationship to the x87 FPU’s native exception handling mechanism.
• Description of the IA-32 flags and processor pins that control the MS-DOS x87
FPU exception handling mechanism.
• Description of the external hardware typically required to support MS-DOS
exception handling mechanism.
• Description of the x87 FPU’s exception handling mechanism and the typical
protocol for x87 FPU exception handlers.
• Code examples that demonstrate various levels of x87 FPU exception handlers.
• Discussion of x87 FPU considerations in multitasking environments.
• Discussion of native mode x87 FPU exception handling.
The information given is oriented toward the most recent generations of IA-32
processors, starting with the Intel486. It is intended to augment the reference infor-
mation given in Chapter 8, “Programming with the x87 FPU.”
A more extensive version of this appendix is available in the application note AP-578,
Software and Hardware Considerations for x87 FPU Exception Handlers for Intel
Architecture Processors (Order Number 243291), which is available from Intel.
1. Microsoft Windows* 95 and Windows 3.1 (and earlier versions) operating systems use almost
the same x87 FPU exception handling interface as MS-DOS. The recommendations in this appen-
dix for a MS-DOS compatible exception handler thus apply to all three operating systems.