xref: /onnv-gate/usr/src/uts/common/sys/sdt.h (revision 6878:360e73ea6b0c)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
53490Seschrock  * Common Development and Distribution License (the "License").
63490Seschrock  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
225982Sahl  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef _SYS_SDT_H
270Sstevel@tonic-gate #define	_SYS_SDT_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #ifdef	__cplusplus
320Sstevel@tonic-gate extern "C" {
330Sstevel@tonic-gate #endif
340Sstevel@tonic-gate 
350Sstevel@tonic-gate #ifndef _KERNEL
360Sstevel@tonic-gate 
370Sstevel@tonic-gate #define	DTRACE_PROBE(provider, name) {					\
380Sstevel@tonic-gate 	extern void __dtrace_##provider##___##name(void);		\
390Sstevel@tonic-gate 	__dtrace_##provider##___##name();				\
400Sstevel@tonic-gate }
410Sstevel@tonic-gate 
420Sstevel@tonic-gate #define	DTRACE_PROBE1(provider, name, arg1) {				\
430Sstevel@tonic-gate 	extern void __dtrace_##provider##___##name(unsigned long);	\
440Sstevel@tonic-gate 	__dtrace_##provider##___##name((unsigned long)arg1);		\
450Sstevel@tonic-gate }
460Sstevel@tonic-gate 
470Sstevel@tonic-gate #define	DTRACE_PROBE2(provider, name, arg1, arg2) {			\
480Sstevel@tonic-gate 	extern void __dtrace_##provider##___##name(unsigned long,	\
490Sstevel@tonic-gate 	    unsigned long);						\
500Sstevel@tonic-gate 	__dtrace_##provider##___##name((unsigned long)arg1,		\
510Sstevel@tonic-gate 	    (unsigned long)arg2);					\
520Sstevel@tonic-gate }
530Sstevel@tonic-gate 
540Sstevel@tonic-gate #define	DTRACE_PROBE3(provider, name, arg1, arg2, arg3) {		\
550Sstevel@tonic-gate 	extern void __dtrace_##provider##___##name(unsigned long,	\
560Sstevel@tonic-gate 	    unsigned long, unsigned long);				\
570Sstevel@tonic-gate 	__dtrace_##provider##___##name((unsigned long)arg1,		\
580Sstevel@tonic-gate 	    (unsigned long)arg2, (unsigned long)arg3);			\
590Sstevel@tonic-gate }
600Sstevel@tonic-gate 
610Sstevel@tonic-gate #define	DTRACE_PROBE4(provider, name, arg1, arg2, arg3, arg4) {		\
620Sstevel@tonic-gate 	extern void __dtrace_##provider##___##name(unsigned long,	\
630Sstevel@tonic-gate 	    unsigned long, unsigned long, unsigned long);		\
640Sstevel@tonic-gate 	__dtrace_##provider##___##name((unsigned long)arg1,		\
650Sstevel@tonic-gate 	    (unsigned long)arg2, (unsigned long)arg3,			\
660Sstevel@tonic-gate 	    (unsigned long)arg4);					\
670Sstevel@tonic-gate }
680Sstevel@tonic-gate 
690Sstevel@tonic-gate #define	DTRACE_PROBE5(provider, name, arg1, arg2, arg3, arg4, arg5) {	\
700Sstevel@tonic-gate 	extern void __dtrace_##provider##___##name(unsigned long,	\
710Sstevel@tonic-gate 	    unsigned long, unsigned long, unsigned long, unsigned long);\
720Sstevel@tonic-gate 	__dtrace_##provider##___##name((unsigned long)arg1,		\
730Sstevel@tonic-gate 	    (unsigned long)arg2, (unsigned long)arg3,			\
740Sstevel@tonic-gate 	    (unsigned long)arg4, (unsigned long)arg5);			\
750Sstevel@tonic-gate }
760Sstevel@tonic-gate 
770Sstevel@tonic-gate #else /* _KERNEL */
780Sstevel@tonic-gate 
790Sstevel@tonic-gate #define	DTRACE_PROBE(name)	{					\
800Sstevel@tonic-gate 	extern void __dtrace_probe_##name(void);			\
810Sstevel@tonic-gate 	__dtrace_probe_##name();					\
820Sstevel@tonic-gate }
830Sstevel@tonic-gate 
840Sstevel@tonic-gate #define	DTRACE_PROBE1(name, type1, arg1) {				\
850Sstevel@tonic-gate 	extern void __dtrace_probe_##name(uintptr_t);			\
860Sstevel@tonic-gate 	__dtrace_probe_##name((uintptr_t)(arg1));			\
870Sstevel@tonic-gate }
880Sstevel@tonic-gate 
890Sstevel@tonic-gate #define	DTRACE_PROBE2(name, type1, arg1, type2, arg2) {			\
900Sstevel@tonic-gate 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t);	\
910Sstevel@tonic-gate 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2));	\
920Sstevel@tonic-gate }
930Sstevel@tonic-gate 
940Sstevel@tonic-gate #define	DTRACE_PROBE3(name, type1, arg1, type2, arg2, type3, arg3) {	\
950Sstevel@tonic-gate 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t, uintptr_t); \
960Sstevel@tonic-gate 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2),	\
970Sstevel@tonic-gate 	    (uintptr_t)(arg3));						\
980Sstevel@tonic-gate }
990Sstevel@tonic-gate 
1000Sstevel@tonic-gate #define	DTRACE_PROBE4(name, type1, arg1, type2, arg2, 			\
1010Sstevel@tonic-gate     type3, arg3, type4, arg4) {						\
1020Sstevel@tonic-gate 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t,		\
1030Sstevel@tonic-gate 	    uintptr_t, uintptr_t);					\
1040Sstevel@tonic-gate 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2),	\
1050Sstevel@tonic-gate 	    (uintptr_t)(arg3), (uintptr_t)(arg4));			\
1060Sstevel@tonic-gate }
1070Sstevel@tonic-gate 
108*6878Sbrendan #define	DTRACE_PROBE5(name, type1, arg1, type2, arg2, 			\
109*6878Sbrendan     type3, arg3, type4, arg4, type5, arg5) {				\
110*6878Sbrendan 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t,		\
111*6878Sbrendan 	    uintptr_t, uintptr_t, uintptr_t);				\
112*6878Sbrendan 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2),	\
113*6878Sbrendan 	    (uintptr_t)(arg3), (uintptr_t)(arg4), (uintptr_t)(arg5));	\
114*6878Sbrendan }
115*6878Sbrendan 
116*6878Sbrendan #define	DTRACE_PROBE6(name, type1, arg1, type2, arg2, 			\
117*6878Sbrendan     type3, arg3, type4, arg4, type5, arg5, type6, arg6) {		\
118*6878Sbrendan 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t,		\
119*6878Sbrendan 	    uintptr_t, uintptr_t, uintptr_t, uintptr_t);		\
120*6878Sbrendan 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2),	\
121*6878Sbrendan 	    (uintptr_t)(arg3), (uintptr_t)(arg4), (uintptr_t)(arg5),	\
122*6878Sbrendan 	    (uintptr_t)(arg6));						\
123*6878Sbrendan }
124*6878Sbrendan 
125*6878Sbrendan #define	DTRACE_PROBE7(name, type1, arg1, type2, arg2, type3, arg3,	\
126*6878Sbrendan     type4, arg4, type5, arg5, type6, arg6, type7, arg7) {		\
127*6878Sbrendan 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t,		\
128*6878Sbrendan 	    uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t);	\
129*6878Sbrendan 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2),	\
130*6878Sbrendan 	    (uintptr_t)(arg3), (uintptr_t)(arg4), (uintptr_t)(arg5),	\
131*6878Sbrendan 	    (uintptr_t)(arg6), (uintptr_t)(arg7));			\
132*6878Sbrendan }
133*6878Sbrendan 
1340Sstevel@tonic-gate #define	DTRACE_SCHED(name)						\
1350Sstevel@tonic-gate 	DTRACE_PROBE(__sched_##name);
1360Sstevel@tonic-gate 
1370Sstevel@tonic-gate #define	DTRACE_SCHED1(name, type1, arg1)				\
1380Sstevel@tonic-gate 	DTRACE_PROBE1(__sched_##name, type1, arg1);
1390Sstevel@tonic-gate 
1400Sstevel@tonic-gate #define	DTRACE_SCHED2(name, type1, arg1, type2, arg2)			\
1410Sstevel@tonic-gate 	DTRACE_PROBE2(__sched_##name, type1, arg1, type2, arg2);
1420Sstevel@tonic-gate 
1430Sstevel@tonic-gate #define	DTRACE_SCHED3(name, type1, arg1, type2, arg2, type3, arg3)	\
1440Sstevel@tonic-gate 	DTRACE_PROBE3(__sched_##name, type1, arg1, type2, arg2, type3, arg3);
1450Sstevel@tonic-gate 
1460Sstevel@tonic-gate #define	DTRACE_SCHED4(name, type1, arg1, type2, arg2, 			\
1470Sstevel@tonic-gate     type3, arg3, type4, arg4)						\
1480Sstevel@tonic-gate 	DTRACE_PROBE4(__sched_##name, type1, arg1, type2, arg2, 	\
1490Sstevel@tonic-gate 	    type3, arg3, type4, arg4);
1500Sstevel@tonic-gate 
1510Sstevel@tonic-gate #define	DTRACE_PROC(name)						\
1520Sstevel@tonic-gate 	DTRACE_PROBE(__proc_##name);
1530Sstevel@tonic-gate 
1540Sstevel@tonic-gate #define	DTRACE_PROC1(name, type1, arg1)					\
1550Sstevel@tonic-gate 	DTRACE_PROBE1(__proc_##name, type1, arg1);
1560Sstevel@tonic-gate 
1570Sstevel@tonic-gate #define	DTRACE_PROC2(name, type1, arg1, type2, arg2)			\
1580Sstevel@tonic-gate 	DTRACE_PROBE2(__proc_##name, type1, arg1, type2, arg2);
1590Sstevel@tonic-gate 
1600Sstevel@tonic-gate #define	DTRACE_PROC3(name, type1, arg1, type2, arg2, type3, arg3)	\
1610Sstevel@tonic-gate 	DTRACE_PROBE3(__proc_##name, type1, arg1, type2, arg2, type3, arg3);
1620Sstevel@tonic-gate 
1630Sstevel@tonic-gate #define	DTRACE_PROC4(name, type1, arg1, type2, arg2, 			\
1640Sstevel@tonic-gate     type3, arg3, type4, arg4)						\
1650Sstevel@tonic-gate 	DTRACE_PROBE4(__proc_##name, type1, arg1, type2, arg2, 		\
1660Sstevel@tonic-gate 	    type3, arg3, type4, arg4);
1670Sstevel@tonic-gate 
1680Sstevel@tonic-gate #define	DTRACE_IO(name)							\
1690Sstevel@tonic-gate 	DTRACE_PROBE(__io_##name);
1700Sstevel@tonic-gate 
1710Sstevel@tonic-gate #define	DTRACE_IO1(name, type1, arg1)					\
1720Sstevel@tonic-gate 	DTRACE_PROBE1(__io_##name, type1, arg1);
1730Sstevel@tonic-gate 
1740Sstevel@tonic-gate #define	DTRACE_IO2(name, type1, arg1, type2, arg2)			\
1750Sstevel@tonic-gate 	DTRACE_PROBE2(__io_##name, type1, arg1, type2, arg2);
1760Sstevel@tonic-gate 
1770Sstevel@tonic-gate #define	DTRACE_IO3(name, type1, arg1, type2, arg2, type3, arg3)	\
1780Sstevel@tonic-gate 	DTRACE_PROBE3(__io_##name, type1, arg1, type2, arg2, type3, arg3);
1790Sstevel@tonic-gate 
1800Sstevel@tonic-gate #define	DTRACE_IO4(name, type1, arg1, type2, arg2, 			\
1810Sstevel@tonic-gate     type3, arg3, type4, arg4)						\
1820Sstevel@tonic-gate 	DTRACE_PROBE4(__io_##name, type1, arg1, type2, arg2, 		\
1830Sstevel@tonic-gate 	    type3, arg3, type4, arg4);
1840Sstevel@tonic-gate 
1855982Sahl #define	DTRACE_NFSV3_3(name, type1, arg1, type2, arg2, 			\
1865982Sahl     type3, arg3)							\
1875982Sahl 	DTRACE_PROBE3(__nfsv3_##name, type1, arg1, type2, arg2,		\
1885982Sahl 	    type3, arg3);
1895982Sahl #define	DTRACE_NFSV3_4(name, type1, arg1, type2, arg2, 			\
1905982Sahl     type3, arg3, type4, arg4)						\
1915982Sahl 	DTRACE_PROBE4(__nfsv3_##name, type1, arg1, type2, arg2,		\
1925982Sahl 	    type3, arg3, type4, arg4);
1935982Sahl 
1945647Ssamf #define	DTRACE_NFSV4_1(name, type1, arg1) \
1955647Ssamf 	DTRACE_PROBE1(__nfsv4_##name, type1, arg1);
1965647Ssamf 
1975647Ssamf #define	DTRACE_NFSV4_2(name, type1, arg1, type2, arg2) \
1985647Ssamf 	DTRACE_PROBE2(__nfsv4_##name, type1, arg1, type2, arg2);
1995647Ssamf 
2005647Ssamf #define	DTRACE_NFSV4_3(name, type1, arg1, type2, arg2, type3, arg3) \
2015647Ssamf 	DTRACE_PROBE3(__nfsv4_##name, type1, arg1, type2, arg2, type3, arg3);
2025647Ssamf 
2036139Sjb150015 #define	DTRACE_SMB_1(name, type1, arg1) \
2046139Sjb150015 	DTRACE_PROBE1(__smb_##name, type1, arg1);
2056139Sjb150015 
2066139Sjb150015 #define	DTRACE_SMB_2(name, type1, arg1, type2, arg2) \
2076139Sjb150015 	DTRACE_PROBE2(__smb_##name, type1, arg1, type2, arg2);
2086139Sjb150015 
209*6878Sbrendan #define	DTRACE_IP(name)						\
210*6878Sbrendan 	DTRACE_PROBE(__ip_##name);
211*6878Sbrendan 
212*6878Sbrendan #define	DTRACE_IP1(name, type1, arg1)					\
213*6878Sbrendan 	DTRACE_PROBE1(__ip_##name, type1, arg1);
214*6878Sbrendan 
215*6878Sbrendan #define	DTRACE_IP2(name, type1, arg1, type2, arg2)			\
216*6878Sbrendan 	DTRACE_PROBE2(__ip_##name, type1, arg1, type2, arg2);
217*6878Sbrendan 
218*6878Sbrendan #define	DTRACE_IP3(name, type1, arg1, type2, arg2, type3, arg3)	\
219*6878Sbrendan 	DTRACE_PROBE3(__ip_##name, type1, arg1, type2, arg2, type3, arg3);
220*6878Sbrendan 
221*6878Sbrendan #define	DTRACE_IP4(name, type1, arg1, type2, arg2, 			\
222*6878Sbrendan     type3, arg3, type4, arg4)						\
223*6878Sbrendan 	DTRACE_PROBE4(__ip_##name, type1, arg1, type2, arg2, 		\
224*6878Sbrendan 	    type3, arg3, type4, arg4);
225*6878Sbrendan 
226*6878Sbrendan #define	DTRACE_IP5(name, type1, arg1, type2, arg2, 			\
227*6878Sbrendan     type3, arg3, type4, arg4, type5, arg5)				\
228*6878Sbrendan 	DTRACE_PROBE5(__ip_##name, type1, arg1, type2, arg2, 		\
229*6878Sbrendan 	    type3, arg3, type4, arg4, type5, arg5);
230*6878Sbrendan 
231*6878Sbrendan #define	DTRACE_IP6(name, type1, arg1, type2, arg2, 			\
232*6878Sbrendan     type3, arg3, type4, arg4, type5, arg5, type6, arg6)			\
233*6878Sbrendan 	DTRACE_PROBE6(__ip_##name, type1, arg1, type2, arg2, 		\
234*6878Sbrendan 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6);
235*6878Sbrendan 
236*6878Sbrendan #define	DTRACE_IP7(name, type1, arg1, type2, arg2, type3, arg3,		\
237*6878Sbrendan     type4, arg4, type5, arg5, type6, arg6, type7, arg7)			\
238*6878Sbrendan 	DTRACE_PROBE7(__ip_##name, type1, arg1, type2, arg2, 		\
239*6878Sbrendan 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6,		\
240*6878Sbrendan 	    type7, arg7);
241*6878Sbrendan 
2423490Seschrock #define	DTRACE_SYSEVENT2(name, type1, arg1, type2, arg2)		\
2433490Seschrock 	DTRACE_PROBE2(__sysevent_##name, type1, arg1, type2, arg2);
2443490Seschrock 
2455084Sjohnlev #define	DTRACE_XPV(name)						\
2465084Sjohnlev 	DTRACE_PROBE(__xpv_##name);
2475084Sjohnlev 
2485084Sjohnlev #define	DTRACE_XPV1(name, type1, arg1)					\
2495084Sjohnlev 	DTRACE_PROBE1(__xpv_##name, type1, arg1);
2505084Sjohnlev 
2515084Sjohnlev #define	DTRACE_XPV2(name, type1, arg1, type2, arg2)			\
2525084Sjohnlev 	DTRACE_PROBE2(__xpv_##name, type1, arg1, type2, arg2);
2535084Sjohnlev 
2545084Sjohnlev #define	DTRACE_XPV3(name, type1, arg1, type2, arg2, type3, arg3)	\
2555084Sjohnlev 	DTRACE_PROBE3(__xpv_##name, type1, arg1, type2, arg2, type3, arg3);
2565084Sjohnlev 
2575084Sjohnlev #define	DTRACE_XPV4(name, type1, arg1, type2, arg2, type3, arg3,	\
2585084Sjohnlev 	    type4, arg4)						\
2595084Sjohnlev 	DTRACE_PROBE4(__xpv_##name, type1, arg1, type2, arg2, 		\
2605084Sjohnlev 	    type3, arg3, type4, arg4);
2615084Sjohnlev 
2620Sstevel@tonic-gate #endif /* _KERNEL */
2630Sstevel@tonic-gate 
2640Sstevel@tonic-gate extern const char *sdt_prefix;
2650Sstevel@tonic-gate 
2660Sstevel@tonic-gate typedef struct sdt_probedesc {
2670Sstevel@tonic-gate 	char			*sdpd_name;	/* name of this probe */
2680Sstevel@tonic-gate 	unsigned long		sdpd_offset;	/* offset of call in text */
2690Sstevel@tonic-gate 	struct sdt_probedesc	*sdpd_next;	/* next static probe */
2700Sstevel@tonic-gate } sdt_probedesc_t;
2710Sstevel@tonic-gate 
2720Sstevel@tonic-gate #ifdef	__cplusplus
2730Sstevel@tonic-gate }
2740Sstevel@tonic-gate #endif
2750Sstevel@tonic-gate 
2760Sstevel@tonic-gate #endif	/* _SYS_SDT_H */
277