background image

Vol. 3C 34-11

SYSTEM MANAGEMENT MODE

The IF flag in the EFLAGS register is cleared, which inhibits maskable hardware interrupts from being 
generated.

The TF flag in the EFLAGS register is cleared, which disables single-step traps.

Debug register DR7 is cleared, which disables breakpoint traps. (This action prevents a debugger from acciden-
tally breaking into an SMI handler if a debug breakpoint is set in normal address space that overlays code or 
data in SMRAM.)

NMI, SMI, and A20M interrupts are blocked by internal SMM logic. (See Section 34.8 for more information 
about how NMIs are handled in SMM.)

Software-invoked interrupts and exceptions can still occur, and maskable hardware interrupts can be enabled by 
setting the IF flag. Intel recommends that SMM code be written in so that it does not invoke software interrupts 
(with the INT n, INTO, INT 3, or BOUND instructions) or generate exceptions. 
If the SMI handler requires interrupt and exception handling, an SMM interrupt table and the necessary exception 
and interrupt handlers must be created and initialized from within SMM. Until the interrupt table is correctly initial-
ized (using the LIDT instruction), exceptions and software interrupts will result in unpredictable processor 
behavior. 
The following restrictions apply when designing SMM interrupt and exception-handling facilities:

The interrupt table should be located at linear address 0 and must contain real-address mode style interrupt 
vectors (4 bytes containing CS and IP).

Due to the real-address mode style of base address formation, an interrupt or exception cannot transfer control 
to a segment with a base address of more that 20 bits.

An interrupt or exception cannot transfer control to a segment offset of more than 16 bits (64 KBytes).

When an exception or interrupt occurs, only the 16 least-significant bits of the return address (EIP) are pushed 
onto the stack. If the offset of the interrupted procedure is greater than 64 KBytes, it is not possible for the 
interrupt/exception handler to return control to that procedure. (One solution to this problem is for a handler 
to adjust the return address on the stack.)

The SMBASE relocation feature affects the way the processor will return from an interrupt or exception 
generated while the SMI handler is executing. For example, if the SMBASE is relocated to above 1 MByte, but 
the exception handlers are below 1 MByte, a normal return to the SMI handler is not possible. One solution is 
to provide the exception handler with a mechanism for calculating a return address above 1 MByte from the 16-
bit return address on the stack, then use a 32-bit far call to return to the interrupted procedure.

If an SMI handler needs access to the debug trap facilities, it must insure that an SMM accessible debug handler 
is available and save the current contents of debug registers DR0 through DR3 (for later restoration). Debug 
registers DR0 through DR3 and DR7 must then be initialized with the appropriate values.

If an SMI handler needs access to the single-step mechanism, it must insure that an SMM accessible single-
step handler is available, and then set the TF flag in the EFLAGS register.

If the SMI design requires the processor to respond to maskable hardware interrupts or software-generated 
interrupts while in SMM, it must ensure that SMM accessible interrupt handlers are available and then set the 
IF flag in the EFLAGS register (using the STI instruction). Software interrupts are not blocked upon entry to 
SMM, so they do not need to be enabled.

34.7 

MANAGING SYNCHRONOUS AND ASYNCHRONOUS

SYSTEM MANAGEMENT INTERRUPTS

When coding for a multiprocessor system or a system with Intel HT Technology, it was not always possible for an 
SMI handler to distinguish between a synchronous SMI (triggered during an I/O instruction) and an asynchronous 
SMI. To facilitate the discrimination of these two events, incremental state information has been added to the SMM 
state save map. 
Processors that have an SMM revision ID of 30004H or higher have the incremental state information described 
below.