]>
git.saurik.com Git - apple/xnu.git/blob - osfmk/mach/ppc/sdt_isa.h
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
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.
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]
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef _MACH_PPC_SDT_ISA_H
28 #define _MACH_PPC_SDT_ISA_H
30 /* #pragma ident "@(#)sdt.h 1.7 05/06/08 SMI" */
33 * Only define when testing. This makes the calls into actual calls to
36 /* #define DTRACE_CALL_TEST */
38 #define DTRACE_STRINGIFY(s) #s
39 #define DTRACE_TOSTRING(s) DTRACE_STRINGIFY(s)
43 * For the kernel, set an explicit global label so the symbol can be located
45 #define DTRACE_LAB(p, n) \
46 "__dtrace_probe$" DTRACE_TOSTRING(__LINE__) DTRACE_STRINGIFY(_##p##___##n)
47 #define DTRACE_LABEL(p, n) \
48 ".section __DATA, __data\n\t" \
49 ".globl " DTRACE_LAB(p, n) "\n\t" \
50 DTRACE_LAB(p, n) ":" ".long 1f""\n\t" \
54 #define DTRACE_LABEL(p, n) \
55 "__dtrace_probe$" DTRACE_TOSTRING(__LINE__) DTRACE_STRINGIFY(_##p##___##n) ":" "\n\t"
58 #ifdef DTRACE_CALL_TEST
60 #define DTRACE_CALL(p,n) \
64 #else /* !DTRACE_CALL_TEST */
66 #define DTRACE_CALL(p,n) \
70 #endif /* !DTRACE_CALL_TEST */
77 #define DTRACE_CALL_INSN(p,n) \
78 "bl _dtracetest" DTRACE_STRINGIFY(_##p##_##n) "\n\t"
81 #define ARGS2_EXTENT 2
82 #define ARGS3_EXTENT 3
83 #define ARGS4_EXTENT 4
84 #define ARGS5_EXTENT 5
85 #define ARGS6_EXTENT 6
86 #define ARGS7_EXTENT 7
87 #define ARGS8_EXTENT 8
88 #define ARGS9_EXTENT 9
89 #define ARGS10_EXTENT 10
91 #define DTRACE_CALL0ARGS(provider, name) \
93 DTRACE_CALL(provider, name) \
94 "# eat trailing nl+tab from DTRACE_CALL" \
99 #define DTRACE_CALL1ARG(provider, name) \
100 asm volatile ("subi r1,r1,0x20" "\n\t" \
101 "lwz r3,0x0(%0)" "\n\t" \
102 DTRACE_CALL(provider, name) \
105 : "b" (__dtrace_args) \
109 #define DTRACE_CALL2ARGS(provider, name) \
110 asm volatile ("subi r1,r1,0x20" "\n\t" \
111 "lwz r3,0x0(%0)" "\n\t" \
112 "lwz r4,0x4(%0)" "\n\t" \
113 DTRACE_CALL(provider, name) \
116 : "b" (__dtrace_args) \
117 : "memory", "r3", "r4" \
120 #define DTRACE_CALL3ARGS(provider, name) \
121 asm volatile ("subi r1,r1,0x30" "\n\t" \
122 "lwz r3,0x0(%0)" "\n\t" \
123 "lwz r4,0x4(%0)" "\n\t" \
124 "lwz r5,0x8(%0)" "\n\t" \
125 DTRACE_CALL(provider, name) \
128 : "b" (__dtrace_args) \
129 : "memory", "r3", "r4", "r5" \
132 #define DTRACE_CALL4ARGS(provider, name) \
133 asm volatile ("subi r1,r1,0x30" "\n\t" \
134 "lwz r3,0x0(%0)" "\n\t" \
135 "lwz r4,0x4(%0)" "\n\t" \
136 "lwz r5,0x8(%0)" "\n\t" \
137 "lwz r6,0xc(%0)" "\n\t" \
138 DTRACE_CALL(provider, name) \
141 : "b" (__dtrace_args) \
142 : "memory", "r3", "r4", "r5", "r6" \
145 #define DTRACE_CALL5ARGS(provider, name) \
146 asm volatile ("subi r1,r1,0x30" "\n\t" \
147 "lwz r3,0x0(%0)" "\n\t" \
148 "lwz r4,0x4(%0)" "\n\t" \
149 "lwz r5,0x8(%0)" "\n\t" \
150 "lwz r6,0xc(%0)" "\n\t" \
151 "lwz r7,0x10(%0)" "\n\t" \
152 DTRACE_CALL(provider, name) \
155 : "b" (__dtrace_args) \
156 : "memory", "r3", "r4", "r5", "r6", "r7" \
159 #define DTRACE_CALL6ARGS(provider, name) \
160 asm volatile ("subi r1,r1,0x30" "\n\t" \
161 "lwz r3,0x0(%0)" "\n\t" \
162 "lwz r4,0x4(%0)" "\n\t" \
163 "lwz r5,0x8(%0)" "\n\t" \
164 "lwz r6,0xc(%0)" "\n\t" \
165 "lwz r7,0x10(%0)" "\n\t" \
166 "lwz r8,0x14(%0)" "\n\t" \
167 DTRACE_CALL(provider, name) \
170 : "b" (__dtrace_args) \
171 : "memory", "r3", "r4", "r5", "r6", "r7", "r8" \
174 #define DTRACE_CALL7ARGS(provider, name) \
175 asm volatile ("subi r1,r1,0x40" "\n\t" \
176 "lwz r3,0x0(%0)" "\n\t" \
177 "lwz r4,0x4(%0)" "\n\t" \
178 "lwz r5,0x8(%0)" "\n\t" \
179 "lwz r6,0xc(%0)" "\n\t" \
180 "lwz r7,0x10(%0)" "\n\t" \
181 "lwz r8,0x14(%0)" "\n\t" \
182 "lwz r9,0x18(%0)" "\n\t" \
183 DTRACE_CALL(provider, name) \
186 : "b" (__dtrace_args) \
187 : "memory", "r3", "r4", "r5", "r6", "r7", "r8", "r9" \
190 #define DTRACE_CALL8ARGS(provider, name) \
191 asm volatile ("subi r1,r1,0x40" "\n\t" \
192 "lwz r3,0x0(%0)" "\n\t" \
193 "lwz r4,0x4(%0)" "\n\t" \
194 "lwz r5,0x8(%0)" "\n\t" \
195 "lwz r6,0xc(%0)" "\n\t" \
196 "lwz r7,0x10(%0)" "\n\t" \
197 "lwz r8,0x14(%0)" "\n\t" \
198 "lwz r9,0x18(%0)" "\n\t" \
199 "lwz r10,0x1c(%0)" "\n\t" \
200 DTRACE_CALL(provider, name) \
203 : "b" (__dtrace_args) \
204 : "memory", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10" \
207 #define DTRACE_CALL9ARGS(provider, name) \
208 asm volatile ("subi r1,r1,0x40" "\n\t" \
209 "lwz r3,0x0(%0)" "\n\t" \
210 "lwz r4,0x4(%0)" "\n\t" \
211 "lwz r5,0x8(%0)" "\n\t" \
212 "lwz r6,0xc(%0)" "\n\t" \
213 "lwz r7,0x10(%0)" "\n\t" \
214 "lwz r8,0x14(%0)" "\n\t" \
215 "lwz r9,0x18(%0)" "\n\t" \
216 "lwz r10,0x1c(%0)" "\n\t" \
217 "lwz r11,0x20(%0)" "\n\t" \
218 "stw r11,0x38(r1)" "\n\t" \
219 DTRACE_CALL(provider, name) \
222 : "b" (__dtrace_args) \
223 : "memory", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11" \
226 #define DTRACE_CALL10ARGS(provider, name) \
227 asm volatile ("subi r1,r1,0x40" "\n\t" \
228 "lwz r3,0x0(%0)" "\n\t" \
229 "lwz r4,0x4(%0)" "\n\t" \
230 "lwz r5,0x8(%0)" "\n\t" \
231 "lwz r6,0xc(%0)" "\n\t" \
232 "lwz r7,0x10(%0)" "\n\t" \
233 "lwz r8,0x14(%0)" "\n\t" \
234 "lwz r9,0x18(%0)" "\n\t" \
235 "lwz r10,0x1c(%0)" "\n\t" \
236 "lwz r11,0x20(%0)" "\n\t" \
237 "lwz r12,0x24(%0)" "\n\t" \
238 "stw r11,0x38(r1)" "\n\t" \
239 "stw r12,0x3c(r1)" "\n\t" \
240 DTRACE_CALL(provider, name) \
243 : "b" (__dtrace_args) \
244 : "memory", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" \
251 #define DTRACE_NOPS \
254 #define DTRACE_CALL_INSN(p,n) \
255 "bl _dtracetest" DTRACE_STRINGIFY(_##p##_##n) "\n\t"
257 #define ARG1_EXTENT 1
258 #define ARGS2_EXTENT 2
259 #define ARGS3_EXTENT 3
260 #define ARGS4_EXTENT 4
261 #define ARGS5_EXTENT 5
262 #define ARGS6_EXTENT 6
263 #define ARGS7_EXTENT 7
264 #define ARGS8_EXTENT 8
265 #define ARGS9_EXTENT 9
266 #define ARGS10_EXTENT 10
268 #define DTRACE_CALL0ARGS(provider, name) \
269 asm volatile ("subi r1,r1,0x30" "\n\t" \
270 DTRACE_CALL(provider, name) \
277 #define DTRACE_CALL1ARG(provider, name) \
278 asm volatile ("ld r3,0x0(%0)" "\n\t" \
279 "subi r1,r1,0x38" "\n\t" \
280 DTRACE_CALL(provider, name) \
283 : "b" (__dtrace_args) \
287 #define DTRACE_CALL2ARGS(provider, name) \
288 asm volatile ("subi r1,r1,0x40" "\n\t" \
289 "ld r3,0x0(%0)" "\n\t" \
290 "ld r4,0x8(%0)" "\n\t" \
291 DTRACE_CALL(provider, name) \
294 : "b" (__dtrace_args) \
295 : "memory", "r3", "r4" \
298 #define DTRACE_CALL3ARGS(provider, name) \
299 asm volatile ("subi r1,r1,0x48" "\n\t" \
300 "ld r3,0x0(%0)" "\n\t" \
301 "ld r4,0x8(%0)" "\n\t" \
302 "ld r5,0x10(%0)" "\n\t" \
303 DTRACE_CALL(provider, name) \
306 : "b" (__dtrace_args) \
307 : "memory", "r3", "r4", "r5" \
310 #define DTRACE_CALL4ARGS(provider, name) \
311 asm volatile ("subi r1,r1,0x50" "\n\t" \
312 "ld r3,0x0(%0)" "\n\t" \
313 "ld r4,0x8(%0)" "\n\t" \
314 "ld r5,0x10(%0)" "\n\t" \
315 "ld r6,0x18(%0)" "\n\t" \
316 DTRACE_CALL(provider, name) \
319 : "b" (__dtrace_args) \
320 : "memory", "r3", "r4", "r5", "r6" \
323 #define DTRACE_CALL5ARGS(provider, name) \
324 asm volatile ("subi r1,r1,0x58" "\n\t" \
325 "ld r3,0x0(%0)" "\n\t" \
326 "ld r4,0x8(%0)" "\n\t" \
327 "ld r5,0x10(%0)" "\n\t" \
328 "ld r6,0x18(%0)" "\n\t" \
329 "ld r7,0x20(%0)" "\n\t" \
330 DTRACE_CALL(provider, name) \
333 : "b" (__dtrace_args) \
334 : "memory", "r3", "r4", "r5", "r6", "r7" \
337 #define DTRACE_CALL6ARGS(provider, name) \
338 asm volatile ("subi r1,r1,0x60" "\n\t" \
339 "ld r3,0x0(%0)" "\n\t" \
340 "ld r4,0x8(%0)" "\n\t" \
341 "ld r5,0x10(%0)" "\n\t" \
342 "ld r6,0x18(%0)" "\n\t" \
343 "ld r7,0x20(%0)" "\n\t" \
344 "ld r8,0x28(%0)" "\n\t" \
345 DTRACE_CALL(provider, name) \
348 : "b" (__dtrace_args) \
349 : "memory", "r3", "r4", "r5", "r6", "r7", "r8" \
352 #define DTRACE_CALL7ARGS(provider, name) \
353 asm volatile ("subi r1,r1,0x68" "\n\t" \
354 "ld r3,0x0(%0)" "\n\t" \
355 "ld r4,0x8(%0)" "\n\t" \
356 "ld r5,0x10(%0)" "\n\t" \
357 "ld r6,0x18(%0)" "\n\t" \
358 "ld r7,0x20(%0)" "\n\t" \
359 "ld r8,0x28(%0)" "\n\t" \
360 "ld r9,0x30(%0)" "\n\t" \
361 DTRACE_CALL(provider, name) \
364 : "b" (__dtrace_args) \
365 : "memory", "r3", "r4", "r5", "r6", "r7", "r8", "r9" \
368 #define DTRACE_CALL8ARGS(provider, name) \
369 asm volatile ("subi r1,r1,0x70" "\n\t" \
370 "ld r3,0x0(%0)" "\n\t" \
371 "ld r4,0x8(%0)" "\n\t" \
372 "ld r5,0x10(%0)" "\n\t" \
373 "ld r6,0x18(%0)" "\n\t" \
374 "ld r7,0x20(%0)" "\n\t" \
375 "ld r8,0x28(%0)" "\n\t" \
376 "ld r9,0x30(%0)" "\n\t" \
377 "ld r10,0x38(%0)" "\n\t" \
378 DTRACE_CALL(provider, name) \
381 : "b" (__dtrace_args) \
382 : "memory", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10" \
385 #define DTRACE_CALL9ARGS(provider, name) \
386 asm volatile ("subi r1,r1,0x78" "\n\t" \
387 "ld r3,0x0(%0)" "\n\t" \
388 "ld r4,0x8(%0)" "\n\t" \
389 "ld r5,0x10(%0)" "\n\t" \
390 "ld r6,0x18(%0)" "\n\t" \
391 "ld r7,0x20(%0)" "\n\t" \
392 "ld r8,0x28(%0)" "\n\t" \
393 "ld r9,0x30(%0)" "\n\t" \
394 "ld r10,0x38(%0)" "\n\t" \
395 "ld r11,0x40(%0)" "\n\t" \
396 "std r11,0x70(r1)" "\n\t" \
397 DTRACE_CALL(provider, name) \
400 : "b" (__dtrace_args) \
401 : "memory", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11" \
404 #define DTRACE_CALL10ARGS(provider, name) \
405 asm volatile ("subi r1,r1,0x80" "\n\t" \
406 "ld r3,0x0(%0)" "\n\t" \
407 "ld r4,0x8(%0)" "\n\t" \
408 "ld r5,0x10(%0)" "\n\t" \
409 "ld r6,0x18(%0)" "\n\t" \
410 "ld r7,0x20(%0)" "\n\t" \
411 "ld r8,0x28(%0)" "\n\t" \
412 "ld r9,0x30(%0)" "\n\t" \
413 "ld r10,0x38(%0)" "\n\t" \
414 "ld r11,0x40(%0)" "\n\t" \
415 "ld r12,0x48(%0)" "\n\t" \
416 "std r11,0x70(r1)" "\n\t" \
417 "std r12,0x78(r1)" "\n\t" \
418 DTRACE_CALL(provider, name) \
421 : "b" (__dtrace_args) \
422 : "memory", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" \
427 #endif /* _MACH_PPC_SDT_ISA_H */