Intel 64 and IA-32 Architectures Software Developers Manual Volume 3A, System Programming Guide, Part 1
14-24 Vol. 3A
MACHINE-CHECK ARCHITECTURE
• 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.
Example 14-3 gives pseudocode for an error logging utility.
Example 14-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 *)
AND PCC flag in IA32_MCi_STATUS = 1
AND RIPV flag in IA32_MCG_STATUS = 0
(* execution is not restartable *)
THEN
RESTARTABILITY = FALSE;
return RESTARTABILITY to calling procedure;
FI;
Save time-stamp counter and processor ID;
Set IA32_MCi_STATUS to all 0s;
Execute serializing instruction (i.e., CPUID);
FI;
OD;
FI;
If the processor supports the machine-check architecture, the utility reads through
the banks of error-reporting registers looking for valid register entries. It then saves
the values of the IA32_MCi_STATUS, IA32_MCi_ADDR, IA32_MCi_MISC and
IA32_MCG_STATUS registers for each bank that is valid. The routine minimizes
processing time by recording the raw data into a system data structure or file,
reducing the overhead associated with polling. User utilities analyze the collected
data in an off-line environment.