|
|
1.1 root 1: /*
2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7: * Reserved. This file contains Original Code and/or Modifications of
8: * Original Code as defined in and that are subject to the Apple Public
9: * Source License Version 1.1 (the "License"). You may not use this file
10: * except in compliance with the License. Please obtain a copy of the
11: * License at http://www.apple.com/publicsource and read it before using
12: * this file.
13: *
14: * The Original Code and all software distributed under the License are
15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19: * License for the specific language governing rights and limitations
20: * under the License.
21: *
22: * @APPLE_LICENSE_HEADER_END@
23: */
24:
25:
26: /* Copyright (c) 1997 Apple Computer, Inc. All rights reserved.
27: *
28: * kdebug.h - kernel_debug definitions
29: *
30: */
31:
32: #import <mach/clock_types.h>
33: #if defined(KERNEL_BUILD)
34: #import <kdebug.h>
35: #endif /* KERNEL_BUILD */
36: /* The debug code consists of the following
37: *
38: * ----------------------------------------------------------------------
39: *| | | |Func |
40: *| Class (8) | SubClass (8) | Code (14) |Qual(2)|
41: * ----------------------------------------------------------------------
42: * The class specifies the higher level
43: */
44:
45: /* The Function qualifiers */
46: #define DBG_FUNC_START 1
47: #define DBG_FUNC_END 2
48: #define DBG_FUNC_NONE 0
49:
50:
51: /* The Kernel Debug Classes */
52: #define DBG_MACH 1
53: #define DBG_NETWORK 2
54: #define DBG_FSYSTEM 3
55: #define DBG_BSD 4
56: #define DBG_IOKIT 5
57: #define DBG_DRIVERS 6
58: #define DBG_MISC 20
59:
60: /* **** The Kernel Debug Sub Classes for Mach (DBG_MACH) **** */
61: #define DBG_MACH_EXCP_DFLT 0x03 /* Data Translation Fault */
62: #define DBG_MACH_EXCP_IFLT 0x04 /* Inst Translation Fault */
63: #define DBG_MACH_EXCP_INTR 0x05 /* Interrupts */
64: #define DBG_MACH_EXCP_ALNG 0x06 /* Alignment Exception */
65: #define DBG_MACH_EXCP_TRAP 0x07 /* Traps */
66: #define DBG_MACH_EXCP_FP 0x08 /* FP Unavail */
67: #define DBG_MACH_EXCP_DECI 0x09 /* Decrementer Interrupt */
68: #define DBG_MACH_EXCP_SC 0x0C /* System Calls */
69: #define DBG_MACH_EXCP_TRACE 0x0D /* Trace excpetion */
70: #define DBG_MACH_IHDLR 0x10 /* Interrupt Handlers */
71: #define DBG_MACH_IPC 0x20 /* Inter Process Comm */
72: #define DBG_MACH_VM 0x30 /* Virtual Memory */
73: #define DBG_MACH_SCHED 0x40 /* Scheduler */
74:
75: /* Codes for Scheduler (DBG_MACH_SCHED) */
76: #define MACH_SCHED 0x0 /* Scheduler */
77: #define MACH_STACK_ATTACH 0x1 /* stack_attach() */
78: #define MACH_STACK_HANDOFF 0x2 /* stack_handoff() */
79: #define MACH_CALL_CONT 0x3 /* call_continuation() */
80: #define MACH_CALLOUT 0x4 /* callouts */
81:
82: /* **** The Kernel Debug Sub Classes for Network (DBG_NETWORK) **** */
83: #define DBG_NETIP 1 /* Internet Protocol */
84: #define DBG_NETARP 2 /* Address Resolution Protocol */
85: #define DBG_NETUDP 3 /* User Datagram Protocol */
86: #define DBG_NETTCP 4 /* Transmission Control Protocol */
87: #define DBG_NETICMP 5 /* Internet Control Message Protocol */
88: #define DBG_NETIGMP 6 /* Internet Group Management Protocol */
89: #define DBG_NETRIP 7 /* Routing Information Protocol */
90: #define DBG_NETOSPF 8 /* Open Shortest Path First */
91: #define DBG_NETISIS 9 /* Intermediate System to Intermediate System */
92: #define DBG_NETSNMP 10 /* Simple Network Management Protocol */
93: #define DBG_NETSOCK 11 /* Socket Layer */
94:
95: /* For Apple talk */
96: #define DBG_NETAARP 100 /* Apple ARP */
97: #define DBG_NETDDP 101 /* Datagram Delivery Protocol */
98: #define DBG_NETNBP 102 /* Name Binding Protocol */
99: #define DBG_NETZIP 103 /* Zone Information Protocol */
100: #define DBG_NETADSP 104 /* Name Binding Protocol */
101: #define DBG_NETATP 105 /* Apple Transaction Protocol */
102: #define DBG_NETASP 106 /* Apple Session Protocol */
103: #define DBG_NETAFP 107 /* Apple Filing Protocol */
104: #define DBG_NETRTMP 108 /* Routing Table Maintenance Protocol */
105: #define DBG_NETAURP 109 /* Apple Update Routing Protocol */
106:
107: /* **** The Kernel Debug Sub Classes for Network (DBG_IOKIT) **** */
108: #define DBG_IOSCSI 1 /* SCSI */
109: #define DBG_IODISK 2 /* Disk layers */
110: #define DBG_IONETWORK 3 /* Network layers */
111: #define DBG_IOKEYBOARD 4 /* Keyboard */
112: #define DBG_IOPOINTING 5 /* Pointing Devices */
113: #define DBG_IOAUDIO 6 /* Audio */
114: #define DBG_IOFLOPPY 7 /* Floppy */
115: #define DBG_IOSERIAL 8 /* Serial */
116: #define DBG_IOTTY 9 /* TTY layers */
117:
118: /* **** The Kernel Debug Sub Classes for Network (DBG_DRIVERS) **** */
119: #define DBG_DRVSCSI 1 /* SCSI */
120: #define DBG_DRVDISK 2 /* Disk layers */
121: #define DBG_DRVNETWORK 3 /* Network layers */
122: #define DBG_DRVKEYBOARD 4 /* Keyboard */
123: #define DBG_DRVPOINTING 5 /* Pointing Devices */
124: #define DBG_DRVAUDIO 6 /* Audio */
125: #define DBG_DRVFLOPPY 7 /* Floppy */
126: #define DBG_DRVSERIAL 8 /* Serial */
127: #define DBG_DRVSPLT 9
128:
129: /* The Kernel Debug Sub Classes for File System */
130: #define DBG_FSRW 1 /* reads and writes to the filesystem */
131:
132: /* The Kernel Debug Sub Classes for BSD */
133:
134: /**********************************************************************/
135:
136: #define KDBG_CODE(Class, SubClass, code) (((Class & 0xff) << 24) | ((SubClass & 0xff) << 16) | ((code & 0x3fff) << 2))
137:
138: #define MACHDBG_CODE(SubClass, code) KDBG_CODE(DBG_MACH, SubClass, code)
139: #define NETDBG_CODE(SubClass, code) KDBG_CODE(DBG_NETWORK, SubClass, code)
140: #define FSDBG_CODE(SubClass, code) KDBG_CODE(DBG_FSYSTEM, SubClass, code)
141: #define BSDDBG_CODE(SubClass, code) KDBG_CODE(DBG_BSD, SubClass, code)
142: #define IOKDBG_CODE(SubClass, code) KDBG_CODE(DBG_IOKIT, SubClass, code)
143: #define DRVDBG_CODE(SubClass, code) KDBG_CODE(DBG_DRIVERS, SubClass, code)
144: #define MISCDBG_CODE(SubClass,code) KDBG_CODE(DBG_MISC, SubClass, code)
145:
146:
147: /* Usage:
148: * kernel_debug((KDBG_CODE(DBG_NETWORK, DNET_PROTOCOL, 51) | DBG_FUNC_START),
149: * offset, 0, 0, 0,0)
150: *
151: * For ex,
152: *
153: * #import <kern/kdebug.h>
154: *
155: * #define DBG_NETIPINIT NETDBG_CODE(DBG_NETIP,1)
156: *
157: *
158: * void
159: * ip_init()
160: * {
161: * register struct protosw *pr;
162: * register int i;
163: *
164: * KERNEL_DEBUG(DBG_NETIPINIT | DBG_FUNC_START, 0,0,0,0,0)
165: * --------
166: * KERNEL_DEBUG(DBG_NETIPINIT, 0,0,0,0,0)
167: * --------
168: * KERNEL_DEBUG(DBG_NETIPINIT | DBG_FUNC_END, 0,0,0,0,0)
169: * }
170: *
171:
172: */
173:
174: extern void kernel_debug(unsigned int debugid, unsigned int arg1, unsigned int arg2, unsigned int arg3, unsigned int arg4, unsigned int arg5);
175:
176: #if KDEBUG
177: extern unsigned int kdebug_enable;
178: #define KERNEL_DEBUG(x,a,b,c,d,e) if(kdebug_enable) kernel_debug(x,a,b,c,d,e)
179: #else
180: #define KERNEL_DEBUG(x,a,b,c,d,e)
181: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.