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