xref: /titanic_50/usr/src/uts/common/sys/sdt.h (revision 1dd9d86fd9aec8ba356c4fff43d5a8ebf5bfcaa1)
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_SCHED(name)						\
133 	DTRACE_PROBE(__sched_##name);
134 
135 #define	DTRACE_SCHED1(name, type1, arg1)				\
136 	DTRACE_PROBE1(__sched_##name, type1, arg1);
137 
138 #define	DTRACE_SCHED2(name, type1, arg1, type2, arg2)			\
139 	DTRACE_PROBE2(__sched_##name, type1, arg1, type2, arg2);
140 
141 #define	DTRACE_SCHED3(name, type1, arg1, type2, arg2, type3, arg3)	\
142 	DTRACE_PROBE3(__sched_##name, type1, arg1, type2, arg2, type3, arg3);
143 
144 #define	DTRACE_SCHED4(name, type1, arg1, type2, arg2, 			\
145     type3, arg3, type4, arg4)						\
146 	DTRACE_PROBE4(__sched_##name, type1, arg1, type2, arg2, 	\
147 	    type3, arg3, type4, arg4);
148 
149 #define	DTRACE_PROC(name)						\
150 	DTRACE_PROBE(__proc_##name);
151 
152 #define	DTRACE_PROC1(name, type1, arg1)					\
153 	DTRACE_PROBE1(__proc_##name, type1, arg1);
154 
155 #define	DTRACE_PROC2(name, type1, arg1, type2, arg2)			\
156 	DTRACE_PROBE2(__proc_##name, type1, arg1, type2, arg2);
157 
158 #define	DTRACE_PROC3(name, type1, arg1, type2, arg2, type3, arg3)	\
159 	DTRACE_PROBE3(__proc_##name, type1, arg1, type2, arg2, type3, arg3);
160 
161 #define	DTRACE_PROC4(name, type1, arg1, type2, arg2, 			\
162     type3, arg3, type4, arg4)						\
163 	DTRACE_PROBE4(__proc_##name, type1, arg1, type2, arg2, 		\
164 	    type3, arg3, type4, arg4);
165 
166 #define	DTRACE_IO(name)							\
167 	DTRACE_PROBE(__io_##name);
168 
169 #define	DTRACE_IO1(name, type1, arg1)					\
170 	DTRACE_PROBE1(__io_##name, type1, arg1);
171 
172 #define	DTRACE_IO2(name, type1, arg1, type2, arg2)			\
173 	DTRACE_PROBE2(__io_##name, type1, arg1, type2, arg2);
174 
175 #define	DTRACE_IO3(name, type1, arg1, type2, arg2, type3, arg3)	\
176 	DTRACE_PROBE3(__io_##name, type1, arg1, type2, arg2, type3, arg3);
177 
178 #define	DTRACE_IO4(name, type1, arg1, type2, arg2, 			\
179     type3, arg3, type4, arg4)						\
180 	DTRACE_PROBE4(__io_##name, type1, arg1, type2, arg2, 		\
181 	    type3, arg3, type4, arg4);
182 
183 #define	DTRACE_NFSV3_3(name, type1, arg1, type2, arg2, 			\
184     type3, arg3)							\
185 	DTRACE_PROBE3(__nfsv3_##name, type1, arg1, type2, arg2,		\
186 	    type3, arg3);
187 #define	DTRACE_NFSV3_4(name, type1, arg1, type2, arg2, 			\
188     type3, arg3, type4, arg4)						\
189 	DTRACE_PROBE4(__nfsv3_##name, type1, arg1, type2, arg2,		\
190 	    type3, arg3, type4, arg4);
191 
192 #define	DTRACE_NFSV4_1(name, type1, arg1) \
193 	DTRACE_PROBE1(__nfsv4_##name, type1, arg1);
194 
195 #define	DTRACE_NFSV4_2(name, type1, arg1, type2, arg2) \
196 	DTRACE_PROBE2(__nfsv4_##name, type1, arg1, type2, arg2);
197 
198 #define	DTRACE_NFSV4_3(name, type1, arg1, type2, arg2, type3, arg3) \
199 	DTRACE_PROBE3(__nfsv4_##name, type1, arg1, type2, arg2, type3, arg3);
200 
201 #define	DTRACE_SMB_1(name, type1, arg1) \
202 	DTRACE_PROBE1(__smb_##name, type1, arg1);
203 
204 #define	DTRACE_SMB_2(name, type1, arg1, type2, arg2) \
205 	DTRACE_PROBE2(__smb_##name, type1, arg1, type2, arg2);
206 
207 #define	DTRACE_IP(name)						\
208 	DTRACE_PROBE(__ip_##name);
209 
210 #define	DTRACE_IP1(name, type1, arg1)					\
211 	DTRACE_PROBE1(__ip_##name, type1, arg1);
212 
213 #define	DTRACE_IP2(name, type1, arg1, type2, arg2)			\
214 	DTRACE_PROBE2(__ip_##name, type1, arg1, type2, arg2);
215 
216 #define	DTRACE_IP3(name, type1, arg1, type2, arg2, type3, arg3)	\
217 	DTRACE_PROBE3(__ip_##name, type1, arg1, type2, arg2, type3, arg3);
218 
219 #define	DTRACE_IP4(name, type1, arg1, type2, arg2, 			\
220     type3, arg3, type4, arg4)						\
221 	DTRACE_PROBE4(__ip_##name, type1, arg1, type2, arg2, 		\
222 	    type3, arg3, type4, arg4);
223 
224 #define	DTRACE_IP5(name, type1, arg1, type2, arg2, 			\
225     type3, arg3, type4, arg4, type5, arg5)				\
226 	DTRACE_PROBE5(__ip_##name, type1, arg1, type2, arg2, 		\
227 	    type3, arg3, type4, arg4, type5, arg5);
228 
229 #define	DTRACE_IP6(name, type1, arg1, type2, arg2, 			\
230     type3, arg3, type4, arg4, type5, arg5, type6, arg6)			\
231 	DTRACE_PROBE6(__ip_##name, type1, arg1, type2, arg2, 		\
232 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6);
233 
234 #define	DTRACE_IP7(name, type1, arg1, type2, arg2, type3, arg3,		\
235     type4, arg4, type5, arg5, type6, arg6, type7, arg7)			\
236 	DTRACE_PROBE7(__ip_##name, type1, arg1, type2, arg2, 		\
237 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6,		\
238 	    type7, arg7);
239 
240 #define	DTRACE_SYSEVENT2(name, type1, arg1, type2, arg2)		\
241 	DTRACE_PROBE2(__sysevent_##name, type1, arg1, type2, arg2);
242 
243 #define	DTRACE_XPV(name)						\
244 	DTRACE_PROBE(__xpv_##name);
245 
246 #define	DTRACE_XPV1(name, type1, arg1)					\
247 	DTRACE_PROBE1(__xpv_##name, type1, arg1);
248 
249 #define	DTRACE_XPV2(name, type1, arg1, type2, arg2)			\
250 	DTRACE_PROBE2(__xpv_##name, type1, arg1, type2, arg2);
251 
252 #define	DTRACE_XPV3(name, type1, arg1, type2, arg2, type3, arg3)	\
253 	DTRACE_PROBE3(__xpv_##name, type1, arg1, type2, arg2, type3, arg3);
254 
255 #define	DTRACE_XPV4(name, type1, arg1, type2, arg2, type3, arg3,	\
256 	    type4, arg4)						\
257 	DTRACE_PROBE4(__xpv_##name, type1, arg1, type2, arg2, 		\
258 	    type3, arg3, type4, arg4);
259 
260 #define	DTRACE_FC_1(name, type1, arg1) \
261 	DTRACE_PROBE1(__fc_##name, type1, arg1);
262 
263 #define	DTRACE_FC_2(name, type1, arg1, type2, arg2) \
264 	DTRACE_PROBE2(__fc_##name, type1, arg1, type2, arg2);
265 
266 #define	DTRACE_FC_3(name, type1, arg1, type2, arg2, type3, arg3) \
267 	DTRACE_PROBE3(__fc_##name, type1, arg1, type2, arg2, type3, arg3);
268 
269 #define	DTRACE_FC_4(name, type1, arg1, type2, arg2, type3, arg3, type4, arg4) \
270 	DTRACE_PROBE4(__fc_##name, type1, arg1, type2, arg2, type3, arg3, \
271 	    type4, arg4);
272 
273 #define	DTRACE_FC_5(name, type1, arg1, type2, arg2, type3, arg3, 	\
274 	    type4, arg4, type5, arg5)					\
275 	DTRACE_PROBE5(__fc_##name, type1, arg1, type2, arg2, type3, arg3, \
276 	    type4, arg4, type5, arg5);
277 
278 
279 
280 #endif /* _KERNEL */
281 
282 extern const char *sdt_prefix;
283 
284 typedef struct sdt_probedesc {
285 	char			*sdpd_name;	/* name of this probe */
286 	unsigned long		sdpd_offset;	/* offset of call in text */
287 	struct sdt_probedesc	*sdpd_next;	/* next static probe */
288 } sdt_probedesc_t;
289 
290 #ifdef	__cplusplus
291 }
292 #endif
293 
294 #endif	/* _SYS_SDT_H */
295