xref: /titanic_52/usr/src/uts/common/sys/sdt.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef _SYS_SDT_H
28*7c478bd9Sstevel@tonic-gate #define	_SYS_SDT_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
33*7c478bd9Sstevel@tonic-gate extern "C" {
34*7c478bd9Sstevel@tonic-gate #endif
35*7c478bd9Sstevel@tonic-gate 
36*7c478bd9Sstevel@tonic-gate #ifndef _KERNEL
37*7c478bd9Sstevel@tonic-gate 
38*7c478bd9Sstevel@tonic-gate #define	DTRACE_PROBE(provider, name) {					\
39*7c478bd9Sstevel@tonic-gate 	extern void __dtrace_##provider##___##name(void);		\
40*7c478bd9Sstevel@tonic-gate 	__dtrace_##provider##___##name();				\
41*7c478bd9Sstevel@tonic-gate }
42*7c478bd9Sstevel@tonic-gate 
43*7c478bd9Sstevel@tonic-gate #define	DTRACE_PROBE1(provider, name, arg1) {				\
44*7c478bd9Sstevel@tonic-gate 	extern void __dtrace_##provider##___##name(unsigned long);	\
45*7c478bd9Sstevel@tonic-gate 	__dtrace_##provider##___##name((unsigned long)arg1);		\
46*7c478bd9Sstevel@tonic-gate }
47*7c478bd9Sstevel@tonic-gate 
48*7c478bd9Sstevel@tonic-gate #define	DTRACE_PROBE2(provider, name, arg1, arg2) {			\
49*7c478bd9Sstevel@tonic-gate 	extern void __dtrace_##provider##___##name(unsigned long,	\
50*7c478bd9Sstevel@tonic-gate 	    unsigned long);						\
51*7c478bd9Sstevel@tonic-gate 	__dtrace_##provider##___##name((unsigned long)arg1,		\
52*7c478bd9Sstevel@tonic-gate 	    (unsigned long)arg2);					\
53*7c478bd9Sstevel@tonic-gate }
54*7c478bd9Sstevel@tonic-gate 
55*7c478bd9Sstevel@tonic-gate #define	DTRACE_PROBE3(provider, name, arg1, arg2, arg3) {		\
56*7c478bd9Sstevel@tonic-gate 	extern void __dtrace_##provider##___##name(unsigned long,	\
57*7c478bd9Sstevel@tonic-gate 	    unsigned long, unsigned long);				\
58*7c478bd9Sstevel@tonic-gate 	__dtrace_##provider##___##name((unsigned long)arg1,		\
59*7c478bd9Sstevel@tonic-gate 	    (unsigned long)arg2, (unsigned long)arg3);			\
60*7c478bd9Sstevel@tonic-gate }
61*7c478bd9Sstevel@tonic-gate 
62*7c478bd9Sstevel@tonic-gate #define	DTRACE_PROBE4(provider, name, arg1, arg2, arg3, arg4) {		\
63*7c478bd9Sstevel@tonic-gate 	extern void __dtrace_##provider##___##name(unsigned long,	\
64*7c478bd9Sstevel@tonic-gate 	    unsigned long, unsigned long, unsigned long);		\
65*7c478bd9Sstevel@tonic-gate 	__dtrace_##provider##___##name((unsigned long)arg1,		\
66*7c478bd9Sstevel@tonic-gate 	    (unsigned long)arg2, (unsigned long)arg3,			\
67*7c478bd9Sstevel@tonic-gate 	    (unsigned long)arg4);					\
68*7c478bd9Sstevel@tonic-gate }
69*7c478bd9Sstevel@tonic-gate 
70*7c478bd9Sstevel@tonic-gate #define	DTRACE_PROBE5(provider, name, arg1, arg2, arg3, arg4, arg5) {	\
71*7c478bd9Sstevel@tonic-gate 	extern void __dtrace_##provider##___##name(unsigned long,	\
72*7c478bd9Sstevel@tonic-gate 	    unsigned long, unsigned long, unsigned long, unsigned long);\
73*7c478bd9Sstevel@tonic-gate 	__dtrace_##provider##___##name((unsigned long)arg1,		\
74*7c478bd9Sstevel@tonic-gate 	    (unsigned long)arg2, (unsigned long)arg3,			\
75*7c478bd9Sstevel@tonic-gate 	    (unsigned long)arg4, (unsigned long)arg5);			\
76*7c478bd9Sstevel@tonic-gate }
77*7c478bd9Sstevel@tonic-gate 
78*7c478bd9Sstevel@tonic-gate #else /* _KERNEL */
79*7c478bd9Sstevel@tonic-gate 
80*7c478bd9Sstevel@tonic-gate #define	DTRACE_PROBE(name)	{					\
81*7c478bd9Sstevel@tonic-gate 	extern void __dtrace_probe_##name(void);			\
82*7c478bd9Sstevel@tonic-gate 	__dtrace_probe_##name();					\
83*7c478bd9Sstevel@tonic-gate }
84*7c478bd9Sstevel@tonic-gate 
85*7c478bd9Sstevel@tonic-gate #define	DTRACE_PROBE1(name, type1, arg1) {				\
86*7c478bd9Sstevel@tonic-gate 	extern void __dtrace_probe_##name(uintptr_t);			\
87*7c478bd9Sstevel@tonic-gate 	__dtrace_probe_##name((uintptr_t)(arg1));			\
88*7c478bd9Sstevel@tonic-gate }
89*7c478bd9Sstevel@tonic-gate 
90*7c478bd9Sstevel@tonic-gate #define	DTRACE_PROBE2(name, type1, arg1, type2, arg2) {			\
91*7c478bd9Sstevel@tonic-gate 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t);	\
92*7c478bd9Sstevel@tonic-gate 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2));	\
93*7c478bd9Sstevel@tonic-gate }
94*7c478bd9Sstevel@tonic-gate 
95*7c478bd9Sstevel@tonic-gate #define	DTRACE_PROBE3(name, type1, arg1, type2, arg2, type3, arg3) {	\
96*7c478bd9Sstevel@tonic-gate 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t, uintptr_t); \
97*7c478bd9Sstevel@tonic-gate 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2),	\
98*7c478bd9Sstevel@tonic-gate 	    (uintptr_t)(arg3));						\
99*7c478bd9Sstevel@tonic-gate }
100*7c478bd9Sstevel@tonic-gate 
101*7c478bd9Sstevel@tonic-gate #define	DTRACE_PROBE4(name, type1, arg1, type2, arg2, 			\
102*7c478bd9Sstevel@tonic-gate     type3, arg3, type4, arg4) {						\
103*7c478bd9Sstevel@tonic-gate 	extern void __dtrace_probe_##name(uintptr_t, uintptr_t,		\
104*7c478bd9Sstevel@tonic-gate 	    uintptr_t, uintptr_t);					\
105*7c478bd9Sstevel@tonic-gate 	__dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2),	\
106*7c478bd9Sstevel@tonic-gate 	    (uintptr_t)(arg3), (uintptr_t)(arg4));			\
107*7c478bd9Sstevel@tonic-gate }
108*7c478bd9Sstevel@tonic-gate 
109*7c478bd9Sstevel@tonic-gate #define	DTRACE_SCHED(name)						\
110*7c478bd9Sstevel@tonic-gate 	DTRACE_PROBE(__sched_##name);
111*7c478bd9Sstevel@tonic-gate 
112*7c478bd9Sstevel@tonic-gate #define	DTRACE_SCHED1(name, type1, arg1)				\
113*7c478bd9Sstevel@tonic-gate 	DTRACE_PROBE1(__sched_##name, type1, arg1);
114*7c478bd9Sstevel@tonic-gate 
115*7c478bd9Sstevel@tonic-gate #define	DTRACE_SCHED2(name, type1, arg1, type2, arg2)			\
116*7c478bd9Sstevel@tonic-gate 	DTRACE_PROBE2(__sched_##name, type1, arg1, type2, arg2);
117*7c478bd9Sstevel@tonic-gate 
118*7c478bd9Sstevel@tonic-gate #define	DTRACE_SCHED3(name, type1, arg1, type2, arg2, type3, arg3)	\
119*7c478bd9Sstevel@tonic-gate 	DTRACE_PROBE3(__sched_##name, type1, arg1, type2, arg2, type3, arg3);
120*7c478bd9Sstevel@tonic-gate 
121*7c478bd9Sstevel@tonic-gate #define	DTRACE_SCHED4(name, type1, arg1, type2, arg2, 			\
122*7c478bd9Sstevel@tonic-gate     type3, arg3, type4, arg4)						\
123*7c478bd9Sstevel@tonic-gate 	DTRACE_PROBE4(__sched_##name, type1, arg1, type2, arg2, 	\
124*7c478bd9Sstevel@tonic-gate 	    type3, arg3, type4, arg4);
125*7c478bd9Sstevel@tonic-gate 
126*7c478bd9Sstevel@tonic-gate #define	DTRACE_PROC(name)						\
127*7c478bd9Sstevel@tonic-gate 	DTRACE_PROBE(__proc_##name);
128*7c478bd9Sstevel@tonic-gate 
129*7c478bd9Sstevel@tonic-gate #define	DTRACE_PROC1(name, type1, arg1)					\
130*7c478bd9Sstevel@tonic-gate 	DTRACE_PROBE1(__proc_##name, type1, arg1);
131*7c478bd9Sstevel@tonic-gate 
132*7c478bd9Sstevel@tonic-gate #define	DTRACE_PROC2(name, type1, arg1, type2, arg2)			\
133*7c478bd9Sstevel@tonic-gate 	DTRACE_PROBE2(__proc_##name, type1, arg1, type2, arg2);
134*7c478bd9Sstevel@tonic-gate 
135*7c478bd9Sstevel@tonic-gate #define	DTRACE_PROC3(name, type1, arg1, type2, arg2, type3, arg3)	\
136*7c478bd9Sstevel@tonic-gate 	DTRACE_PROBE3(__proc_##name, type1, arg1, type2, arg2, type3, arg3);
137*7c478bd9Sstevel@tonic-gate 
138*7c478bd9Sstevel@tonic-gate #define	DTRACE_PROC4(name, type1, arg1, type2, arg2, 			\
139*7c478bd9Sstevel@tonic-gate     type3, arg3, type4, arg4)						\
140*7c478bd9Sstevel@tonic-gate 	DTRACE_PROBE4(__proc_##name, type1, arg1, type2, arg2, 		\
141*7c478bd9Sstevel@tonic-gate 	    type3, arg3, type4, arg4);
142*7c478bd9Sstevel@tonic-gate 
143*7c478bd9Sstevel@tonic-gate #define	DTRACE_IO(name)							\
144*7c478bd9Sstevel@tonic-gate 	DTRACE_PROBE(__io_##name);
145*7c478bd9Sstevel@tonic-gate 
146*7c478bd9Sstevel@tonic-gate #define	DTRACE_IO1(name, type1, arg1)					\
147*7c478bd9Sstevel@tonic-gate 	DTRACE_PROBE1(__io_##name, type1, arg1);
148*7c478bd9Sstevel@tonic-gate 
149*7c478bd9Sstevel@tonic-gate #define	DTRACE_IO2(name, type1, arg1, type2, arg2)			\
150*7c478bd9Sstevel@tonic-gate 	DTRACE_PROBE2(__io_##name, type1, arg1, type2, arg2);
151*7c478bd9Sstevel@tonic-gate 
152*7c478bd9Sstevel@tonic-gate #define	DTRACE_IO3(name, type1, arg1, type2, arg2, type3, arg3)	\
153*7c478bd9Sstevel@tonic-gate 	DTRACE_PROBE3(__io_##name, type1, arg1, type2, arg2, type3, arg3);
154*7c478bd9Sstevel@tonic-gate 
155*7c478bd9Sstevel@tonic-gate #define	DTRACE_IO4(name, type1, arg1, type2, arg2, 			\
156*7c478bd9Sstevel@tonic-gate     type3, arg3, type4, arg4)						\
157*7c478bd9Sstevel@tonic-gate 	DTRACE_PROBE4(__io_##name, type1, arg1, type2, arg2, 		\
158*7c478bd9Sstevel@tonic-gate 	    type3, arg3, type4, arg4);
159*7c478bd9Sstevel@tonic-gate 
160*7c478bd9Sstevel@tonic-gate #endif /* _KERNEL */
161*7c478bd9Sstevel@tonic-gate 
162*7c478bd9Sstevel@tonic-gate extern const char *sdt_prefix;
163*7c478bd9Sstevel@tonic-gate 
164*7c478bd9Sstevel@tonic-gate typedef struct sdt_probedesc {
165*7c478bd9Sstevel@tonic-gate 	char			*sdpd_name;	/* name of this probe */
166*7c478bd9Sstevel@tonic-gate 	unsigned long		sdpd_offset;	/* offset of call in text */
167*7c478bd9Sstevel@tonic-gate 	struct sdt_probedesc	*sdpd_next;	/* next static probe */
168*7c478bd9Sstevel@tonic-gate } sdt_probedesc_t;
169*7c478bd9Sstevel@tonic-gate 
170*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
171*7c478bd9Sstevel@tonic-gate }
172*7c478bd9Sstevel@tonic-gate #endif
173*7c478bd9Sstevel@tonic-gate 
174*7c478bd9Sstevel@tonic-gate #endif	/* _SYS_SDT_H */
175