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