1/*
2 * Copyright (c) 2007-2021 Apple Inc. All rights reserved.
3 */
4/*
5 * CDDL HEADER START
6 *
7 * The contents of this file are subject to the terms of the
8 * Common Development and Distribution License, Version 1.0 only
9 * (the "License"). You may not use this file except in compliance
10 * with the License.
11 *
12 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
13 * or http://www.opensolaris.org/os/licensing.
14 * See the License for the specific language governing permissions
15 * and limitations under the License.
16 *
17 * When distributing Covered Code, include this CDDL HEADER in each
18 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
19 * If applicable, add the following below this CDDL HEADER, with the
20 * fields enclosed by brackets "[]" replaced with your own identifying
21 * information: Portions Copyright [yyyy] [name of copyright owner]
22 *
23 * CDDL HEADER END
24 */
25/*
26 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
27 * Use is subject to license terms.
28 */
29
30#ifndef _MACH_MACHINE_SYS_SDT_H
31#define _MACH_MACHINE_SYS_SDT_H
32
33#ifdef KERNEL
34
35#if CONFIG_DTRACE
36
37/*
38 * Include arch specific macro definitions for SDT probes.
39 * The argument types should be no greater than uintptr_t in size each.
40 * The behavior of larger types is undefined.
41 */
42#include <mach/machine/sdt_isa.h>
43
44#else
45
46#define DTRACE_PROBE(provider, name) do {} while(0)
47#define DTRACE_PROBE1(provider, name, arg0) do {} while(0)
48#define DTRACE_PROBE2(provider, name, arg0, arg1) do {} while(0)
49#define DTRACE_PROBE3(provider, name, arg0, arg1, arg2) do {} while(0)
50#define DTRACE_PROBE4(provider, name, arg0, arg1, arg2, arg3) do {} while(0)
51#define DTRACE_PROBE5(provider, name, arg0, arg1, arg2, arg3, arg4) do {} while(0)
52#define DTRACE_PROBE6(provider, name, arg0, arg1, arg2, arg3, arg4, arg5) do {} while(0)
53#define DTRACE_PROBE7(provider, name, arg0, arg1, arg2, arg3, arg4, arg5, arg6) do {} while(0)
54#define DTRACE_PROBE8(provider, name, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) do {} while(0)
55
56#endif /* CONFIG_DTRACE */
57
58#define DTRACE_SCHED(name) \
59 DTRACE_PROBE(__sched_, name);
60
61#define DTRACE_SCHED1(name, type1, arg1) \
62 DTRACE_PROBE1(__sched_, name, arg1);
63
64#define DTRACE_SCHED2(name, type1, arg1, type2, arg2) \
65 DTRACE_PROBE2(__sched_, name, arg1, arg2);
66
67#define DTRACE_SCHED3(name, type1, arg1, type2, arg2, type3, arg3) \
68 DTRACE_PROBE3(__sched_, name, arg1, arg2, arg3);
69
70#define DTRACE_SCHED4(name, type1, arg1, type2, arg2, \
71 type3, arg3, type4, arg4) \
72 DTRACE_PROBE4(__sched_, name, arg1, arg2, arg3, arg4);
73
74#define DTRACE_SCHED5(name, type1, arg1, type2, arg2, \
75 type3, arg3, type4, arg4, type5, arg5) \
76 DTRACE_PROBE5(__sched_, name, arg1, arg2, arg3, arg4, arg5, arg6);
77
78#define DTRACE_SCHED6(name, type1, arg1, type2, arg2, \
79 type3, arg3, type4, arg4, type5, arg5, type6, arg6) \
80 DTRACE_PROBE6(__sched_, name, arg1, arg2, arg3, arg4, arg5, arg6);
81
82#define DTRACE_PROC(name) \
83 DTRACE_PROBE(__proc_, name);
84
85#define DTRACE_PROC1(name, type1, arg1) \
86 DTRACE_PROBE1(__proc_, name, arg1);
87
88#define DTRACE_PROC2(name, type1, arg1, type2, arg2) \
89 DTRACE_PROBE2(__proc_, name, arg1, arg2);
90
91#define DTRACE_PROC3(name, type1, arg1, type2, arg2, type3, arg3) \
92 DTRACE_PROBE3(__proc_, name, arg1, arg2, arg3);
93
94#define DTRACE_PROC4(name, type1, arg1, type2, arg2, \
95 type3, arg3, type4, arg4) \
96 DTRACE_PROBE4(__proc_, name, arg1, arg2, arg3, arg4);
97
98#define DTRACE_IO(name) \
99 DTRACE_PROBE(__io_, name);
100
101#define DTRACE_IO1(name, type1, arg1) \
102 DTRACE_PROBE1(__io_, name, arg1);
103
104#define DTRACE_IO2(name, type1, arg1, type2, arg2) \
105 DTRACE_PROBE2(__io_, name, arg1, arg2);
106
107#define DTRACE_IO3(name, type1, arg1, type2, arg2, type3, arg3) \
108 DTRACE_PROBE3(__io_, name, arg1, arg2, arg3);
109
110#define DTRACE_IO4(name, type1, arg1, type2, arg2, \
111 type3, arg3, type4, arg4) \
112 DTRACE_PROBE4(__io_, name, arg1, arg2, arg3, arg4);
113
114#define DTRACE_INT5(name, type1, arg1, type2, arg2, \
115 type3, arg3, type4, arg4, type5, arg5) \
116 DTRACE_PROBE5(__sdt_, name, arg1, arg2, arg3, arg4, arg5);
117
118#define DTRACE_MEMORYSTATUS2(name, type1, arg1, type2, arg2) \
119 DTRACE_PROBE2(__sdt_, name, arg1, arg2);
120
121#define DTRACE_MEMORYSTATUS3(name, type1, arg1, type2, arg2, type3, arg3) \
122 DTRACE_PROBE3(__sdt_, name, arg1, arg2, arg3);
123
124#define DTRACE_MEMORYSTATUS4(name, type1, arg1, type2, arg2, type3, arg3, type4, arg4) \
125 DTRACE_PROBE4(__sdt_, name, arg1, arg2, arg3, arg4);
126
127#define DTRACE_MEMORYSTATUS6(name, type1, arg1, type2, arg2, \
128 type3, arg3, type4, arg4, type5, arg5, type6, arg6) \
129 DTRACE_PROBE6(__vminfo_, name, arg1, arg2, arg3, arg4, arg5, arg6)
130
131#define DTRACE_TMR3(name, type1, arg1, type2, arg2, type3, arg3) \
132 DTRACE_PROBE3(__sdt_, name, arg1, arg2, arg3);
133
134#define DTRACE_TMR4(name, type1, arg1, arg2, arg3, arg4) \
135 DTRACE_PROBE4(__sdt_, name, arg1, arg2, arg3, arg4);
136
137#define DTRACE_TMR5(name, type1, arg1, type2, arg2, type3, arg3, arg4, arg5) \
138 DTRACE_PROBE5(__sdt_, name, arg1, arg2, arg3, arg4, arg5);
139
140#define DTRACE_TMR6(name, type1, arg1, type2, arg2, type3, arg3, arg4, arg5, arg6) \
141 DTRACE_PROBE6(__sdt_, name, arg1, arg2, arg3, arg4, arg5, arg6);
142
143#define DTRACE_TMR7(name, type1, arg1, type2, arg2, type3, arg3, arg4, arg5, arg6, arg7) \
144 DTRACE_PROBE7(__sdt_, name, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
145
146#define DTRACE_PHYSLAT3(name, type1, arg1, type2, arg2, type3, arg3) \
147 DTRACE_PROBE3(__sdt_, name, arg1, arg2, arg3);
148
149#define DTRACE_PHYSLAT4(name, type1, arg1, type2, arg2, type3, arg3, type4, arg4) \
150 DTRACE_PROBE4(__sdt_, name, arg1, arg2, arg3, arg4);
151
152#define DTRACE_PHYSLAT5(name, type1, arg1, type2, arg2, type3, arg3, type4, arg4, type5, arg5) \
153 DTRACE_PROBE5(__sdt_, name, arg1, arg2, arg3, arg4, arg5);
154
155#define DTRACE_MACF(name) \
156 DTRACE_PROBE(__sdt_, name);
157
158#define DTRACE_MACF1(name, type1, arg1) \
159 DTRACE_PROBE1(__sdt_, name, arg1);
160
161#define DTRACE_MACF2(name, type1, arg1, type2, arg2) \
162 DTRACE_PROBE2(__sdt_, name, arg1, arg2);
163
164#define DTRACE_MACF3(name, type1, arg1, type2, arg2, type3, arg3) \
165 DTRACE_PROBE3(__sdt_, name, arg1, arg2, arg3);
166
167#define DTRACE_VM(name) \
168 DTRACE_PROBE(__vminfo_, name)
169
170#define DTRACE_VM1(name, type1, arg1) \
171 DTRACE_PROBE1(__vminfo_, name, arg1)
172
173#define DTRACE_VM2(name, type1, arg1, type2, arg2) \
174 DTRACE_PROBE2(__vminfo_, name, arg1, arg2)
175
176#define DTRACE_VM3(name, type1, arg1, type2, arg2, type3, arg3) \
177 DTRACE_PROBE3(__vminfo_, name, arg1, arg2, arg3)
178
179#define DTRACE_VM4(name, type1, arg1, type2, arg2, \
180 type3, arg3, type4, arg4) \
181 DTRACE_PROBE4(__vminfo_, name, arg1, arg2, arg3, arg4)
182
183#define DTRACE_VM5(name, type1, arg1, type2, arg2, \
184 type3, arg3, type4, arg4, type5, arg5) \
185 DTRACE_PROBE5(__vminfo_, name, arg1, arg2, arg3, arg4, arg5)
186
187#define DTRACE_VM6(name, type1, arg1, type2, arg2, \
188 type3, arg3, type4, arg4, type5, arg5, type6, arg6) \
189 DTRACE_PROBE6(__vminfo_, name, arg1, arg2, arg3, arg4, arg5, arg6)
190
191#define DTRACE_VM7(name, type1, arg1, type2, arg2, \
192 type3, arg3, type4, arg4, type5, arg5, type6, arg6, type7, arg7) \
193 DTRACE_PROBE7(__vminfo_, name, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
194
195#define DTRACE_VM8(name, type1, arg1, type2, arg2, \
196 type3, arg3, type4, arg4, type5, arg5, type6, arg6, type7, arg7, type8, arg8) \
197 DTRACE_PROBE8(__vminfo_, name, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
198
199#define DTRACE_IP(name) \
200 DTRACE_PROBE(__ip_, name)
201
202#define DTRACE_IP1(name, type1, arg1) \
203 DTRACE_PROBE1(__ip_, name, arg1)
204
205#define DTRACE_IP2(name, type1, arg1, type2, arg2) \
206 DTRACE_PROBE2(__ip_, name, arg1, arg2)
207
208#define DTRACE_IP3(name, type1, arg1, type2, arg2, type3, arg3) \
209 DTRACE_PROBE3(__ip_, name, arg1, arg2, arg3)
210
211#define DTRACE_IP4(name, type1, arg1, type2, arg2, \
212 type3, arg3, type4, arg4) \
213 DTRACE_PROBE4(__ip_, name, arg1, arg2, arg3, arg4)
214
215#define DTRACE_IP5(name, typ1, arg1, type2, arg2, type3, arg3, \
216 type4, arg4, type5, arg5) \
217 DTRACE_PROBE5(__ip_, name, arg1, arg2, arg3, arg4, arg5)
218
219#define DTRACE_IP6(name, type1, arg1, type2, arg2, type3, arg3, \
220 type4, arg4, type5, arg5, type6, arg6) \
221 DTRACE_PROBE6(__ip_, name, arg1, arg2, arg3, arg4, arg5, arg6)
222
223#define DTRACE_IP7(name, type1, arg1, type2, arg2, type3, arg3, \
224 type4, arg4, type5, arg5, type6, arg6, type7, arg7) \
225 DTRACE_PROBE7(__ip_, name, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
226
227#define DTRACE_ROUTE(name) \
228 DTRACE_PROBE(__route_, name)
229
230#define DTRACE_ROUTE1(name, type1, arg1) \
231 DTRACE_PROBE1(__route_, name, arg1)
232
233#define DTRACE_ROUTE2(name, type1, arg1, type2, arg2) \
234 DTRACE_PROBE2(__route_, name, arg1, arg2)
235
236#define DTRACE_ROUTE3(name, type1, arg1, type2, arg2, type3, arg3) \
237 DTRACE_PROBE3(__route_, name, arg1, arg2, arg3)
238
239#define DTRACE_ROUTE4(name, type1, arg1, type2, arg2, \
240 type3, arg3, type4, arg4) \
241 DTRACE_PROBE4(__route_, name, arg1, arg2, arg3, arg4)
242
243#define DTRACE_ROUTE5(name, typ1, arg1, type2, arg2, type3, arg3, \
244 type4, arg4, type5, arg5) \
245 DTRACE_PROBE5(__route_, name, arg1, arg2, arg3, arg4, arg5)
246
247#define DTRACE_ROUTE6(name, type1, arg1, type2, arg2, type3, arg3, \
248 type4, arg4, type5, arg5, type6, arg6) \
249 DTRACE_PROBE6(__route_, name, arg1, arg2, arg3, arg4, arg5, arg6)
250
251#define DTRACE_ROUTE7(name, type1, arg1, type2, arg2, type3, arg3, \
252 type4, arg4, type5, arg5, type6, arg6, type7, arg7) \
253 DTRACE_PROBE7(__route_, name, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
254
255#define DTRACE_TCP(name) \
256 DTRACE_PROBE(__tcp_, name)
257
258#define DTRACE_TCP1(name, type1, arg1) \
259 DTRACE_PROBE1(__tcp_, name, arg1)
260
261#define DTRACE_TCP2(name, type1, arg1, type2, arg2) \
262 DTRACE_PROBE2(__tcp_, name, arg1, arg2)
263
264#define DTRACE_TCP3(name, type1, arg1, type2, arg2, type3, arg3) \
265 DTRACE_PROBE3(__tcp_, name, arg1, arg2, arg3)
266
267#define DTRACE_TCP4(name, type1, arg1, type2, arg2, \
268 type3, arg3, type4, arg4) \
269 DTRACE_PROBE4(__tcp_, name, arg1, arg2, arg3, arg4)
270
271#define DTRACE_TCP5(name, typ1, arg1, type2, arg2, type3, arg3, \
272 type4, arg4, type5, arg5) \
273 DTRACE_PROBE5(__tcp_, name, arg1, arg2, arg3, arg4, arg5)
274
275#define DTRACE_MPTCP(name) \
276 DTRACE_PROBE(__mptcp_, name)
277
278#define DTRACE_MPTCP1(name, type1, arg1) \
279 DTRACE_PROBE1(__mptcp_, name, arg1)
280
281#define DTRACE_MPTCP2(name, type1, arg1, type2, arg2) \
282 DTRACE_PROBE2(__mptcp_, name, arg1, arg2)
283
284#define DTRACE_MPTCP3(name, type1, arg1, type2, arg2, type3, arg3) \
285 DTRACE_PROBE3(__mptcp_, name, arg1, arg2, arg3)
286
287#define DTRACE_MPTCP4(name, type1, arg1, type2, arg2, \
288 type3, arg3, type4, arg4) \
289 DTRACE_PROBE4(__mptcp_, name, arg1, arg2, arg3, arg4)
290
291#define DTRACE_MPTCP5(name, typ1, arg1, type2, arg2, type3, arg3, \
292 type4, arg4, type5, arg5) \
293 DTRACE_PROBE5(__mptcp_, name, arg1, arg2, arg3, arg4, arg5)
294
295#define DTRACE_MPTCP6(name, typ1, arg1, type2, arg2, type3, arg3, \
296 type4, arg4, type5, arg5, type6, arg6) \
297 DTRACE_PROBE6(__mptcp_, name, arg1, arg2, arg3, arg4, arg5, arg6)
298
299#define DTRACE_MPTCP7(name, typ1, arg1, type2, arg2, type3, arg3, \
300 type4, arg4, type5, arg5, type6, arg6, \
301 type7, arg7) \
302 DTRACE_PROBE7(__mptcp_, name, arg1, arg2, arg3, arg4, arg5, \
303 arg6, arg7)
304
305#define DTRACE_FSINFO(name, type, vp) \
306 DTRACE_PROBE1(__fsinfo_, name, vp)
307
308#define DTRACE_FSINFO_IO(name, type1, vp, type2, size) \
309 DTRACE_PROBE2(__fsinfo_, name, vp, size)
310
311#define DTRACE_BOOST(name) \
312 DTRACE_PROBE(__boost_, name);
313
314#define DTRACE_BOOST1(name, type1, arg1) \
315 DTRACE_PROBE1(__boost_, name, arg1);
316
317#define DTRACE_BOOST2(name, type1, arg1, type2, arg2) \
318 DTRACE_PROBE2(__boost_, name, arg1, arg2);
319
320#define DTRACE_BOOST3(name, type1, arg1, type2, arg2, type3, arg3) \
321 DTRACE_PROBE3(__boost_, name, arg1, arg2, arg3);
322
323#define DTRACE_BOOST4(name, type1, arg1, type2, arg2, \
324 type3, arg3, type4, arg4) \
325 DTRACE_PROBE4(__boost_, name, arg1, arg2, arg3, arg4);
326
327#define DTRACE_BOOST5(name, type1, arg1, type2, arg2, \
328 type3, arg3, type4, arg4, type5, arg5) \
329 DTRACE_PROBE5(__boost_, name, arg1, arg2, arg3, arg4, arg5);
330
331#define DTRACE_BOOST6(name, type1, arg1, type2, arg2, \
332 type3, arg3, type4, arg4, type5, arg5, type6, arg6) \
333 DTRACE_PROBE6(__boost_, name, arg1, arg2, arg3, arg4, arg5, arg6);
334
335#if KASAN
336#define DTRACE_KASAN(name) \
337 DTRACE_PROBE(__kasan_, name);
338
339#define DTRACE_KASAN1(name, type1, arg1) \
340 DTRACE_PROBE1(__kasan_, name, arg1);
341
342#define DTRACE_KASAN2(name, type1, arg1, type2, arg2) \
343 DTRACE_PROBE2(__kasan_, name, arg1, arg2);
344
345#define DTRACE_KASAN3(name, type1, arg1, type2, arg2, type3, arg3) \
346 DTRACE_PROBE3(__kasan_, name, arg1, arg2, arg3);
347
348#define DTRACE_KASAN4(name, type1, arg1, type2, arg2, \
349 type3, arg3, type4, arg4) \
350 DTRACE_PROBE4(__kasan_, name, arg1, arg2, arg3, arg4);
351
352#define DTRACE_KASAN5(name, type1, arg1, type2, arg2, \
353 type3, arg3, type4, arg4, type5, arg5) \
354 DTRACE_PROBE5(__kasan_, name, arg1, arg2, arg3, arg4, arg5);
355#endif /* KASAN */
356
357#if PRIVATE
358#define DTRACE_SKYWALK(name) \
359 DTRACE_PROBE(__skywalk_, name)
360
361#define DTRACE_SKYWALK1(name, type1, arg1) \
362 DTRACE_PROBE1(__skywalk_, name, arg1)
363
364#define DTRACE_SKYWALK2(name, type1, arg1, type2, arg2) \
365 DTRACE_PROBE2(__skywalk_, name, arg1, arg2)
366
367#define DTRACE_SKYWALK3(name, type1, arg1, type2, arg2, type3, arg3) \
368 DTRACE_PROBE3(__skywalk_, name, arg1, arg2, arg3)
369
370#define DTRACE_SKYWALK4(name, type1, arg1, type2, arg2, type3, arg3, \
371 type4, arg4) \
372 DTRACE_PROBE4(__skywalk_, name, arg1, arg2, arg3, arg4)
373
374#define DTRACE_SKYWALK5(name, type1, arg1, type2, arg2, type3, arg3, \
375 type4, arg4, type5, arg5) \
376 DTRACE_PROBE5(__skywalk_, name, arg1, arg2, arg3, arg4, arg5)
377
378#define DTRACE_SKYWALK6(name, type1, arg1, type2, arg2, type3, arg3, \
379 type4, arg4, type5, arg5, type6, arg6) \
380 DTRACE_PROBE6(__skywalk_, name, arg1, arg2, arg3, arg4, arg5, arg6)
381
382#define DTRACE_SKYWALK7(name, type1, arg1, type2, arg2, type3, arg3, \
383 type4, arg4, type5, arg5, type6, arg6, type7, arg7) \
384 DTRACE_PROBE7(__skywalk_, name, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
385
386#define DTRACE_SKYWALK8(name, type1, arg1, type2, arg2, type3, arg3, \
387 type4, arg4, type5, arg5, type6, arg6, type7, arg7, type8, arg8) \
388 DTRACE_PROBE8(__skywalk_, name, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
389
390#endif /* PRIVATE */
391
392#ifdef PRIVATE
393#define DTRACE_KCOV1(name, type1, arg1) \
394 DTRACE_PROBE1(__kcov_, name, arg1)
395
396#endif /* PRIVATE */
397
398#ifdef PRIVATE
399
400/*
401 * The AppleHV kext uses its own variants of these macros to avoid storing
402 * arguments as intermediate values on the stack (to lessen the overhead).
403 * If/When the mechanism by which SDT probes are generated changes, AppleHV
404 * should be updated too.
405 */
406#define DTRACE_HV(name) \
407 DTRACE_PROBE(__hv_, name)
408
409#define DTRACE_HV1(name, type1, arg1) \
410 DTRACE_PROBE1(__hv_, name, arg1)
411
412#define DTRACE_HV2(name, type1, arg1, type2, arg2) \
413 DTRACE_PROBE2(__hv_, name, arg1, arg2)
414
415#define DTRACE_HV3(name, type1, arg1, type2, arg2, type3, arg3) \
416 DTRACE_PROBE3(__hv_, name, arg1, arg2, arg3)
417
418#define DTRACE_HV4(name, type1, arg1, type2, arg2, type3, arg3, \
419 type4, arg4) \
420 DTRACE_PROBE4(__hv_, name, arg1, arg2, arg3, arg4)
421
422#define DTRACE_HV5(name, type1, arg1, type2, arg2, type3, arg3, \
423 type4, arg4, type5, arg5) \
424 DTRACE_PROBE5(__hv_, name, arg1, arg2, arg3, arg4, arg5)
425
426#define DTRACE_HV6(name, type1, arg1, type2, arg2, type3, arg3, \
427 type4, arg4, type5, arg5, type6, arg6) \
428 DTRACE_PROBE6(__hv_, name, arg1, arg2, arg3, arg4, arg5, arg6)
429#endif /* PRIVATE */
430
431#endif /* KERNEL */
432
433#endif /* _MACH_MACHINE_SYS_SDT_H */
434