15-42 Vol. 3
MACHINE-CHECK ARCHITECTURE
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 implemented 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.
Example 15-3 gives pseudocode for an error logging utility.
Example 15-3. Machine-Check Error Logging Pseudocode
Assume that execution is restartable;
IF the processor supports MCA
THEN
FOR each bank of machine-check registers
DO
READ IA32_MCi_STATUS;
IF VAL flag in IA32_MCi_STATUS = 1
THEN
IF ADDRV flag in IA32_MCi_STATUS = 1
THEN READ IA32_MCi_ADDR;
FI;
IF MISCV flag in IA32_MCi_STATUS = 1
THEN READ IA32_MCi_MISC;
FI;
IF MCIP flag in IA32_MCG_STATUS = 1
(* Machine-check exception is in progress *)