xref: /titanic_51/usr/src/uts/common/sys/sdt.h (revision 6bbe05905a1c10a2703f95fb4912eb14b87f6670)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _SYS_SDT_H
27 #define	_SYS_SDT_H
28 
29 #ifdef	__cplusplus
30 extern "C" {
31 #endif
32 
33 #ifndef _KERNEL
34 
35 #define	DTRACE_PROBE(provider, name) {					\
36 	extern void __dtrace_##provider##___##name(void);		\
37 	__dtrace_##provider##___##name();				\
38 }
39 
40 #define	DTRACE_PROBE1(provider, name, arg1) {				\
41 	extern void __dtrace_##provider##___##name(unsigned long);	\
42 	__dtrace_##provider##___##name((unsigned long)arg1);		\
43 }
44 
45 #define	DTRACE_PROBE2(provider, name, arg1, arg2) {			\
46 	extern void __dtrace_##provider##___##name(unsigned long,	\
47 	    unsigned long);						\
48 	__dtrace_##provider##___##name((unsigned long)arg1,		\
49 	    (unsigned long)arg2);					\
50 }
51 
52 #define	DTRACE_PROBE3(provider, name, arg1, arg2, arg3) {		\
53 	extern void __dtrace_##provider##___##name(unsigned long,	\
54 	    unsigned long, unsigned long);				\
55 	__dtrace_##provider##___##name((unsigned long)arg1,		\
56 	    (unsigned long)arg2, (unsigned long)arg3);			\
57 }
58 
59 #define	DTRACE_PROBE4(provider, name, arg1, arg2, arg3, arg4) {		\
60 	extern void __dtrace_##provider##___##name(unsigned long,	\
61 	    unsigned long, unsigned long, unsigned long);		\
62 	__dtrace_##provider##___##name((unsigned long)arg1,		\
63 	    (unsigned long)arg2, (unsigned long)arg3,			\
64 	    (unsigned long)arg4);					\
65 }
66 
67 #define	DTRACE_PROBE5(provider, name, arg1, arg2, arg3, arg4, arg5) {	\
68 	extern void __dtrace_##provider##___##name(unsigned long,	\
69 	    unsigned long, unsigned long, unsigned long, unsigned long);\
70 	__dtrace_##provider##___##name((unsigned long)arg1,		\
71 	    (unsigned long)arg2, (unsigned long)arg3,			\
72 	    (unsigned long)arg4, (unsigned long)arg5);			\
73 }
74 
75 #else /* _KERNEL */
76 
77 #define	DTRACE_PROBE(name)	{					\
78 	extern void __dtrace_probe_##name(void);			\
79 	__dtrace_probe_##name();					\
80 }
81 
82 #define	DTRACE_PROBE1(name, type1, arg1) {				\
83 	extern void __dtrace_probe_##name(uintptr_t);			\
84 	__dtrace_probe_##name((uintptr_t)(arg1));			\
85 }
86 
87 #define	DTRACE_PROBE2(name, type1, arg1, type2, arg2) {			\
88 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t);	\
89 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2));	\
90 }
91 
92 #define	DTRACE_PROBE3(name, type1, arg1, type2, arg2, type3, arg3) {	\
93 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t, uintptr_t); \
94 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2),	\
95 	    (uintptr_t)(arg3));						\
96 }
97 
98 #define	DTRACE_PROBE4(name, type1, arg1, type2, arg2, 			\
99     type3, arg3, type4, arg4) {						\
100 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t,		\
101 	    uintptr_t, uintptr_t);					\
102 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2),	\
103 	    (uintptr_t)(arg3), (uintptr_t)(arg4));			\
104 }
105 
106 #define	DTRACE_PROBE5(name, type1, arg1, type2, arg2, 			\
107     type3, arg3, type4, arg4, type5, arg5) {				\
108 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t,		\
109 	    uintptr_t, uintptr_t, uintptr_t);				\
110 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2),	\
111 	    (uintptr_t)(arg3), (uintptr_t)(arg4), (uintptr_t)(arg5));	\
112 }
113 
114 #define	DTRACE_PROBE6(name, type1, arg1, type2, arg2, 			\
115     type3, arg3, type4, arg4, type5, arg5, type6, arg6) {		\
116 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t,		\
117 	    uintptr_t, uintptr_t, uintptr_t, uintptr_t);		\
118 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2),	\
119 	    (uintptr_t)(arg3), (uintptr_t)(arg4), (uintptr_t)(arg5),	\
120 	    (uintptr_t)(arg6));						\
121 }
122 
123 #define	DTRACE_PROBE7(name, type1, arg1, type2, arg2, type3, arg3,	\
124     type4, arg4, type5, arg5, type6, arg6, type7, arg7) {		\
125 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t,		\
126 	    uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t);	\
127 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2),	\
128 	    (uintptr_t)(arg3), (uintptr_t)(arg4), (uintptr_t)(arg5),	\
129 	    (uintptr_t)(arg6), (uintptr_t)(arg7));			\
130 }
131 
132 #define	DTRACE_PROBE8(name, type1, arg1, type2, arg2, type3, arg3,	\
133     type4, arg4, type5, arg5, type6, arg6, type7, arg7, type8, arg8) {	\
134 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t,		\
135 	    uintptr_t, uintptr_t, uintptr_t, uintptr_t,			\
136 	    uintptr_t, uintptr_t);					\
137 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2),	\
138 	    (uintptr_t)(arg3), (uintptr_t)(arg4), (uintptr_t)(arg5),	\
139 	    (uintptr_t)(arg6), (uintptr_t)(arg7), (uintptr_t)(arg8));	\
140 }
141 
142 #define	DTRACE_SCHED(name)						\
143 	DTRACE_PROBE(__sched_##name);
144 
145 #define	DTRACE_SCHED1(name, type1, arg1)				\
146 	DTRACE_PROBE1(__sched_##name, type1, arg1);
147 
148 #define	DTRACE_SCHED2(name, type1, arg1, type2, arg2)			\
149 	DTRACE_PROBE2(__sched_##name, type1, arg1, type2, arg2);
150 
151 #define	DTRACE_SCHED3(name, type1, arg1, type2, arg2, type3, arg3)	\
152 	DTRACE_PROBE3(__sched_##name, type1, arg1, type2, arg2, type3, arg3);
153 
154 #define	DTRACE_SCHED4(name, type1, arg1, type2, arg2, 			\
155     type3, arg3, type4, arg4)						\
156 	DTRACE_PROBE4(__sched_##name, type1, arg1, type2, arg2, 	\
157 	    type3, arg3, type4, arg4);
158 
159 #define	DTRACE_PROC(name)						\
160 	DTRACE_PROBE(__proc_##name);
161 
162 #define	DTRACE_PROC1(name, type1, arg1)					\
163 	DTRACE_PROBE1(__proc_##name, type1, arg1);
164 
165 #define	DTRACE_PROC2(name, type1, arg1, type2, arg2)			\
166 	DTRACE_PROBE2(__proc_##name, type1, arg1, type2, arg2);
167 
168 #define	DTRACE_PROC3(name, type1, arg1, type2, arg2, type3, arg3)	\
169 	DTRACE_PROBE3(__proc_##name, type1, arg1, type2, arg2, type3, arg3);
170 
171 #define	DTRACE_PROC4(name, type1, arg1, type2, arg2, 			\
172     type3, arg3, type4, arg4)						\
173 	DTRACE_PROBE4(__proc_##name, type1, arg1, type2, arg2, 		\
174 	    type3, arg3, type4, arg4);
175 
176 #define	DTRACE_IO(name)							\
177 	DTRACE_PROBE(__io_##name);
178 
179 #define	DTRACE_IO1(name, type1, arg1)					\
180 	DTRACE_PROBE1(__io_##name, type1, arg1);
181 
182 #define	DTRACE_IO2(name, type1, arg1, type2, arg2)			\
183 	DTRACE_PROBE2(__io_##name, type1, arg1, type2, arg2);
184 
185 #define	DTRACE_IO3(name, type1, arg1, type2, arg2, type3, arg3)	\
186 	DTRACE_PROBE3(__io_##name, type1, arg1, type2, arg2, type3, arg3);
187 
188 #define	DTRACE_IO4(name, type1, arg1, type2, arg2, 			\
189     type3, arg3, type4, arg4)						\
190 	DTRACE_PROBE4(__io_##name, type1, arg1, type2, arg2, 		\
191 	    type3, arg3, type4, arg4);
192 
193 #define	DTRACE_ISCSI_2(name, type1, arg1, type2, arg2)			\
194 	DTRACE_PROBE2(__iscsi_##name, type1, arg1, type2, arg2);
195 
196 #define	DTRACE_ISCSI_3(name, type1, arg1, type2, arg2, type3, arg3)	\
197 	DTRACE_PROBE3(__iscsi_##name, type1, arg1, type2, arg2, type3, arg3);
198 
199 #define	DTRACE_ISCSI_4(name, type1, arg1, type2, arg2,			\
200     type3, arg3, type4, arg4)						\
201 	DTRACE_PROBE4(__iscsi_##name, type1, arg1, type2, arg2,		\
202 	    type3, arg3, type4, arg4);
203 
204 #define	DTRACE_ISCSI_5(name, type1, arg1, type2, arg2,			\
205     type3, arg3, type4, arg4, type5, arg5)				\
206 	DTRACE_PROBE5(__iscsi_##name, type1, arg1, type2, arg2,		\
207 	    type3, arg3, type4, arg4, type5, arg5);
208 
209 #define	DTRACE_ISCSI_6(name, type1, arg1, type2, arg2,			\
210     type3, arg3, type4, arg4, type5, arg5, type6, arg6)			\
211 	DTRACE_PROBE6(__iscsi_##name, type1, arg1, type2, arg2,		\
212 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6);
213 
214 #define	DTRACE_ISCSI_7(name, type1, arg1, type2, arg2,			\
215     type3, arg3, type4, arg4, type5, arg5, type6, arg6, type7, arg7)	\
216 	DTRACE_PROBE7(__iscsi_##name, type1, arg1, type2, arg2,		\
217 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6,		\
218 	    type7, arg7);
219 
220 #define	DTRACE_ISCSI_8(name, type1, arg1, type2, arg2,			\
221     type3, arg3, type4, arg4, type5, arg5, type6, arg6,			\
222     type7, arg7, type8, arg8)						\
223 	DTRACE_PROBE8(__iscsi_##name, type1, arg1, type2, arg2,		\
224 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6,		\
225 	    type7, arg7, type8, arg8);
226 
227 #define	DTRACE_NFSV3_3(name, type1, arg1, type2, arg2, 			\
228     type3, arg3)							\
229 	DTRACE_PROBE3(__nfsv3_##name, type1, arg1, type2, arg2,		\
230 	    type3, arg3);
231 #define	DTRACE_NFSV3_4(name, type1, arg1, type2, arg2, 			\
232     type3, arg3, type4, arg4)						\
233 	DTRACE_PROBE4(__nfsv3_##name, type1, arg1, type2, arg2,		\
234 	    type3, arg3, type4, arg4);
235 
236 #define	DTRACE_NFSV4_1(name, type1, arg1) \
237 	DTRACE_PROBE1(__nfsv4_##name, type1, arg1);
238 
239 #define	DTRACE_NFSV4_2(name, type1, arg1, type2, arg2) \
240 	DTRACE_PROBE2(__nfsv4_##name, type1, arg1, type2, arg2);
241 
242 #define	DTRACE_NFSV4_3(name, type1, arg1, type2, arg2, type3, arg3) \
243 	DTRACE_PROBE3(__nfsv4_##name, type1, arg1, type2, arg2, type3, arg3);
244 
245 #define	DTRACE_SMB_1(name, type1, arg1) \
246 	DTRACE_PROBE1(__smb_##name, type1, arg1);
247 
248 #define	DTRACE_SMB_2(name, type1, arg1, type2, arg2) \
249 	DTRACE_PROBE2(__smb_##name, type1, arg1, type2, arg2);
250 
251 #define	DTRACE_IP(name)						\
252 	DTRACE_PROBE(__ip_##name);
253 
254 #define	DTRACE_IP1(name, type1, arg1)					\
255 	DTRACE_PROBE1(__ip_##name, type1, arg1);
256 
257 #define	DTRACE_IP2(name, type1, arg1, type2, arg2)			\
258 	DTRACE_PROBE2(__ip_##name, type1, arg1, type2, arg2);
259 
260 #define	DTRACE_IP3(name, type1, arg1, type2, arg2, type3, arg3)	\
261 	DTRACE_PROBE3(__ip_##name, type1, arg1, type2, arg2, type3, arg3);
262 
263 #define	DTRACE_IP4(name, type1, arg1, type2, arg2, 			\
264     type3, arg3, type4, arg4)						\
265 	DTRACE_PROBE4(__ip_##name, type1, arg1, type2, arg2, 		\
266 	    type3, arg3, type4, arg4);
267 
268 #define	DTRACE_IP5(name, type1, arg1, type2, arg2, 			\
269     type3, arg3, type4, arg4, type5, arg5)				\
270 	DTRACE_PROBE5(__ip_##name, type1, arg1, type2, arg2, 		\
271 	    type3, arg3, type4, arg4, type5, arg5);
272 
273 #define	DTRACE_IP6(name, type1, arg1, type2, arg2, 			\
274     type3, arg3, type4, arg4, type5, arg5, type6, arg6)			\
275 	DTRACE_PROBE6(__ip_##name, type1, arg1, type2, arg2, 		\
276 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6);
277 
278 #define	DTRACE_IP7(name, type1, arg1, type2, arg2, type3, arg3,		\
279     type4, arg4, type5, arg5, type6, arg6, type7, arg7)			\
280 	DTRACE_PROBE7(__ip_##name, type1, arg1, type2, arg2, 		\
281 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6,		\
282 	    type7, arg7);
283 
284 #define	DTRACE_SYSEVENT2(name, type1, arg1, type2, arg2)		\
285 	DTRACE_PROBE2(__sysevent_##name, type1, arg1, type2, arg2);
286 
287 #define	DTRACE_XPV(name)						\
288 	DTRACE_PROBE(__xpv_##name);
289 
290 #define	DTRACE_XPV1(name, type1, arg1)					\
291 	DTRACE_PROBE1(__xpv_##name, type1, arg1);
292 
293 #define	DTRACE_XPV2(name, type1, arg1, type2, arg2)			\
294 	DTRACE_PROBE2(__xpv_##name, type1, arg1, type2, arg2);
295 
296 #define	DTRACE_XPV3(name, type1, arg1, type2, arg2, type3, arg3)	\
297 	DTRACE_PROBE3(__xpv_##name, type1, arg1, type2, arg2, type3, arg3);
298 
299 #define	DTRACE_XPV4(name, type1, arg1, type2, arg2, type3, arg3,	\
300 	    type4, arg4)						\
301 	DTRACE_PROBE4(__xpv_##name, type1, arg1, type2, arg2, 		\
302 	    type3, arg3, type4, arg4);
303 
304 #define	DTRACE_FC_1(name, type1, arg1) \
305 	DTRACE_PROBE1(__fc_##name, type1, arg1);
306 
307 #define	DTRACE_FC_2(name, type1, arg1, type2, arg2) \
308 	DTRACE_PROBE2(__fc_##name, type1, arg1, type2, arg2);
309 
310 #define	DTRACE_FC_3(name, type1, arg1, type2, arg2, type3, arg3) \
311 	DTRACE_PROBE3(__fc_##name, type1, arg1, type2, arg2, type3, arg3);
312 
313 #define	DTRACE_FC_4(name, type1, arg1, type2, arg2, type3, arg3, type4, arg4) \
314 	DTRACE_PROBE4(__fc_##name, type1, arg1, type2, arg2, type3, arg3, \
315 	    type4, arg4);
316 
317 #define	DTRACE_FC_5(name, type1, arg1, type2, arg2, type3, arg3, 	\
318 	    type4, arg4, type5, arg5)					\
319 	DTRACE_PROBE5(__fc_##name, type1, arg1, type2, arg2, type3, arg3, \
320 	    type4, arg4, type5, arg5);
321 
322 #define	DTRACE_SRP_1(name, type1, arg1)					\
323 	DTRACE_PROBE1(__srp_##name, type1, arg1);
324 
325 #define	DTRACE_SRP_2(name, type1, arg1, type2, arg2)			\
326 	DTRACE_PROBE2(__srp_##name, type1, arg1, type2, arg2);
327 
328 #define	DTRACE_SRP_3(name, type1, arg1, type2, arg2, type3, arg3)	\
329 	DTRACE_PROBE3(__srp_##name, type1, arg1, type2, arg2, type3, arg3);
330 
331 #define	DTRACE_SRP_4(name, type1, arg1, type2, arg2, type3, arg3,	\
332 	    type4, arg4)						\
333 	DTRACE_PROBE4(__srp_##name, type1, arg1, type2, arg2, 		\
334 	    type3, arg3, type4, arg4);
335 
336 #define	DTRACE_SRP_5(name, type1, arg1, type2, arg2, type3, arg3,	\
337 	    type4, arg4, type5, arg5)					\
338 	DTRACE_PROBE5(__srp_##name, type1, arg1, type2, arg2, 		\
339 	    type3, arg3, type4, arg4, type5, arg5);
340 
341 #define	DTRACE_SRP_6(name, type1, arg1, type2, arg2, type3, arg3,	\
342 	    type4, arg4, type5, arg5, type6, arg6)			\
343 	DTRACE_PROBE6(__srp_##name, type1, arg1, type2, arg2, 		\
344 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6);
345 
346 #define	DTRACE_SRP_7(name, type1, arg1, type2, arg2, type3, arg3,	\
347 	    type4, arg4, type5, arg5, type6, arg6, type7, arg7)		\
348 	DTRACE_PROBE7(__srp_##name, type1, arg1, type2, arg2, 		\
349 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6, type7, arg7);
350 
351 #define	DTRACE_SRP_8(name, type1, arg1, type2, arg2, type3, arg3,	\
352 	    type4, arg4, type5, arg5, type6, arg6, type7, arg7, type8, arg8) \
353 	DTRACE_PROBE8(__srp_##name, type1, arg1, type2, arg2, 		\
354 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6,		\
355 	    type7, arg7, type8, arg8);
356 
357 #endif /* _KERNEL */
358 
359 extern const char *sdt_prefix;
360 
361 typedef struct sdt_probedesc {
362 	char			*sdpd_name;	/* name of this probe */
363 	unsigned long		sdpd_offset;	/* offset of call in text */
364 	struct sdt_probedesc	*sdpd_next;	/* next static probe */
365 } sdt_probedesc_t;
366 
367 #ifdef	__cplusplus
368 }
369 #endif
370 
371 #endif	/* _SYS_SDT_H */
372