xref: /titanic_51/usr/src/uts/common/sys/sdt.h (revision dcda19f50b2b80bfc622fff718ac04fb0e1cb670)
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 2008 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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 #ifndef _KERNEL
36 
37 #define	DTRACE_PROBE(provider, name) {					\
38 	extern void __dtrace_##provider##___##name(void);		\
39 	__dtrace_##provider##___##name();				\
40 }
41 
42 #define	DTRACE_PROBE1(provider, name, arg1) {				\
43 	extern void __dtrace_##provider##___##name(unsigned long);	\
44 	__dtrace_##provider##___##name((unsigned long)arg1);		\
45 }
46 
47 #define	DTRACE_PROBE2(provider, name, arg1, arg2) {			\
48 	extern void __dtrace_##provider##___##name(unsigned long,	\
49 	    unsigned long);						\
50 	__dtrace_##provider##___##name((unsigned long)arg1,		\
51 	    (unsigned long)arg2);					\
52 }
53 
54 #define	DTRACE_PROBE3(provider, name, arg1, arg2, arg3) {		\
55 	extern void __dtrace_##provider##___##name(unsigned long,	\
56 	    unsigned long, unsigned long);				\
57 	__dtrace_##provider##___##name((unsigned long)arg1,		\
58 	    (unsigned long)arg2, (unsigned long)arg3);			\
59 }
60 
61 #define	DTRACE_PROBE4(provider, name, arg1, arg2, arg3, arg4) {		\
62 	extern void __dtrace_##provider##___##name(unsigned long,	\
63 	    unsigned long, unsigned long, unsigned long);		\
64 	__dtrace_##provider##___##name((unsigned long)arg1,		\
65 	    (unsigned long)arg2, (unsigned long)arg3,			\
66 	    (unsigned long)arg4);					\
67 }
68 
69 #define	DTRACE_PROBE5(provider, name, arg1, arg2, arg3, arg4, arg5) {	\
70 	extern void __dtrace_##provider##___##name(unsigned long,	\
71 	    unsigned long, unsigned long, unsigned long, unsigned long);\
72 	__dtrace_##provider##___##name((unsigned long)arg1,		\
73 	    (unsigned long)arg2, (unsigned long)arg3,			\
74 	    (unsigned long)arg4, (unsigned long)arg5);			\
75 }
76 
77 #else /* _KERNEL */
78 
79 #define	DTRACE_PROBE(name)	{					\
80 	extern void __dtrace_probe_##name(void);			\
81 	__dtrace_probe_##name();					\
82 }
83 
84 #define	DTRACE_PROBE1(name, type1, arg1) {				\
85 	extern void __dtrace_probe_##name(uintptr_t);			\
86 	__dtrace_probe_##name((uintptr_t)(arg1));			\
87 }
88 
89 #define	DTRACE_PROBE2(name, type1, arg1, type2, arg2) {			\
90 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t);	\
91 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2));	\
92 }
93 
94 #define	DTRACE_PROBE3(name, type1, arg1, type2, arg2, type3, arg3) {	\
95 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t, uintptr_t); \
96 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2),	\
97 	    (uintptr_t)(arg3));						\
98 }
99 
100 #define	DTRACE_PROBE4(name, type1, arg1, type2, arg2, 			\
101     type3, arg3, type4, arg4) {						\
102 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t,		\
103 	    uintptr_t, uintptr_t);					\
104 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2),	\
105 	    (uintptr_t)(arg3), (uintptr_t)(arg4));			\
106 }
107 
108 #define	DTRACE_PROBE5(name, type1, arg1, type2, arg2, 			\
109     type3, arg3, type4, arg4, type5, arg5) {				\
110 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t,		\
111 	    uintptr_t, uintptr_t, uintptr_t);				\
112 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2),	\
113 	    (uintptr_t)(arg3), (uintptr_t)(arg4), (uintptr_t)(arg5));	\
114 }
115 
116 #define	DTRACE_PROBE6(name, type1, arg1, type2, arg2, 			\
117     type3, arg3, type4, arg4, type5, arg5, type6, arg6) {		\
118 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t,		\
119 	    uintptr_t, uintptr_t, uintptr_t, uintptr_t);		\
120 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2),	\
121 	    (uintptr_t)(arg3), (uintptr_t)(arg4), (uintptr_t)(arg5),	\
122 	    (uintptr_t)(arg6));						\
123 }
124 
125 #define	DTRACE_PROBE7(name, type1, arg1, type2, arg2, type3, arg3,	\
126     type4, arg4, type5, arg5, type6, arg6, type7, arg7) {		\
127 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t,		\
128 	    uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t);	\
129 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2),	\
130 	    (uintptr_t)(arg3), (uintptr_t)(arg4), (uintptr_t)(arg5),	\
131 	    (uintptr_t)(arg6), (uintptr_t)(arg7));			\
132 }
133 
134 #define	DTRACE_SCHED(name)						\
135 	DTRACE_PROBE(__sched_##name);
136 
137 #define	DTRACE_SCHED1(name, type1, arg1)				\
138 	DTRACE_PROBE1(__sched_##name, type1, arg1);
139 
140 #define	DTRACE_SCHED2(name, type1, arg1, type2, arg2)			\
141 	DTRACE_PROBE2(__sched_##name, type1, arg1, type2, arg2);
142 
143 #define	DTRACE_SCHED3(name, type1, arg1, type2, arg2, type3, arg3)	\
144 	DTRACE_PROBE3(__sched_##name, type1, arg1, type2, arg2, type3, arg3);
145 
146 #define	DTRACE_SCHED4(name, type1, arg1, type2, arg2, 			\
147     type3, arg3, type4, arg4)						\
148 	DTRACE_PROBE4(__sched_##name, type1, arg1, type2, arg2, 	\
149 	    type3, arg3, type4, arg4);
150 
151 #define	DTRACE_PROC(name)						\
152 	DTRACE_PROBE(__proc_##name);
153 
154 #define	DTRACE_PROC1(name, type1, arg1)					\
155 	DTRACE_PROBE1(__proc_##name, type1, arg1);
156 
157 #define	DTRACE_PROC2(name, type1, arg1, type2, arg2)			\
158 	DTRACE_PROBE2(__proc_##name, type1, arg1, type2, arg2);
159 
160 #define	DTRACE_PROC3(name, type1, arg1, type2, arg2, type3, arg3)	\
161 	DTRACE_PROBE3(__proc_##name, type1, arg1, type2, arg2, type3, arg3);
162 
163 #define	DTRACE_PROC4(name, type1, arg1, type2, arg2, 			\
164     type3, arg3, type4, arg4)						\
165 	DTRACE_PROBE4(__proc_##name, type1, arg1, type2, arg2, 		\
166 	    type3, arg3, type4, arg4);
167 
168 #define	DTRACE_IO(name)							\
169 	DTRACE_PROBE(__io_##name);
170 
171 #define	DTRACE_IO1(name, type1, arg1)					\
172 	DTRACE_PROBE1(__io_##name, type1, arg1);
173 
174 #define	DTRACE_IO2(name, type1, arg1, type2, arg2)			\
175 	DTRACE_PROBE2(__io_##name, type1, arg1, type2, arg2);
176 
177 #define	DTRACE_IO3(name, type1, arg1, type2, arg2, type3, arg3)	\
178 	DTRACE_PROBE3(__io_##name, type1, arg1, type2, arg2, type3, arg3);
179 
180 #define	DTRACE_IO4(name, type1, arg1, type2, arg2, 			\
181     type3, arg3, type4, arg4)						\
182 	DTRACE_PROBE4(__io_##name, type1, arg1, type2, arg2, 		\
183 	    type3, arg3, type4, arg4);
184 
185 #define	DTRACE_NFSV3_3(name, type1, arg1, type2, arg2, 			\
186     type3, arg3)							\
187 	DTRACE_PROBE3(__nfsv3_##name, type1, arg1, type2, arg2,		\
188 	    type3, arg3);
189 #define	DTRACE_NFSV3_4(name, type1, arg1, type2, arg2, 			\
190     type3, arg3, type4, arg4)						\
191 	DTRACE_PROBE4(__nfsv3_##name, type1, arg1, type2, arg2,		\
192 	    type3, arg3, type4, arg4);
193 
194 #define	DTRACE_NFSV4_1(name, type1, arg1) \
195 	DTRACE_PROBE1(__nfsv4_##name, type1, arg1);
196 
197 #define	DTRACE_NFSV4_2(name, type1, arg1, type2, arg2) \
198 	DTRACE_PROBE2(__nfsv4_##name, type1, arg1, type2, arg2);
199 
200 #define	DTRACE_NFSV4_3(name, type1, arg1, type2, arg2, type3, arg3) \
201 	DTRACE_PROBE3(__nfsv4_##name, type1, arg1, type2, arg2, type3, arg3);
202 
203 #define	DTRACE_SMB_1(name, type1, arg1) \
204 	DTRACE_PROBE1(__smb_##name, type1, arg1);
205 
206 #define	DTRACE_SMB_2(name, type1, arg1, type2, arg2) \
207 	DTRACE_PROBE2(__smb_##name, type1, arg1, type2, arg2);
208 
209 #define	DTRACE_IP(name)						\
210 	DTRACE_PROBE(__ip_##name);
211 
212 #define	DTRACE_IP1(name, type1, arg1)					\
213 	DTRACE_PROBE1(__ip_##name, type1, arg1);
214 
215 #define	DTRACE_IP2(name, type1, arg1, type2, arg2)			\
216 	DTRACE_PROBE2(__ip_##name, type1, arg1, type2, arg2);
217 
218 #define	DTRACE_IP3(name, type1, arg1, type2, arg2, type3, arg3)	\
219 	DTRACE_PROBE3(__ip_##name, type1, arg1, type2, arg2, type3, arg3);
220 
221 #define	DTRACE_IP4(name, type1, arg1, type2, arg2, 			\
222     type3, arg3, type4, arg4)						\
223 	DTRACE_PROBE4(__ip_##name, type1, arg1, type2, arg2, 		\
224 	    type3, arg3, type4, arg4);
225 
226 #define	DTRACE_IP5(name, type1, arg1, type2, arg2, 			\
227     type3, arg3, type4, arg4, type5, arg5)				\
228 	DTRACE_PROBE5(__ip_##name, type1, arg1, type2, arg2, 		\
229 	    type3, arg3, type4, arg4, type5, arg5);
230 
231 #define	DTRACE_IP6(name, type1, arg1, type2, arg2, 			\
232     type3, arg3, type4, arg4, type5, arg5, type6, arg6)			\
233 	DTRACE_PROBE6(__ip_##name, type1, arg1, type2, arg2, 		\
234 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6);
235 
236 #define	DTRACE_IP7(name, type1, arg1, type2, arg2, type3, arg3,		\
237     type4, arg4, type5, arg5, type6, arg6, type7, arg7)			\
238 	DTRACE_PROBE7(__ip_##name, type1, arg1, type2, arg2, 		\
239 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6,		\
240 	    type7, arg7);
241 
242 #define	DTRACE_SYSEVENT2(name, type1, arg1, type2, arg2)		\
243 	DTRACE_PROBE2(__sysevent_##name, type1, arg1, type2, arg2);
244 
245 #define	DTRACE_XPV(name)						\
246 	DTRACE_PROBE(__xpv_##name);
247 
248 #define	DTRACE_XPV1(name, type1, arg1)					\
249 	DTRACE_PROBE1(__xpv_##name, type1, arg1);
250 
251 #define	DTRACE_XPV2(name, type1, arg1, type2, arg2)			\
252 	DTRACE_PROBE2(__xpv_##name, type1, arg1, type2, arg2);
253 
254 #define	DTRACE_XPV3(name, type1, arg1, type2, arg2, type3, arg3)	\
255 	DTRACE_PROBE3(__xpv_##name, type1, arg1, type2, arg2, type3, arg3);
256 
257 #define	DTRACE_XPV4(name, type1, arg1, type2, arg2, type3, arg3,	\
258 	    type4, arg4)						\
259 	DTRACE_PROBE4(__xpv_##name, type1, arg1, type2, arg2, 		\
260 	    type3, arg3, type4, arg4);
261 
262 #endif /* _KERNEL */
263 
264 extern const char *sdt_prefix;
265 
266 typedef struct sdt_probedesc {
267 	char			*sdpd_name;	/* name of this probe */
268 	unsigned long		sdpd_offset;	/* offset of call in text */
269 	struct sdt_probedesc	*sdpd_next;	/* next static probe */
270 } sdt_probedesc_t;
271 
272 #ifdef	__cplusplus
273 }
274 #endif
275 
276 #endif	/* _SYS_SDT_H */
277