1*e7776783SApple OSS Distributions /* 2*e7776783SApple OSS Distributions * Copyright (c) 2000-2020 Apple Inc. All rights reserved. 3*e7776783SApple OSS Distributions * 4*e7776783SApple OSS Distributions * @Apple_LICENSE_HEADER_START@ 5*e7776783SApple OSS Distributions * 6*e7776783SApple OSS Distributions * The contents of this file constitute Original Code as defined in and 7*e7776783SApple OSS Distributions * are subject to the Apple Public Source License Version 1.1 (the 8*e7776783SApple OSS Distributions * "License"). You may not use this file except in compliance with the 9*e7776783SApple OSS Distributions * License. Please obtain a copy of the License at 10*e7776783SApple OSS Distributions * http://www.apple.com/publicsource and read it before using this file. 11*e7776783SApple OSS Distributions * 12*e7776783SApple OSS Distributions * This Original Code and all software distributed under the License are 13*e7776783SApple OSS Distributions * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER 14*e7776783SApple OSS Distributions * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 15*e7776783SApple OSS Distributions * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 16*e7776783SApple OSS Distributions * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the 17*e7776783SApple OSS Distributions * License for the specific language governing rights and limitations 18*e7776783SApple OSS Distributions * under the License. 19*e7776783SApple OSS Distributions * 20*e7776783SApple OSS Distributions * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 21*e7776783SApple OSS Distributions */ 22*e7776783SApple OSS Distributions 23*e7776783SApple OSS Distributions #ifndef BSD_SYS_KDEBUG_TRIAGE_H 24*e7776783SApple OSS Distributions #define BSD_SYS_KDEBUG_TRIAGE_H 25*e7776783SApple OSS Distributions 26*e7776783SApple OSS Distributions int create_buffers_triage(bool); 27*e7776783SApple OSS Distributions 28*e7776783SApple OSS Distributions void delete_buffers_triage(void); 29*e7776783SApple OSS Distributions 30*e7776783SApple OSS Distributions #define KDBG_TRIAGE_CLASS_MASK (0xff000000) 31*e7776783SApple OSS Distributions #define KDBG_TRIAGE_CLASS_OFFSET (24) 32*e7776783SApple OSS Distributions #define KDBG_TRIAGE_CLASS_MAX (0xff) 33*e7776783SApple OSS Distributions 34*e7776783SApple OSS Distributions /* Unused but reserved for future use (possibly for payload encoding) */ 35*e7776783SApple OSS Distributions #define KDBG_TRIAGE_RESERVED (0) 36*e7776783SApple OSS Distributions #define KDBG_TRIAGE_RESERVED_MASK (0x00ff0000) 37*e7776783SApple OSS Distributions #define KDBG_TRIAGE_RESERVED_OFFSET (16) 38*e7776783SApple OSS Distributions #define KDBG_TRIAGE_RESERVED_MAX (0xff) 39*e7776783SApple OSS Distributions 40*e7776783SApple OSS Distributions #define KDBG_TRIAGE_CODE_MASK (0x0000fffc) 41*e7776783SApple OSS Distributions #define KDBG_TRIAGE_CODE_OFFSET (2) 42*e7776783SApple OSS Distributions #define KDBG_TRIAGE_CODE_MAX (0x3fff) 43*e7776783SApple OSS Distributions 44*e7776783SApple OSS Distributions #define KDBG_TRIAGE_EVENTID(Class, Reserved, Code) \ 45*e7776783SApple OSS Distributions (((unsigned)((Class) & 0xff) << KDBG_TRIAGE_CLASS_OFFSET) | \ 46*e7776783SApple OSS Distributions ((unsigned)((Reserved) & 0xff) << KDBG_TRIAGE_RESERVED_OFFSET) | \ 47*e7776783SApple OSS Distributions ((unsigned)((Code) & 0x3fff) << KDBG_TRIAGE_CODE_OFFSET)) 48*e7776783SApple OSS Distributions 49*e7776783SApple OSS Distributions #define KDBG_TRIAGE_EXTRACT_CLASS(Debugid) \ 50*e7776783SApple OSS Distributions ((uint8_t)(((Debugid) & KDBG_TRIAGE_CLASS_MASK) >> KDBG_TRIAGE_CLASS_OFFSET)) 51*e7776783SApple OSS Distributions #define KDBG_TRIAGE_EXTRACT_CODE(Debugid) \ 52*e7776783SApple OSS Distributions ((uint16_t)(((Debugid) & KDBG_TRIAGE_CODE_MASK) >> KDBG_TRIAGE_CODE_OFFSET)) 53*e7776783SApple OSS Distributions 54*e7776783SApple OSS Distributions #define KDBG_TRIAGE_MAX_STRINGS (5) 55*e7776783SApple OSS Distributions #define KDBG_TRIAGE_MAX_STRLEN (128) 56*e7776783SApple OSS Distributions 57*e7776783SApple OSS Distributions /****** VM Codes Begin ******/ 58*e7776783SApple OSS Distributions #define KDBG_TRIAGE_SUBSYS_VM (1) 59*e7776783SApple OSS Distributions 60*e7776783SApple OSS Distributions enum vm_subsys_error_codes { 61*e7776783SApple OSS Distributions KDBG_TRIAGE_VM_PREFIX = 0, 62*e7776783SApple OSS Distributions KDBG_TRIAGE_VM_NO_DATA, 63*e7776783SApple OSS Distributions KDBG_TRIAGE_VM_TEXT_CORRUPTION, 64*e7776783SApple OSS Distributions KDBG_TRIAGE_VM_ADDRESS_NOT_FOUND, 65*e7776783SApple OSS Distributions KDBG_TRIAGE_VM_PROTECTION_FAILURE, 66*e7776783SApple OSS Distributions KDBG_TRIAGE_VM_MEMORY_SHORTAGE, 67*e7776783SApple OSS Distributions KDBG_TRIAGE_VM_FAULT_INTERRUPTED, 68*e7776783SApple OSS Distributions KDBG_TRIAGE_VM_SUCCESS_NO_PAGE, 69*e7776783SApple OSS Distributions KDBG_TRIAGE_VM_GUARDPAGE_FAULT, 70*e7776783SApple OSS Distributions KDBG_TRIAGE_VM_NONZERO_PREEMPTION_LEVEL, 71*e7776783SApple OSS Distributions KDBG_TRIAGE_VM_BUSYPAGE_WAIT_INTERRUPTED, 72*e7776783SApple OSS Distributions KDBG_TRIAGE_VM_PURGEABLE_FAULT_ERROR, 73*e7776783SApple OSS Distributions KDBG_TRIAGE_VM_OBJECT_SHADOW_SEVERED, 74*e7776783SApple OSS Distributions KDBG_TRIAGE_VM_OBJECT_NOT_ALIVE, 75*e7776783SApple OSS Distributions KDBG_TRIAGE_VM_OBJECT_NO_PAGER, 76*e7776783SApple OSS Distributions KDBG_TRIAGE_VM_PAGE_HAS_ERROR, 77*e7776783SApple OSS Distributions KDBG_TRIAGE_VM_PAGE_HAS_RESTART, 78*e7776783SApple OSS Distributions KDBG_TRIAGE_VM_FAILED_IMMUTABLE_PAGE_WRITE, 79*e7776783SApple OSS Distributions KDBG_TRIAGE_VM_FAILED_NX_PAGE_EXEC_MAPPING, 80*e7776783SApple OSS Distributions KDBG_TRIAGE_VM_PMAP_ENTER_RESOURCE_SHORTAGE, 81*e7776783SApple OSS Distributions KDBG_TRIAGE_VM_COMPRESSOR_GET_OUT_OF_RANGE, 82*e7776783SApple OSS Distributions KDBG_TRIAGE_VM_COMPRESSOR_GET_NO_PAGE, 83*e7776783SApple OSS Distributions KDBG_TRIAGE_VM_COMPRESSOR_DECOMPRESS_FAILED, 84*e7776783SApple OSS Distributions KDBG_TRIAGE_VM_COMPRESSOR_BLOCKING_OP_FAILED, 85*e7776783SApple OSS Distributions KDBG_TRIAGE_VM_SUBMAP_NO_COW_ON_EXECUTABLE, 86*e7776783SApple OSS Distributions KDBG_TRIAGE_VM_SUBMAP_COPY_SLOWLY_FAILED, 87*e7776783SApple OSS Distributions KDBG_TRIAGE_VM_SUBMAP_COPY_STRAT_FAILED, 88*e7776783SApple OSS Distributions KDBG_TRIAGE_VM_VNODEPAGER_CLREAD_NO_UPL, 89*e7776783SApple OSS Distributions KDBG_TRIAGE_VM_VNODEPAGEIN_NO_UBCINFO, 90*e7776783SApple OSS Distributions KDBG_TRIAGE_VM_VNODEPAGEIN_FSPAGEIN_FAIL, 91*e7776783SApple OSS Distributions KDBG_TRIAGE_VM_VNODEPAGEIN_NO_UPL, 92*e7776783SApple OSS Distributions KDBG_TRIAGE_VM_MAX 93*e7776783SApple OSS Distributions }; 94*e7776783SApple OSS Distributions #define VM_MAX_TRIAGE_STRINGS (KDBG_TRIAGE_VM_MAX) 95*e7776783SApple OSS Distributions extern const char *vm_triage_strings[VM_MAX_TRIAGE_STRINGS][KDBG_TRIAGE_MAX_STRLEN]; 96*e7776783SApple OSS Distributions 97*e7776783SApple OSS Distributions /****** VM Codes End ******/ 98*e7776783SApple OSS Distributions 99*e7776783SApple OSS Distributions /****** Cluster Codes Begin ******/ 100*e7776783SApple OSS Distributions #define KDBG_TRIAGE_SUBSYS_CLUSTER (2) 101*e7776783SApple OSS Distributions 102*e7776783SApple OSS Distributions enum cluster_subsys_error_codes { 103*e7776783SApple OSS Distributions KDBG_TRIAGE_CL_PREFIX = 0, 104*e7776783SApple OSS Distributions KDBG_TRIAGE_CL_PGIN_PAST_EOF, 105*e7776783SApple OSS Distributions KDBG_TRIAGE_CL_MAX 106*e7776783SApple OSS Distributions }; 107*e7776783SApple OSS Distributions #define CLUSTER_MAX_TRIAGE_STRINGS (KDBG_TRIAGE_CL_MAX) 108*e7776783SApple OSS Distributions extern const char *cluster_triage_strings[CLUSTER_MAX_TRIAGE_STRINGS][KDBG_TRIAGE_MAX_STRLEN]; 109*e7776783SApple OSS Distributions 110*e7776783SApple OSS Distributions /****** Cluster Codes End ******/ 111*e7776783SApple OSS Distributions 112*e7776783SApple OSS Distributions /****** Shared Region Codes Begin ******/ 113*e7776783SApple OSS Distributions #define KDBG_TRIAGE_SUBSYS_SHARED_REGION (3) 114*e7776783SApple OSS Distributions 115*e7776783SApple OSS Distributions enum shared_region_subsys_error_codes { 116*e7776783SApple OSS Distributions KDBG_TRIAGE_SHARED_REGION_PREFIX = 0, 117*e7776783SApple OSS Distributions KDBG_TRIAGE_SHARED_REGION_NO_UPL, 118*e7776783SApple OSS Distributions KDBG_TRIAGE_SHARED_REGION_SLIDE_ERROR, 119*e7776783SApple OSS Distributions KDBG_TRIAGE_SHARED_REGION_MAX 120*e7776783SApple OSS Distributions }; 121*e7776783SApple OSS Distributions #define SHARED_REGION_MAX_TRIAGE_STRINGS (KDBG_TRIAGE_SHARED_REGION_MAX) 122*e7776783SApple OSS Distributions extern const char *shared_region_triage_strings[SHARED_REGION_MAX_TRIAGE_STRINGS][KDBG_TRIAGE_MAX_STRLEN]; 123*e7776783SApple OSS Distributions 124*e7776783SApple OSS Distributions /****** Shared Region Codes End ******/ 125*e7776783SApple OSS Distributions 126*e7776783SApple OSS Distributions #define KDBG_TRIAGE_SUBSYS_MAX KDBG_TRIAGE_SUBSYS_SHARED_REGION 127*e7776783SApple OSS Distributions 128*e7776783SApple OSS Distributions #endif /* BSD_SYS_KDEBUG_TRIAGE_H */ 129