1 | /* |
2 | * Copyright (c) 2000-2020 Apple Inc. All rights reserved. |
3 | * |
4 | * @Apple_LICENSE_HEADER_START@ |
5 | * |
6 | * The contents of this file constitute Original Code as defined in and |
7 | * are subject to the Apple Public Source License Version 1.1 (the |
8 | * "License"). You may not use this file except in compliance with the |
9 | * License. Please obtain a copy of the License at |
10 | * http://www.apple.com/publicsource and read it before using this file. |
11 | * |
12 | * This Original Code and all software distributed under the License are |
13 | * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER |
14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, |
16 | * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the |
17 | * License for the specific language governing rights and limitations |
18 | * under the License. |
19 | * |
20 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
21 | */ |
22 | |
23 | #ifndef BSD_SYS_KDEBUG_TRIAGE_H |
24 | #define BSD_SYS_KDEBUG_TRIAGE_H |
25 | |
26 | void delete_buffers_triage(void); |
27 | |
28 | #define KDBG_TRIAGE_CLASS_MASK (0xff000000) |
29 | #define KDBG_TRIAGE_CLASS_OFFSET (24) |
30 | #define KDBG_TRIAGE_CLASS_MAX (0xff) |
31 | |
32 | /* Unused but reserved for future use (possibly for payload encoding) */ |
33 | #define KDBG_TRIAGE_RESERVED (0) |
34 | #define KDBG_TRIAGE_RESERVED_MASK (0x00ff0000) |
35 | #define KDBG_TRIAGE_RESERVED_OFFSET (16) |
36 | #define KDBG_TRIAGE_RESERVED_MAX (0xff) |
37 | |
38 | #define KDBG_TRIAGE_CODE_MASK (0x0000fffc) |
39 | #define KDBG_TRIAGE_CODE_OFFSET (2) |
40 | #define KDBG_TRIAGE_CODE_MAX (0x3fff) |
41 | |
42 | #define KDBG_TRIAGE_EVENTID(Class, Reserved, Code) \ |
43 | (((unsigned)((Class) & 0xff) << KDBG_TRIAGE_CLASS_OFFSET) | \ |
44 | ((unsigned)((Reserved) & 0xff) << KDBG_TRIAGE_RESERVED_OFFSET) | \ |
45 | ((unsigned)((Code) & 0x3fff) << KDBG_TRIAGE_CODE_OFFSET)) |
46 | |
47 | #define (Debugid) \ |
48 | ((uint8_t)(((Debugid) & KDBG_TRIAGE_CLASS_MASK) >> KDBG_TRIAGE_CLASS_OFFSET)) |
49 | #define (Debugid) \ |
50 | ((uint16_t)(((Debugid) & KDBG_TRIAGE_CODE_MASK) >> KDBG_TRIAGE_CODE_OFFSET)) |
51 | |
52 | #define KDBG_TRIAGE_MAX_STRINGS (5) |
53 | #define KDBG_TRIAGE_MAX_STRLEN (128) |
54 | |
55 | /****** VM Codes Begin ******/ |
56 | #define KDBG_TRIAGE_SUBSYS_VM (1) |
57 | |
58 | enum vm_subsys_error_codes { |
59 | KDBG_TRIAGE_VM_PREFIX = 0, |
60 | KDBG_TRIAGE_VM_NO_DATA, |
61 | KDBG_TRIAGE_VM_TEXT_CORRUPTION, |
62 | KDBG_TRIAGE_VM_ADDRESS_NOT_FOUND, |
63 | KDBG_TRIAGE_VM_PROTECTION_FAILURE, |
64 | KDBG_TRIAGE_VM_FAULT_MEMORY_SHORTAGE, |
65 | KDBG_TRIAGE_VM_FAULT_COPY_MEMORY_SHORTAGE, |
66 | KDBG_TRIAGE_VM_FAULT_OBJCOPYSLOWLY_MEMORY_SHORTAGE, |
67 | KDBG_TRIAGE_VM_FAULT_OBJIOPLREQ_MEMORY_SHORTAGE, |
68 | KDBG_TRIAGE_VM_FAULT_INTERRUPTED, |
69 | KDBG_TRIAGE_VM_SUCCESS_NO_PAGE, |
70 | KDBG_TRIAGE_VM_GUARDPAGE_FAULT, |
71 | KDBG_TRIAGE_VM_NONZERO_PREEMPTION_LEVEL, |
72 | KDBG_TRIAGE_VM_BUSYPAGE_WAIT_INTERRUPTED, |
73 | KDBG_TRIAGE_VM_PURGEABLE_FAULT_ERROR, |
74 | KDBG_TRIAGE_VM_OBJECT_SHADOW_SEVERED, |
75 | KDBG_TRIAGE_VM_OBJECT_NOT_ALIVE, |
76 | , |
77 | , |
78 | , |
79 | KDBG_TRIAGE_VM_PAGE_HAS_ERROR, |
80 | KDBG_TRIAGE_VM_PAGE_HAS_RESTART, |
81 | KDBG_TRIAGE_VM_FAILED_IMMUTABLE_PAGE_WRITE, |
82 | KDBG_TRIAGE_VM_FAILED_NX_PAGE_EXEC_MAPPING, |
83 | KDBG_TRIAGE_VM_PMAP_ENTER_RESOURCE_SHORTAGE, |
84 | KDBG_TRIAGE_VM_COMPRESSOR_GET_OUT_OF_RANGE, |
85 | KDBG_TRIAGE_VM_COMPRESSOR_GET_NO_PAGE, |
86 | KDBG_TRIAGE_VM_COMPRESSOR_DECOMPRESS_FAILED, |
87 | KDBG_TRIAGE_VM_SUBMAP_NO_COW_ON_EXECUTABLE, |
88 | KDBG_TRIAGE_VM_SUBMAP_COPY_SLOWLY_FAILED, |
89 | KDBG_TRIAGE_VM_SUBMAP_COPY_STRAT_FAILED, |
90 | , |
91 | KDBG_TRIAGE_VM_VNODEPAGEIN_NO_UBCINFO, |
92 | KDBG_TRIAGE_VM_VNODEPAGEIN_FSPAGEIN_FAIL, |
93 | KDBG_TRIAGE_VM_VNODEPAGEIN_NO_UPL, |
94 | KDBG_TRIAGE_VM_ECC_DIRTY, |
95 | KDBG_TRIAGE_VM_ECC_CLEAN, |
96 | KDBG_TRIAGE_VM_COPYOUTMAP_SAMEMAP_ERROR, |
97 | KDBG_TRIAGE_VM_COPYOUTMAP_DIFFERENTMAP_ERROR, |
98 | KDBG_TRIAGE_VM_COPYOVERWRITE_FULL_NESTED_ERROR, |
99 | KDBG_TRIAGE_VM_COPYOVERWRITE_PARTIAL_NESTED_ERROR, |
100 | KDBG_TRIAGE_VM_COPYOVERWRITE_PARTIAL_HEAD_NESTED_ERROR, |
101 | KDBG_TRIAGE_VM_COPYOVERWRITE_PARTIAL_TAIL_NESTED_ERROR, |
102 | KDBG_TRIAGE_VM_COPYOUT_INTERNAL_SIZE_ERROR, |
103 | KDBG_TRIAGE_VM_COPYOUT_KERNEL_BUFFER_ERROR, |
104 | KDBG_TRIAGE_VM_COPYOUT_INTERNAL_ADJUSTING_ERROR, |
105 | KDBG_TRIAGE_VM_COPYOUT_INTERNAL_SPACE_ERROR, |
106 | KDBG_TRIAGE_VM_ALLOCATE_KERNEL_BADFLAGS_ERROR, |
107 | KDBG_TRIAGE_VM_ALLOCATE_KERNEL_BADMAP_ERROR, |
108 | KDBG_TRIAGE_VM_ALLOCATE_KERNEL_BADSIZE_ERROR, |
109 | KDBG_TRIAGE_VM_ALLOCATE_KERNEL_VMMAPENTER_ERROR, |
110 | KDBG_TRIAGE_VM_CODE_SIGNING, |
111 | KDBG_TRIAGE_VM_MAX |
112 | }; |
113 | #define VM_MAX_TRIAGE_STRINGS (KDBG_TRIAGE_VM_MAX) |
114 | |
115 | /****** VM Codes End ******/ |
116 | |
117 | /****** Cluster Codes Begin ******/ |
118 | #define KDBG_TRIAGE_SUBSYS_CLUSTER (2) |
119 | |
120 | enum cluster_subsys_error_codes { |
121 | KDBG_TRIAGE_CL_PREFIX = 0, |
122 | KDBG_TRIAGE_CL_PGIN_PAST_EOF, |
123 | KDBG_TRIAGE_CL_MAX |
124 | }; |
125 | #define CLUSTER_MAX_TRIAGE_STRINGS (KDBG_TRIAGE_CL_MAX) |
126 | |
127 | /****** Cluster Codes End ******/ |
128 | |
129 | /****** Shared Region Codes Begin ******/ |
130 | #define KDBG_TRIAGE_SUBSYS_SHARED_REGION (3) |
131 | |
132 | enum shared_region_subsys_error_codes { |
133 | KDBG_TRIAGE_SHARED_REGION_PREFIX = 0, |
134 | KDBG_TRIAGE_SHARED_REGION_NO_UPL, |
135 | KDBG_TRIAGE_SHARED_REGION_SLIDE_ERROR, |
136 | , |
137 | KDBG_TRIAGE_SHARED_REGION_MAX |
138 | }; |
139 | #define SHARED_REGION_MAX_TRIAGE_STRINGS (KDBG_TRIAGE_SHARED_REGION_MAX) |
140 | |
141 | /****** Shared Region Codes End ******/ |
142 | |
143 | /****** DYLD pager Codes Begin ******/ |
144 | #define (4) |
145 | |
146 | enum { |
147 | = 0, |
148 | , |
149 | , |
150 | , |
151 | , |
152 | , |
153 | , |
154 | , |
155 | , |
156 | , |
157 | , |
158 | , |
159 | , |
160 | , |
161 | , |
162 | |
163 | }; |
164 | #define (KDBG_TRIAGE_DYLD_PAGER_MAX) |
165 | |
166 | /****** DYLD pager Codes End ******/ |
167 | |
168 | /****** APPLE_PROTECT_PAGER pager Codes Begin ******/ |
169 | #define (5) |
170 | |
171 | enum { |
172 | = 0, |
173 | , |
174 | |
175 | }; |
176 | #define (KDBG_TRIAGE_APPLE_PROTECT_PAGER_MAX) |
177 | |
178 | /****** APPLE_PROTECT pager Codes End ******/ |
179 | |
180 | /****** FOURK pager Codes Begin ******/ |
181 | #define (6) |
182 | |
183 | enum { |
184 | = 0, |
185 | , |
186 | |
187 | }; |
188 | #define (KDBG_TRIAGE_FOURK_PAGER_MAX) |
189 | |
190 | /****** FOURK pager Codes End ******/ |
191 | |
192 | /****** Kext ktriage Begin ******/ |
193 | /* |
194 | * kexts can define their own strings and augment them with an argument. |
195 | * ktriage only needs to know the subsystem id, and expects that the first |
196 | * string will be the subsystem prefix string. |
197 | * |
198 | * Right now we don't support dynamically adding or removing subsystems. |
199 | */ |
200 | |
201 | #define KDBG_TRIAGE_SUBSYS_APFS (7) |
202 | #define KDBG_TRIAGE_SUBSYS_DECMPFS (8) |
203 | |
204 | /****** Kext ktriage End ******/ |
205 | |
206 | /****** Corpse pager Codes Begin ******/ |
207 | #define KDBG_TRIAGE_SUBSYS_CORPSE (9) |
208 | |
209 | enum corpse_subsys_error_codes { |
210 | KDBG_TRIAGE_CORPSE_PREFIX = 0, |
211 | KDBG_TRIAGE_CORPSE_PROC_TOO_BIG, |
212 | KDBG_TRIAGE_CORPSE_FAIL_LIBGMALLOC, |
213 | KDBG_TRIAGE_CORPSE_BLOCKED_JETSAM, |
214 | KDBG_TRIAGE_CORPSE_LIMIT, |
215 | KDBG_TRIAGE_CORPSES_DISABLED, |
216 | KDBG_TRIAGE_CORPSE_DISABLED_FOR_PROC, |
217 | KDBG_TRIAGE_CORPSE_MAX |
218 | }; |
219 | #define CORPSE_MAX_TRIAGE_STRINGS (KDBG_TRIAGE_CORPSE_MAX) |
220 | |
221 | /****** Corpse pager Codes End ******/ |
222 | |
223 | /* please update KDBG_TRIAGE_SUBSYS_MAX when adding a new subsystem */ |
224 | |
225 | #define KDBG_TRIAGE_SUBSYS_MAX KDBG_TRIAGE_SUBSYS_CORPSE |
226 | |
227 | #endif /* BSD_SYS_KDEBUG_TRIAGE_H */ |
228 | |