#include <kern/ecc.h>
kern/ecc.h
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
| ECC_NONE | 0 | |
| ECC_IS_CORRECTABLE | 1 | |
| ECC_DB_CORRUPTED | 2 | |
| ECC_IS_TEST_ERROR | 4 | |
| ECC_DB_ONLY | 8 | |
| ECC_REMOVE_ADDR | 16 |
typedefecc_flags_t
typedef enum ecc_flags_t ecc_flags_t;
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.
| ecc_version_t | version | Version of this struct. |
| ecc_flags_t | flags | Flags describing the reported error. |
| uint64_t | physaddr | Physical address of failure |
| uint32_t | ce_count | Number of CEs reported at physaddr |
| uint32_t | vendor | Vendor ID |
| uint32_t[4] | reserved | Reserved 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.
typedefmcc_flags_t
typedef enum mcc_flags_t mcc_flags_t;
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.
| mcc_ecc_version_t | version | Version of this struct. |
| mcc_flags_t | flags | Flags used to describe the error. |
| uint32_t | status | Interrupt status at the time of the MCC error. |
| uint32_t | amcc | AMCC on which the error occurred. |
| uint32_t | plane | Plane of the AMCC on which the error occurred. |
| uint32_t | bank | MemCache error Bank of first one bit error. |
| uint32_t | way | MemCache error Way of first one bit error. |
| uint32_t | index | MemCache error Index of first one bit error. |
| uint32_t | bit_off_cl | Indicates whether the error is in upper half cache line or lower half cache line. |
| uint32_t | bit_off_within_hcl | MemCache 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
| uint8_t | id | ID of memory (e.g. L2C), platform-specific |
| uint8_t | count | Of uint64_t's used, starting at index 0 |
| uint64_t[8] | data | Event-specific data |