]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * Copyright (c) 2000-2007 Apple Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ | |
5 | * | |
6 | * This file contains Original Code and/or Modifications of Original Code | |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. The rights granted to you under the License | |
10 | * may not be used to create, or enable the creation or redistribution of, | |
11 | * unlawful or unlicensed copies of an Apple operating system, or to | |
12 | * circumvent, violate, or enable the circumvention or violation of, any | |
13 | * terms of an Apple operating system software license agreement. | |
14 | * | |
15 | * Please obtain a copy of the License at | |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. | |
17 | * | |
18 | * The Original Code and all software distributed under the License are | |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
23 | * Please see the License for the specific language governing rights and | |
24 | * limitations under the License. | |
25 | * | |
26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ | |
27 | */ | |
28 | ||
29 | /* Copyright (c) 1997 Apple Computer, Inc. All rights reserved. | |
30 | * | |
31 | * kdebug.h - kernel_debug definitions | |
32 | * | |
33 | */ | |
34 | ||
35 | #ifndef BSD_SYS_KDEBUG_H | |
36 | #define BSD_SYS_KDEBUG_H | |
37 | ||
38 | #include <sys/appleapiopts.h> | |
39 | #include <sys/cdefs.h> | |
40 | __BEGIN_DECLS | |
41 | ||
42 | #ifdef __APPLE_API_UNSTABLE | |
43 | ||
44 | #include <mach/clock_types.h> | |
45 | #include <stdint.h> | |
46 | #if defined(KERNEL_BUILD) | |
47 | #include <kdebug.h> | |
48 | #endif /* KERNEL_BUILD */ | |
49 | ||
50 | /* | |
51 | * types of faults that vm_fault handles | |
52 | * and creates trace entries for | |
53 | */ | |
54 | #define DBG_ZERO_FILL_FAULT 1 | |
55 | #define DBG_PAGEIN_FAULT 2 | |
56 | #define DBG_COW_FAULT 3 | |
57 | #define DBG_CACHE_HIT_FAULT 4 | |
58 | #define DBG_NZF_PAGE_FAULT 5 | |
59 | #define DBG_GUARD_FAULT 6 | |
60 | ||
61 | ||
62 | /* The debug code consists of the following | |
63 | * | |
64 | * ---------------------------------------------------------------------- | |
65 | *| | | |Func | | |
66 | *| Class (8) | SubClass (8) | Code (14) |Qual(2)| | |
67 | * ---------------------------------------------------------------------- | |
68 | * The class specifies the higher level | |
69 | */ | |
70 | ||
71 | /* The Function qualifiers */ | |
72 | #define DBG_FUNC_START 1 | |
73 | #define DBG_FUNC_END 2 | |
74 | #define DBG_FUNC_NONE 0 | |
75 | ||
76 | ||
77 | /* The Kernel Debug Classes */ | |
78 | #define DBG_MACH 1 | |
79 | #define DBG_NETWORK 2 | |
80 | #define DBG_FSYSTEM 3 | |
81 | #define DBG_BSD 4 | |
82 | #define DBG_IOKIT 5 | |
83 | #define DBG_DRIVERS 6 | |
84 | #define DBG_TRACE 7 | |
85 | #define DBG_DLIL 8 | |
86 | #define DBG_SECURITY 9 | |
87 | #define DBG_MISC 20 | |
88 | #define DBG_DYLD 31 | |
89 | #define DBG_QT 32 | |
90 | #define DBG_APPS 33 | |
91 | #define DBG_MIG 255 | |
92 | ||
93 | /* **** The Kernel Debug Sub Classes for Mach (DBG_MACH) **** */ | |
94 | #define DBG_MACH_EXCP_KTRAP_x86 0x02 /* Kernel Traps on x86 */ | |
95 | #define DBG_MACH_EXCP_DFLT 0x03 /* Data Translation Fault */ | |
96 | #define DBG_MACH_EXCP_IFLT 0x04 /* Inst Translation Fault */ | |
97 | #define DBG_MACH_EXCP_INTR 0x05 /* Interrupts */ | |
98 | #define DBG_MACH_EXCP_ALNG 0x06 /* Alignment Exception */ | |
99 | #define DBG_MACH_EXCP_UTRAP_x86 0x07 /* User Traps on x86 */ | |
100 | #define DBG_MACH_EXCP_FP 0x08 /* FP Unavail */ | |
101 | #define DBG_MACH_EXCP_DECI 0x09 /* Decrementer Interrupt */ | |
102 | #define DBG_MACH_CHUD 0x0A /* CHUD */ | |
103 | #define DBG_MACH_EXCP_SC 0x0C /* System Calls */ | |
104 | #define DBG_MACH_EXCP_TRACE 0x0D /* Trace exception */ | |
105 | #define DBG_MACH_EXCP_EMUL 0x0E /* Instruction emulated */ | |
106 | #define DBG_MACH_IHDLR 0x10 /* Interrupt Handlers */ | |
107 | #define DBG_MACH_IPC 0x20 /* Inter Process Comm */ | |
108 | #define DBG_MACH_VM 0x30 /* Virtual Memory */ | |
109 | #define DBG_MACH_LEAKS 0x31 /* alloc/free */ | |
110 | #define DBG_MACH_SCHED 0x40 /* Scheduler */ | |
111 | #define DBG_MACH_MSGID_INVALID 0x50 /* Messages - invalid */ | |
112 | #define DBG_MACH_LOCKS 0x60 /* new lock APIs */ | |
113 | #define DBG_MACH_PMAP 0x70 /* pmap */ | |
114 | ||
115 | /* Codes for Scheduler (DBG_MACH_SCHED) */ | |
116 | #define MACH_SCHED 0x0 /* Scheduler */ | |
117 | #define MACH_STACK_ATTACH 0x1 /* stack_attach() */ | |
118 | #define MACH_STACK_HANDOFF 0x2 /* stack_handoff() */ | |
119 | #define MACH_CALL_CONT 0x3 /* call_continuation() */ | |
120 | #define MACH_CALLOUT 0x4 /* callouts */ | |
121 | #define MACH_STACK_DETACH 0x5 | |
122 | #define MACH_MAKE_RUNNABLE 0x6 /* make thread runnable */ | |
123 | #define MACH_PROMOTE 0x7 /* promoted due to resource */ | |
124 | #define MACH_DEMOTE 0x8 /* promotion undone */ | |
125 | #define MACH_IDLE 0x9 /* processor idling */ | |
126 | ||
127 | /* Codes for pmap (DBG_MACH_PMAP) */ | |
128 | #define PMAP__CREATE 0x0 | |
129 | #define PMAP__DESTROY 0x1 | |
130 | #define PMAP__PROTECT 0x2 | |
131 | #define PMAP__PAGE_PROTECT 0x3 | |
132 | #define PMAP__ENTER 0x4 | |
133 | #define PMAP__REMOVE 0x5 | |
134 | #define PMAP__NEST 0x6 | |
135 | #define PMAP__UNNEST 0x7 | |
136 | #define PMAP__FLUSH_TLBS 0x8 | |
137 | #define PMAP__UPDATE_INTERRUPT 0x9 | |
138 | #define PMAP__ATTRIBUTE_CLEAR 0xa | |
139 | ||
140 | /* **** The Kernel Debug Sub Classes for Network (DBG_NETWORK) **** */ | |
141 | #define DBG_NETIP 1 /* Internet Protocol */ | |
142 | #define DBG_NETARP 2 /* Address Resolution Protocol */ | |
143 | #define DBG_NETUDP 3 /* User Datagram Protocol */ | |
144 | #define DBG_NETTCP 4 /* Transmission Control Protocol */ | |
145 | #define DBG_NETICMP 5 /* Internet Control Message Protocol */ | |
146 | #define DBG_NETIGMP 6 /* Internet Group Management Protocol */ | |
147 | #define DBG_NETRIP 7 /* Routing Information Protocol */ | |
148 | #define DBG_NETOSPF 8 /* Open Shortest Path First */ | |
149 | #define DBG_NETISIS 9 /* Intermediate System to Intermediate System */ | |
150 | #define DBG_NETSNMP 10 /* Simple Network Management Protocol */ | |
151 | #define DBG_NETSOCK 11 /* Socket Layer */ | |
152 | ||
153 | /* For Apple talk */ | |
154 | #define DBG_NETAARP 100 /* Apple ARP */ | |
155 | #define DBG_NETDDP 101 /* Datagram Delivery Protocol */ | |
156 | #define DBG_NETNBP 102 /* Name Binding Protocol */ | |
157 | #define DBG_NETZIP 103 /* Zone Information Protocol */ | |
158 | #define DBG_NETADSP 104 /* Name Binding Protocol */ | |
159 | #define DBG_NETATP 105 /* Apple Transaction Protocol */ | |
160 | #define DBG_NETASP 106 /* Apple Session Protocol */ | |
161 | #define DBG_NETAFP 107 /* Apple Filing Protocol */ | |
162 | #define DBG_NETRTMP 108 /* Routing Table Maintenance Protocol */ | |
163 | #define DBG_NETAURP 109 /* Apple Update Routing Protocol */ | |
164 | #define DBG_NETIPSEC 128 /* IPsec Protocol */ | |
165 | ||
166 | /* **** The Kernel Debug Sub Classes for IOKIT (DBG_IOKIT) **** */ | |
167 | #define DBG_IOWORKLOOP 1 /* Work from work loop */ | |
168 | #define DBG_IOINTES 2 /* Interrupt event source */ | |
169 | #define DBG_IOCLKES 3 /* Clock event source */ | |
170 | #define DBG_IOCMDQ 4 /* Command queue latencies */ | |
171 | #define DBG_IOMCURS 5 /* Memory Cursor */ | |
172 | #define DBG_IOMDESC 6 /* Memory Descriptors */ | |
173 | #define DBG_IOPOWER 7 /* Power Managerment */ | |
174 | ||
175 | /* **** 8-32 reserved for internal IOKit usage **** */ | |
176 | ||
177 | #define DBG_IOSTORAGE 32 /* Storage layers */ | |
178 | #define DBG_IONETWORK 33 /* Network layers */ | |
179 | #define DBG_IOKEYBOARD 34 /* Keyboard */ | |
180 | #define DBG_IOHID 35 /* HID Devices */ | |
181 | #define DBG_IOAUDIO 36 /* Audio */ | |
182 | #define DBG_IOSERIAL 37 /* Serial */ | |
183 | #define DBG_IOTTY 38 /* TTY layers */ | |
184 | #define DBG_IOSAM 39 /* SCSI Architecture Model layers */ | |
185 | #define DBG_IOPARALLELATA 40 /* Parallel ATA */ | |
186 | #define DBG_IOPARALLELSCSI 41 /* Parallel SCSI */ | |
187 | #define DBG_IOSATA 42 /* Serial-ATA */ | |
188 | #define DBG_IOSAS 43 /* SAS */ | |
189 | #define DBG_IOFIBRECHANNEL 44 /* FiberChannel */ | |
190 | #define DBG_IOUSB 45 /* USB */ | |
191 | #define DBG_IOBLUETOOTH 46 /* Bluetooth */ | |
192 | #define DBG_IOFIREWIRE 47 /* FireWire */ | |
193 | #define DBG_IOINFINIBAND 48 /* Infiniband */ | |
194 | #define DBG_IOCPUPM 49 /* CPU Power Management */ | |
195 | #define DBG_IOGRAPHICS 50 /* Graphics */ | |
196 | ||
197 | /* Backwards compatibility */ | |
198 | #define DBG_IOPOINTING DBG_IOHID /* OBSOLETE: Use DBG_IOHID instead */ | |
199 | #define DBG_IODISK DBG_IOSTORAGE /* OBSOLETE: Use DBG_IOSTORAGE instead */ | |
200 | ||
201 | /* **** The Kernel Debug Sub Classes for Device Drivers (DBG_DRIVERS) **** */ | |
202 | #define DBG_DRVSTORAGE 1 /* Storage layers */ | |
203 | #define DBG_DRVNETWORK 2 /* Network layers */ | |
204 | #define DBG_DRVKEYBOARD 3 /* Keyboard */ | |
205 | #define DBG_DRVHID 4 /* HID Devices */ | |
206 | #define DBG_DRVAUDIO 5 /* Audio */ | |
207 | #define DBG_DRVSERIAL 7 /* Serial */ | |
208 | #define DBG_DRVSAM 8 /* SCSI Architecture Model layers */ | |
209 | #define DBG_DRVPARALLELATA 9 /* Parallel ATA */ | |
210 | #define DBG_DRVPARALLELSCSI 10 /* Parallel SCSI */ | |
211 | #define DBG_DRVSATA 11 /* Serial ATA */ | |
212 | #define DBG_DRVSAS 12 /* SAS */ | |
213 | #define DBG_DRVFIBRECHANNEL 13 /* FiberChannel */ | |
214 | #define DBG_DRVUSB 14 /* USB */ | |
215 | #define DBG_DRVBLUETOOTH 15 /* Bluetooth */ | |
216 | #define DBG_DRVFIREWIRE 16 /* FireWire */ | |
217 | #define DBG_DRVINFINIBAND 17 /* Infiniband */ | |
218 | #define DBG_DRVGRAPHICS 18 /* Graphics */ | |
219 | ||
220 | /* Backwards compatibility */ | |
221 | #define DBG_DRVPOINTING DBG_DRVHID /* OBSOLETE: Use DBG_DRVHID instead */ | |
222 | #define DBG_DRVDISK DBG_DRVSTORAGE /* OBSOLETE: Use DBG_DRVSTORAGE instead */ | |
223 | ||
224 | /* **** The Kernel Debug Sub Classes for the DLIL Layer (DBG_DLIL) **** */ | |
225 | #define DBG_DLIL_STATIC 1 /* Static DLIL code */ | |
226 | #define DBG_DLIL_PR_MOD 2 /* DLIL Protocol Module */ | |
227 | #define DBG_DLIL_IF_MOD 3 /* DLIL Interface Module */ | |
228 | #define DBG_DLIL_PR_FLT 4 /* DLIL Protocol Filter */ | |
229 | #define DBG_DLIL_IF_FLT 5 /* DLIL Interface FIlter */ | |
230 | ||
231 | /* The Kernel Debug Sub Classes for File System */ | |
232 | #define DBG_FSRW 1 /* reads and writes to the filesystem */ | |
233 | #define DBG_DKRW 2 /* reads and writes to the disk */ | |
234 | #define DBG_FSVN 3 /* vnode operations (inc. locking/unlocking) */ | |
235 | #define DBG_FSLOOOKUP 4 /* namei and other lookup-related operations */ | |
236 | #define DBG_JOURNAL 5 /* journaling operations */ | |
237 | ||
238 | /* The Kernel Debug Sub Classes for BSD */ | |
239 | #define DBG_BSD_EXCP_SC 0x0C /* System Calls */ | |
240 | #define DBG_BSD_AIO 0x0D /* aio (POSIX async IO) */ | |
241 | #define DBG_BSD_SC_EXTENDED_INFO 0x0E /* System Calls, extended info */ | |
242 | #define DBG_BSD_SC_EXTENDED_INFO2 0x0F /* System Calls, extended info */ | |
243 | ||
244 | /* The Kernel Debug Sub Classes for DBG_TRACE */ | |
245 | #define DBG_TRACE_DATA 0 | |
246 | #define DBG_TRACE_STRING 1 | |
247 | ||
248 | /* The Kernel Debug Sub Classes for DBG_MISC */ | |
249 | #define DBG_EVENT 0x10 | |
250 | #define DBG_BUFFER 0x20 | |
251 | ||
252 | /* The Kernel Debug Sub Classes for DBG_DYLD */ | |
253 | #define DBG_DYLD_STRING 5 | |
254 | ||
255 | /* The Kernel Debug modifiers for the DBG_DKRW sub class */ | |
256 | #define DKIO_DONE 0x01 | |
257 | #define DKIO_READ 0x02 | |
258 | #define DKIO_ASYNC 0x04 | |
259 | #define DKIO_META 0x08 | |
260 | #define DKIO_PAGING 0x10 | |
261 | ||
262 | /* Codes for Application Sub Classes */ | |
263 | #define DBG_APP_SAMBA 128 | |
264 | ||
265 | /**********************************************************************/ | |
266 | ||
267 | #define KDBG_CODE(Class, SubClass, code) (((Class & 0xff) << 24) | ((SubClass & 0xff) << 16) | ((code & 0x3fff) << 2)) | |
268 | ||
269 | #define KDBG_MIGCODE(msgid) ((DBG_MIG << 24) | (((msgid) & 0x3fffff) << 2)) | |
270 | ||
271 | #define MACHDBG_CODE(SubClass, code) KDBG_CODE(DBG_MACH, SubClass, code) | |
272 | #define NETDBG_CODE(SubClass, code) KDBG_CODE(DBG_NETWORK, SubClass, code) | |
273 | #define FSDBG_CODE(SubClass, code) KDBG_CODE(DBG_FSYSTEM, SubClass, code) | |
274 | #define BSDDBG_CODE(SubClass, code) KDBG_CODE(DBG_BSD, SubClass, code) | |
275 | #define IOKDBG_CODE(SubClass, code) KDBG_CODE(DBG_IOKIT, SubClass, code) | |
276 | #define DRVDBG_CODE(SubClass, code) KDBG_CODE(DBG_DRIVERS, SubClass, code) | |
277 | #define TRACEDBG_CODE(SubClass,code) KDBG_CODE(DBG_TRACE, SubClass, code) | |
278 | #define MISCDBG_CODE(SubClass,code) KDBG_CODE(DBG_MISC, SubClass, code) | |
279 | #define DLILDBG_CODE(SubClass,code) KDBG_CODE(DBG_DLIL, SubClass, code) | |
280 | #define SECURITYDBG_CODE(SubClass,code) KDBG_CODE(DBG_SECURITY, SubClass, code) | |
281 | #define DYLDDBG_CODE(SubClass,code) KDBG_CODE(DBG_DYLD, SubClass, code) | |
282 | #define QTDBG_CODE(SubClass,code) KDBG_CODE(DBG_QT, SubClass, code) | |
283 | #define APPSDBG_CODE(SubClass,code) KDBG_CODE(DBG_APPS, SubClass, code) | |
284 | #define CPUPM_CODE(code) IOKDBG_CODE(DBG_IOCPUPM, code) | |
285 | ||
286 | #define KMEM_ALLOC_CODE MACHDBG_CODE(DBG_MACH_LEAKS, 0) | |
287 | #define KMEM_ALLOC_CODE_2 MACHDBG_CODE(DBG_MACH_LEAKS, 1) | |
288 | #define KMEM_FREE_CODE MACHDBG_CODE(DBG_MACH_LEAKS, 2) | |
289 | #define KMEM_FREE_CODE_2 MACHDBG_CODE(DBG_MACH_LEAKS, 3) | |
290 | #define ZALLOC_CODE MACHDBG_CODE(DBG_MACH_LEAKS, 4) | |
291 | #define ZALLOC_CODE_2 MACHDBG_CODE(DBG_MACH_LEAKS, 5) | |
292 | #define ZFREE_CODE MACHDBG_CODE(DBG_MACH_LEAKS, 6) | |
293 | #define ZFREE_CODE_2 MACHDBG_CODE(DBG_MACH_LEAKS, 7) | |
294 | ||
295 | #define PMAP_CODE(code) MACHDBG_CODE(DBG_MACH_PMAP, code) | |
296 | ||
297 | /* Usage: | |
298 | * kernel_debug((KDBG_CODE(DBG_NETWORK, DNET_PROTOCOL, 51) | DBG_FUNC_START), | |
299 | * offset, 0, 0, 0,0) | |
300 | * | |
301 | * For ex, | |
302 | * | |
303 | * #include <sys/kdebug.h> | |
304 | * | |
305 | * #define DBG_NETIPINIT NETDBG_CODE(DBG_NETIP,1) | |
306 | * | |
307 | * | |
308 | * void | |
309 | * ip_init() | |
310 | * { | |
311 | * register struct protosw *pr; | |
312 | * register int i; | |
313 | * | |
314 | * KERNEL_DEBUG(DBG_NETIPINIT | DBG_FUNC_START, 0,0,0,0,0) | |
315 | * -------- | |
316 | * KERNEL_DEBUG(DBG_NETIPINIT, 0,0,0,0,0) | |
317 | * -------- | |
318 | * KERNEL_DEBUG(DBG_NETIPINIT | DBG_FUNC_END, 0,0,0,0,0) | |
319 | * } | |
320 | * | |
321 | ||
322 | */ | |
323 | ||
324 | extern unsigned int kdebug_enable; | |
325 | #define KDEBUG_ENABLE_TRACE 0x1 | |
326 | #define KDEBUG_ENABLE_ENTROPY 0x2 | |
327 | #define KDEBUG_ENABLE_CHUD 0x4 | |
328 | ||
329 | #if (!defined(NO_KDEBUG)) | |
330 | ||
331 | #define KERNEL_DEBUG_CONSTANT(x,a,b,c,d,e) \ | |
332 | do { \ | |
333 | if (kdebug_enable) \ | |
334 | kernel_debug(x,a,b,c,d,e); \ | |
335 | } while(0) | |
336 | ||
337 | #define KERNEL_DEBUG_CONSTANT1(x,a,b,c,d,e) \ | |
338 | do { \ | |
339 | if (kdebug_enable) \ | |
340 | kernel_debug1(x,a,b,c,d,e); \ | |
341 | } while(0) | |
342 | ||
343 | #else | |
344 | ||
345 | #define KERNEL_DEBUG_CONSTANT(x,a,b,c,d,e) | |
346 | #define KERNEL_DEBUG_CONSTANT1(x,a,b,c,d,e) | |
347 | ||
348 | #define __kdebug_constant_only __unused | |
349 | #endif | |
350 | ||
351 | extern void kernel_debug(unsigned int debugid, unsigned int arg1, unsigned int arg2, unsigned int arg3, unsigned int arg4, unsigned int arg5); | |
352 | ||
353 | extern void kernel_debug1(unsigned int debugid, unsigned int arg1, unsigned int arg2, unsigned int arg3, unsigned int arg4, unsigned int arg5); | |
354 | ||
355 | /* | |
356 | * LP64todo - for some reason these are problematic | |
357 | */ | |
358 | struct proc; | |
359 | extern void kdbg_trace_data(struct proc *proc, long *arg_pid); | |
360 | ||
361 | extern void kdbg_trace_string(struct proc *proc, long *arg1, long *arg2, long *arg3, long *arg4); | |
362 | ||
363 | #if (KDEBUG && (!defined(NO_KDEBUG))) | |
364 | ||
365 | #define KERNEL_DEBUG(x,a,b,c,d,e) \ | |
366 | do { \ | |
367 | if (kdebug_enable) \ | |
368 | kernel_debug((unsigned int)x, (unsigned int)a, (unsigned int)b, \ | |
369 | (unsigned int)c, (unsigned int)d, (unsigned int)e); \ | |
370 | } while(0) | |
371 | ||
372 | #define KERNEL_DEBUG1(x,a,b,c,d,e) \ | |
373 | do { \ | |
374 | if (kdebug_enable) \ | |
375 | kernel_debug1((unsigned int)x, (unsigned int)a, (unsigned int)b, \ | |
376 | (unsigned int)c, (unsigned int)d, (unsigned int)e); \ | |
377 | } while(0) | |
378 | ||
379 | #define __kdebug_only | |
380 | ||
381 | #else | |
382 | ||
383 | #define KERNEL_DEBUG(x,a,b,c,d,e) do {} while (0) | |
384 | #define KERNEL_DEBUG1(x,a,b,c,d,e) do {} while (0) | |
385 | ||
386 | #define __kdebug_only __unused | |
387 | #endif | |
388 | ||
389 | void start_kern_tracing(unsigned int); | |
390 | ||
391 | #endif /* __APPLE_API_UNSTABLE */ | |
392 | __END_DECLS | |
393 | ||
394 | ||
395 | #ifdef PRIVATE | |
396 | #ifdef __APPLE_API_PRIVATE | |
397 | /* | |
398 | * private kernel_debug definitions | |
399 | */ | |
400 | ||
401 | typedef struct { | |
402 | uint64_t timestamp; | |
403 | unsigned int arg1; | |
404 | unsigned int arg2; | |
405 | unsigned int arg3; | |
406 | unsigned int arg4; | |
407 | unsigned int arg5; /* will hold current thread */ | |
408 | unsigned int debugid; | |
409 | } kd_buf; | |
410 | ||
411 | #define KDBG_TIMESTAMP_MASK 0x00ffffffffffffffULL | |
412 | #define KDBG_CPU_MASK 0x0f00000000000000ULL | |
413 | #define KDBG_CPU_SHIFT 56 | |
414 | ||
415 | /* Debug Flags */ | |
416 | #define KDBG_INIT 0x1 | |
417 | #define KDBG_NOWRAP 0x2 | |
418 | #define KDBG_FREERUN 0x4 | |
419 | #define KDBG_WRAPPED 0x8 | |
420 | #define KDBG_USERFLAGS (KDBG_FREERUN|KDBG_NOWRAP|KDBG_INIT) | |
421 | #define KDBG_PIDCHECK 0x10 | |
422 | #define KDBG_MAPINIT 0x20 | |
423 | #define KDBG_PIDEXCLUDE 0x40 | |
424 | #define KDBG_LOCKINIT 0x80 | |
425 | ||
426 | typedef struct { | |
427 | unsigned int type; | |
428 | unsigned int value1; | |
429 | unsigned int value2; | |
430 | unsigned int value3; | |
431 | unsigned int value4; | |
432 | ||
433 | } kd_regtype; | |
434 | ||
435 | typedef struct | |
436 | { | |
437 | int nkdbufs; | |
438 | int nolog; | |
439 | int flags; | |
440 | int nkdthreads; | |
441 | int bufid; | |
442 | } kbufinfo_t; | |
443 | ||
444 | typedef struct | |
445 | { | |
446 | unsigned int thread; | |
447 | int valid; | |
448 | char command[20]; | |
449 | } kd_threadmap; | |
450 | ||
451 | #define KDBG_CLASSTYPE 0x10000 | |
452 | #define KDBG_SUBCLSTYPE 0x20000 | |
453 | #define KDBG_RANGETYPE 0x40000 | |
454 | #define KDBG_TYPENONE 0x80000 | |
455 | #define KDBG_CKTYPES 0xF0000 | |
456 | ||
457 | #define KDBG_RANGECHECK 0x100000 | |
458 | #define KDBG_VALCHECK 0x200000 /* Check up to 4 individual values */ | |
459 | ||
460 | #define KDBG_BUFINIT 0x80000000 | |
461 | ||
462 | /* Control operations */ | |
463 | #define KDBG_EFLAGS 1 | |
464 | #define KDBG_DFLAGS 2 | |
465 | #define KDBG_ENABLE 3 | |
466 | #define KDBG_SETNUMBUF 4 | |
467 | #define KDBG_GETNUMBUF 5 | |
468 | #define KDBG_SETUP 6 | |
469 | #define KDBG_REMOVE 7 | |
470 | #define KDBG_SETREGCODE 8 | |
471 | #define KDBG_GETREGCODE 9 | |
472 | #define KDBG_READTRACE 10 | |
473 | #define KDBG_PIDTR 11 | |
474 | #define KDBG_THRMAP 12 | |
475 | #define KDBG_PIDEX 14 | |
476 | #define KDBG_SETRTCDEC 15 | |
477 | #define KDBG_KDGETENTROPY 16 | |
478 | ||
479 | /* Minimum value allowed when setting decrementer ticks */ | |
480 | #define KDBG_MINRTCDEC 2500 | |
481 | ||
482 | #endif /* __APPLE_API_PRIVATE */ | |
483 | #endif /* PRIVATE */ | |
484 | ||
485 | #endif /* !BSD_SYS_KDEBUG_H */ |