]> git.saurik.com Git - apple/xnu.git/blob - osfmk/kern/xpr.h
xnu-344.49.tar.gz
[apple/xnu.git] / osfmk / kern / xpr.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25 /*
26 * @OSF_COPYRIGHT@
27 */
28 /*
29 * HISTORY
30 *
31 * Revision 1.1.1.1 1998/09/22 21:05:32 wsanchez
32 * Import of Mac OS X kernel (~semeria)
33 *
34 * Revision 1.1.1.1 1998/03/07 02:25:57 wsanchez
35 * Import of OSF Mach kernel (~mburg)
36 *
37 * Revision 1.1.12.5 1995/02/24 15:22:46 alanl
38 * Add XPR definition to trace generic XMM activities.
39 * [95/01/31 alanl]
40 *
41 * Revision 1.1.14.3 1994/11/02 18:37:35 dwm
42 * mk6 CR668 - 1.3b26 merge
43 * Add MOR token, update XPR names for locks, vm_maps.
44 * now only a single XPR(...) macro, 5 args always.
45 * [1994/11/02 18:17:33 dwm]
46 *
47 * Revision 1.1.12.3 1994/09/23 02:32:50 ezf
48 * change marker to not FREE
49 * [1994/09/22 21:38:33 ezf]
50 *
51 * Revision 1.1.12.2 1994/09/10 21:46:57 bolinger
52 * Merge up to NMK17.3
53 * [1994/09/08 19:57:50 bolinger]
54 *
55 * Revision 1.1.12.1 1994/06/14 17:13:10 bolinger
56 * Merge up to NMK17.2.
57 * [1994/06/14 16:55:44 bolinger]
58 *
59 * Revision 1.1.7.2 1994/05/30 07:37:07 bernadat
60 * Added missing ')' to XPR5.
61 * [94/05/25 bernadat]
62 *
63 * Revision 1.1.7.1 1994/03/24 15:29:18 paire
64 * Set up correct XPR and XPR[1-5] macros.
65 * Added XPR_SIMPLE_LOCK define.
66 * [94/03/08 paire]
67 *
68 * Revision 1.1.2.5 1993/08/03 18:29:24 gm
69 * CR9596: Change KERNEL to MACH_KERNEL.
70 * [1993/08/02 17:41:44 gm]
71 *
72 * Revision 1.1.2.4 1993/07/27 18:09:08 rod
73 * Add ANSI prototypes. CR #9523.
74 * [1993/07/27 10:42:04 rod]
75 *
76 * Revision 1.1.2.3 1993/06/07 22:15:39 jeffc
77 * CR9176 - ANSI C violations: trailing tokens on CPP
78 * directives, extra semicolons after decl_ ..., asm keywords
79 * [1993/06/07 19:07:55 jeffc]
80 *
81 * Revision 1.1.2.2 1993/06/02 23:42:14 jeffc
82 * Added to OSF/1 R1.3 from NMK15.0.
83 * [1993/06/02 21:15:17 jeffc]
84 *
85 * Revision 1.1 1992/09/30 02:30:28 robert
86 * Initial revision
87 *
88 * $EndLog$
89 */
90 /* CMU_HIST */
91 /*
92 * Revision 2.3 91/05/14 16:50:21 mrt
93 * Correcting copyright
94 *
95 * Revision 2.2 91/02/05 17:31:18 mrt
96 * MACH_KERNEL: removed conditionals.
97 * [88/12/19 dbg]
98 *
99 * Revision 2.1 89/08/03 15:57:39 rwd
100 * Created.
101 *
102 * Revision 2.5 88/12/19 02:51:59 mwyoung
103 * Added VM system tags.
104 * [88/11/22 mwyoung]
105 *
106 * Revision 2.4 88/08/24 02:55:54 mwyoung
107 * Adjusted include file references.
108 * [88/08/17 02:29:56 mwyoung]
109 *
110 *
111 * 9-Apr-88 Daniel Julin (dpj) at Carnegie-Mellon University
112 * Added flags for TCP and MACH_NP debugging.
113 *
114 * 6-Jan-88 Michael Young (mwyoung) at Carnegie-Mellon University
115 * Make the event structure smaller to make it easier to read from
116 * kernel debuggers.
117 *
118 * 16-Mar-87 Mike Accetta (mja) at Carnegie-Mellon University
119 * MACH: made XPR_DEBUG definition conditional on MACH
120 * since the routines invoked under it won't link without MACH.
121 * [ V5.1(F7) ]
122 */
123 /* CMU_ENDHIST */
124 /*
125 * Mach Operating System
126 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
127 * All Rights Reserved.
128 *
129 * Permission to use, copy, modify and distribute this software and its
130 * documentation is hereby granted, provided that both the copyright
131 * notice and this permission notice appear in all copies of the
132 * software, derivative works or modified versions, and any portions
133 * thereof, and that both notices appear in supporting documentation.
134 *
135 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
136 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
137 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
138 *
139 * Carnegie Mellon requests users of this software to return to
140 *
141 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
142 * School of Computer Science
143 * Carnegie Mellon University
144 * Pittsburgh PA 15213-3890
145 *
146 * any improvements or extensions that they make and grant Carnegie Mellon
147 * the rights to redistribute these changes.
148 */
149 /*
150 */
151 /*
152 * Include file for xpr circular buffer silent tracing.
153 *
154 */
155 /*
156 * If the kernel flag XPRDEBUG is set, the XPR macro is enabled. The
157 * macro should be invoked something like the following:
158 * XPR(XPR_SYSCALLS, "syscall: %d, 0x%x\n", syscallno, arg1, 0,0,0);
159 * which will expand into the following code:
160 * if (xprflags & XPR_SYSCALLS)
161 * xpr("syscall: %d, 0x%x\n", syscallno, arg1, 0,0,0);
162 * Xpr will log the pointer to the printf string and up to 5 arguements,
163 * along with a timestamp and cpuinfo (for multi-processor systems), into
164 * a circular buffer. The actual printf processing is delayed until after
165 * the buffer has been collected. It is assumed that the text/data segments
166 * of the kernel can easily be reconstructed in a post-processor which
167 * performs the printf processing.
168 *
169 * If the XPRDEBUG compilation switch is not set, the XPR macro expands
170 * to nothing.
171 */
172
173 #ifndef _KERN_XPR_H_
174 #define _KERN_XPR_H_
175
176 #ifdef MACH_KERNEL
177 #include <xpr_debug.h>
178 #else /* MACH_KERNEL */
179 #include <sys/features.h>
180 #endif /* MACH_KERNEL */
181
182 #include <machine/xpr.h>
183
184 #if XPR_DEBUG
185
186 #define XPR(flags, msg, arg1, arg2, arg3, arg4, arg5) \
187 MACRO_BEGIN \
188 if (xprflags & (flags)) { \
189 xpr((msg), (long)(arg1), (long)(arg2), \
190 (long)(arg3), (long)(arg4), (long)(arg5)); \
191 } \
192 MACRO_END
193
194 extern int xprflags;
195
196 /*
197 * flags for message types.
198 */
199 #define XPR_TRAPS (1 << 1)
200 #define XPR_SCHED (1 << 2)
201 #define XPR_LOCK (1 << 3)
202 #define XPR_SLOCK (1 << 4)
203 #define XPR_PMAP (1 << 6)
204 #define XPR_VM_MAP (1 << 7)
205 #define XPR_VM_OBJECT (1 << 8)
206 #define XPR_VM_OBJECT_CACHE (1 << 9)
207 #define XPR_VM_PAGE (1 << 10)
208 #define XPR_VM_PAGEOUT (1 << 11)
209 #define XPR_MEMORY_OBJECT (1 << 12)
210 #define XPR_VM_FAULT (1 << 13)
211 #define XPR_VM_OBJECT_REP (1 << 14)
212 #define XPR_DEFAULT_PAGER (1 << 15)
213 #define XPR_INODE_PAGER (1 << 16)
214 #define XPR_INODE_PAGER_DATA (1 << 17)
215 #define XPR_XMM (1 << 18)
216
217 #else /* XPR_DEBUG */
218 #define XPR(flags, msg, arg1, arg2, arg3, arg4, arg5)
219 #endif /* XPR_DEBUG */
220
221 struct xprbuf {
222 char *msg;
223 long arg1,arg2,arg3,arg4,arg5;
224 int timestamp;
225 int cpuinfo;
226 };
227
228 /* Bootstrap XPR facility */
229 extern void xprbootstrap(void);
230
231 /* Enable XPR facility */
232 extern void xprinit(void);
233
234 /* Log an XPR message */
235 extern void xpr(
236 char *msg,
237 long arg1,
238 long arg2,
239 long arg3,
240 long arg4,
241 long arg5);
242
243 #endif /* _KERN_XPR_H_ */