background image

15-28 Vol. 3B

MACHINE-CHECK ARCHITECTURE

Example 15-2.  Machine-Check Exception Handler Pseudocode

IF CPU supports MCE

THEN

IF CPU supports MCA

THEN

call errorlogging routine; (* returns restartability *)

FI;

ELSE (* Pentium(R) processor compatible *)

READ P5_MC_ADDR
READ P5_MC_TYPE;

report RESTARTABILITY to console;

FI;
IF error is not restartable

THEN

report RESTARTABILITY to console;
abort system;

FI;
CLEAR MCIP flag in IA32_MCG_STATUS;

15.10.2 Pentium

 

Processor Machine-Check Exception Handling

Machine-check exception handler on P6 family, Intel Atom and later processor families, should follow the guidelines 
described in Section 15.10.1 and Example 15-2 that check the processor’s support of MCA.

NOTE

On processors that support MCA (CPUID.1.EDX.MCA = 1) reading the P5_MC_TYPE and 
P5_MC_ADDR registers may produce invalid data.

When machine-check exceptions are enabled for the Pentium processor (MCE flag is set in control register CR4), 
the machine-check exception handler uses the RDMSR instruction to read the error type from the P5_MC_TYPE 
register and the machine check address from the P5_MC_ADDR register. The handler then normally reports these 
register values to the system console before aborting execution (see Example 15-2).

15.10.3  Logging Correctable Machine-Check Errors

The error handling routine for servicing the machine-check exceptions is responsible for logging uncorrected 
errors.
If a machine-check error is correctable, the processor does not generate a machine-check exception for it. To 
detect correctable machine-check errors, a utility program must be written that reads each of the machine-check 
error-reporting register banks and logs the results in an accounting file or data structure. This utility can be imple-
mented in either of the following ways.

A system daemon that polls the register banks on an infrequent basis, such as hourly or daily.

A user-initiated application that polls the register banks and records the exceptions. Here, the actual polling 
service is provided by an operating-system driver or through the system call interface.

An interrupt service routine servicing CMCI can read the MC banks and log the error. Please refer to Section 
15.10.4.2 fo
r guidelines on logging correctable machine checks.

Example 15-3 gives pseudocode for an error logging utility.