background image

6-14 Vol. 1

PROCEDURE CALLS, INTERRUPTS, AND EXCEPTIONS

6.4.5 

Handling Floating-Point Exceptions

When operating on individual or packed floating-point values, the IA-32 architecture supports a set of six floating-
point exceptions. These exceptions can be generated during operations performed by the x87 FPU instructions or 
by SSE/SSE2/SSE3 instructions. When an x87 FPU instruction (including the FISTTP instruction in SSE3) generates 
one or more of these exceptions, it in turn generates floating-point error exception (#MF); when an 
SSE/SSE2/SSE3 instruction generates a floating-point exception, it in turn generates SIMD floating-point excep-
tion (#XM). 
See the following sections for further descriptions of the floating-point exceptions, how they are generated, and 
how they are handled:

Section 4.9.1, “Floating-Point Exception Conditions,” and Section 4.9.3, “Typical Actions of a Floating-Point 
Exception Handler”

Section 8.4, “x87 FPU Floating-Point Exception Handling,” and Section 8.5, “x87 FPU Floating-Point Exception 
Conditions”

Section 11.5.1, “SIMD Floating-Point Exceptions”

Interrupt Behavior

6.4.6 

Interrupt and Exception Behavior in 64-Bit Mode

64-bit extensions expand the legacy IA-32 interrupt-processing and exception-processing mechanism to allow 
support for 64-bit operating systems and applications. Changes include:

All interrupt handlers pointed to by the IDT are 64-bit code (does not apply to the SMI handler).

The size of interrupt-stack pushes is fixed at 64 bits. The processor uses 8-byte, zero extended stores.

The stack pointer (SS:RSP) is pushed unconditionally on interrupts. In legacy environments, this push is 
conditional and based on a change in current privilege level (CPL).

The new SS is set to NULL if there is a change in CPL.

IRET behavior changes.

There is a new interrupt stack-switch mechanism.

The alignment of interrupt stack frame is different.

6.5 

PROCEDURE CALLS FOR BLOCK-STRUCTURED LANGUAGES

The IA-32 architecture supports an alternate method of performing procedure calls with the ENTER (enter proce-
dure) and LEAVE (leave procedure) instructions. These instructions automatically create and release, respectively, 
stack frames for called procedures. The stack frames have predefined spaces for local variables and the necessary 
pointers to allow coherent returns from called procedures. They also allow scope rules to be implemented so that 
procedures can access their own local variables and some number of other variables located in other stack frames.
ENTER and LEAVE offer two benefits:

They provide machine-language support for implementing block-structured languages, such as C and Pascal. 

They simplify procedure entry and exit in compiler-generated code.

6.5.1 ENTER 

Instruction

The ENTER instruction creates a stack frame compatible with the scope rules typically used in block-structured 
languages. In block-structured languages, the scope of a procedure is the set of variables to which it has access. 
The rules for scope vary among languages. They may be based on the nesting of procedures, the division of the 
program into separately compiled files, or some other modularization scheme.
ENTER has two operands. The first specifies the number of bytes to be reserved on the stack for dynamic storage 
for the procedure being called. Dynamic storage is the memory allocated for variables created when the procedure 
is called, also known as automatic variables. The second parameter is the lexical nesting level (from 0 to 31) of the