#include <kern/ecc.h>

kern/ecc.h Kernel.framework

includes: Kernel/mach/kern_return.h, mach/vm_types.h, Kernel/stddef.h, sys/cdefs.h
7 typedefs · 4 macros · 4 enums · 3 structs · 1 function

macroECC_TESTING

#define ECC_TESTING (DEVELOPMENT || DEBUG)

macroVM_ECC_PAGE_POISON_GRANULE_SHIFT

#define VM_ECC_PAGE_POISON_GRANULE_SHIFT (7)

macroVM_ECC_PAGE_POISON_GRANULE

#define VM_ECC_PAGE_POISON_GRANULE (1 << VM_ECC_PAGE_POISON_GRANULE_SHIFT)

enumecc_flags_t

Flags to describe ECC memory errors
underlying type uint32_t
ECC_NONE0
ECC_IS_CORRECTABLE1
ECC_DB_CORRUPTED2
ECC_IS_TEST_ERROR4
ECC_DB_ONLY8
ECC_REMOVE_ADDR16

typedefecc_flags_t

typedef enum ecc_flags_t ecc_flags_t;

enumecc_version_t

ECC versions.
underlying type uint32_t
ECC_V10
ECC_NUM_VERSIONS1

typedefecc_version_t

typedef enum ecc_version_t ecc_version_t;

structecc_event_t

ECC event descriptor. @note If a new ECC version has been added (e.g. future hardware must log new or different data) new fields should be appended to this struct to represent the new data. No fields should be deleted from this struct unless the field corresponds only to hardware that has been deprecated.
size 40, align 8
ecc_version_tversionVersion of this struct.
ecc_flags_tflagsFlags describing the reported error.
uint64_tphysaddrPhysical address of failure
uint32_tce_countNumber of CEs reported at physaddr
uint32_tvendorVendor ID
uint32_t[4]reservedReserved for future extension to report row, column, bank, etc.

typedefecc_event_t

typedef struct ecc_event_t ecc_event_t;

typedefplatform_error_handler_ecc_poll_t

platform_error_handler_ecc_poll_t is the type of callback registered by the platform error handler that xnu can use to poll for ECC data.
typedef int (*platform_error_handler_ecc_poll_t)(uint64_t *addrs, uint32_t *error_count)

functionkern_ecc_poll_register

kern_return_t kern_ecc_poll_register(
	platform_error_handler_ecc_poll_t poll_func,
	uint32_t max_errors
)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/ecc_logging.c
Registers a platform error handler callback that the kernel can use to poll for ECC memory errors; max_errors bounds the number of errors reported per poll. In this kernel the routine is a stub: the arguments are ignored and KERN_NOT_SUPPORTED is returned.

enummcc_flags_t

Flags to describe MCC memory errors
underlying type uint32_t
MCC_NONE0
MCC_IS_SINGLE_BIT1
MCC_IS_MULTI_BIT2

typedefmcc_flags_t

typedef enum mcc_flags_t mcc_flags_t;

enummcc_ecc_version_t

MCC ECC versions.
underlying type unsigned int
MCC_ECC_V10
MCC_ECC_NUM_VERSIONS1Metadata

typedefmcc_ecc_version_t

typedef enum mcc_ecc_version_t mcc_ecc_version_t;

structmcc_ecc_event_t

MCC ECC event descriptor. @note If a new MCC ECC version has been added, because i.e. future hardware must log new or different data, new fields should be appended to this struct to represent the new data. No fields should be deleted from this struct unless the field corresponds only to hardware that has been deprecated.
size 40, align 4
mcc_ecc_version_tversionVersion of this struct.
mcc_flags_tflagsFlags used to describe the error.
uint32_tstatusInterrupt status at the time of the MCC error.
uint32_tamccAMCC on which the error occurred.
uint32_tplanePlane of the AMCC on which the error occurred.
uint32_tbankMemCache error Bank of first one bit error.
uint32_twayMemCache error Way of first one bit error.
uint32_tindexMemCache error Index of first one bit error.
uint32_tbit_off_clIndicates whether the error is in upper half cache line or lower half cache line.
uint32_tbit_off_within_hclMemCache one bit error bit offset of first one bit error with in half cache line.

typedefmcc_ecc_event_t

typedef struct mcc_ecc_event_t mcc_ecc_event_t;

macroECC_EVENT_INFO_DATA_ENTRIES

#define ECC_EVENT_INFO_DATA_ENTRIES 8

structecc_event

size 72, align 8
uint8_tidID of memory (e.g. L2C), platform-specific
uint8_tcountOf uint64_t's used, starting at index 0
uint64_t[8]dataEvent-specific data