5 interrupt stack table – Intel IA-32 User Manual

Page 201

Advertising
background image

Vol. 3A 5-25

INTERRUPT AND EXCEPTION HANDLING

In summary, a stack switch in IA-32e mode works like the legacy stack switch, except that a new
SS selector is not loaded from the TSS. Instead, the new SS is forced to NULL.

5.14.5

Interrupt Stack Table

In IA-32e mode, a new interrupt stack table (IST) mechanism is available as an alternative to
the modified legacy stack-switching mechanism described above. This mechanism uncondition-
ally switches stacks when it is enabled. It can be enabled on an individual interrupt-vector basis
using a field in the IDT entry. This means that some interrupt vectors can use the modified
legacy mechanism and others can use the IST mechanism.

The IST mechanism is only available in IA-32e mode. It is part of the 64-bit mode TSS. The
motivation for the IST mechanism is to provide a method for specific interrupts (such as NMI,
double-fault, and machine-check) to always execute on a known good stack. In legacy mode,
interrupts can use the task-switch mechanism to set up a known-good stack by accessing the
interrupt service routine through a task gate located in the IDT. However, the legacy task-switch
mechanism is not supported in IA-32e mode.

Figure 5-8. IA-32e Mode Stack Usage After Privilege Level Change

CS

Error Code

EFLAGS

EIP

SS

ESP

Stack Usage with

Privilege-Level Change

Handler’s Stack

Stack Pointer After

Transfer to Handler

CS

Error Code

EFLAGS

EIP

SS

ESP

Handler’s Stack

Legacy Mode

IA-32e Mode

0

+4

+8

+12

+16

+20

0

+8

+16

+24

+32

+40

Advertising