Chameleon

Chameleon Svn Source Tree

Root/branches/cparm/i386/modules/include/mach/i386/sdt_isa.h

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 _MACH_I386_SDT_ISA_H
28#define_MACH_I386_SDT_ISA_H
29
30/*
31 * Only define when testing. This makes the calls into actual calls to
32 * test functions.
33 */
34/* #define DTRACE_CALL_TEST */
35
36#define DTRACE_STRINGIFY(s) #s
37#define DTRACE_TOSTRING(s) DTRACE_STRINGIFY(s)
38#define DTRACE_LABEL(p, n)\
39"__dtrace_probe$" DTRACE_TOSTRING(%=__LINE__) DTRACE_STRINGIFY(_##p##___##n) ":""\n\t"
40
41#ifdef DTRACE_CALL_TEST
42
43#define DTRACE_CALL(p,n)\
44DTRACE_LABEL(p,n)\
45DTRACE_CALL_INSN(p,n)
46
47#else
48
49#define DTRACE_CALL(p,n)\
50DTRACE_LABEL(p,n)\
51DTRACE_NOPS
52
53#endif
54
55#ifdef __x86_64__
56
57#define DTRACE_NOPS\
58"nop""\n\t"\
59"nop""\n\t"\
60"nop""\n\t"
61
62#define DTRACE_CALL_INSN(p,n)\
63"call _dtracetest" DTRACE_STRINGIFY(_##p##_##n)"\n\t"
64
65#define ARG1_EXTENT1
66#define ARGS2_EXTENT2
67#define ARGS3_EXTENT3
68#define ARGS4_EXTENT4
69#define ARGS5_EXTENT5
70#define ARGS6_EXTENT6
71#define ARGS7_EXTENT7
72#define ARGS8_EXTENT8
73#define ARGS9_EXTENT10
74#define ARGS10_EXTENT10
75
76#define DTRACE_CALL0ARGS(provider, name)\
77asm volatile (\
78 DTRACE_CALL(provider, name)\
79 :\
80 :\
81);
82
83#define DTRACE_CALL1ARG(provider, name)\
84asm volatile ("movq\t0x0(%0),%%rdi""\n\t"\
85 DTRACE_CALL(provider, name)\
86 :\
87 : "r" (__dtrace_args)\
88 : "memory", "rdi"\
89);
90
91#define DTRACE_CALL2ARGS(provider, name)\
92asm volatile ("movq\t0x0(%0),%%rdi""\n\t"\
93 "movq\t0x8(%0),%%rsi""\n\t"\
94 DTRACE_CALL(provider, name)\
95 :\
96 : "r" (__dtrace_args)\
97 : "memory", "rdi", "rsi"\
98);
99
100#define DTRACE_CALL3ARGS(provider, name)\
101asm volatile ("movq\t0x0(%0),%%rdi""\n\t"\
102 "movq\t0x8(%0),%%rsi""\n\t"\
103 "movq\t0x10(%0),%%rdx""\n\t"\
104 DTRACE_CALL(provider, name)\
105 :\
106 : "r" (__dtrace_args)\
107 : "memory", "rdi", "rsi", "rdx"\
108);
109
110#define DTRACE_CALL4ARGS(provider, name)\
111asm volatile ("movq\t0x0(%0),%%rdi""\n\t"\
112 "movq\t0x8(%0),%%rsi""\n\t"\
113 "movq\t0x10(%0),%%rdx""\n\t"\
114 "movq\t0x18(%0),%%rcx""\n\t"\
115 DTRACE_CALL(provider, name)\
116 :\
117 : "r" (__dtrace_args)\
118 : "memory", "rdi", "rsi", "rdx", "rcx"\
119);
120
121#define DTRACE_CALL5ARGS(provider, name)\
122asm volatile ("movq\t0x0(%0),%%rdi""\n\t"\
123 "movq\t0x8(%0),%%rsi""\n\t"\
124 "movq\t0x10(%0),%%rdx""\n\t"\
125 "movq\t0x18(%0),%%rcx""\n\t"\
126 "movq\t0x20(%0),%%r8""\n\t"\
127 DTRACE_CALL(provider, name)\
128 :\
129 : "r" (__dtrace_args)\
130 : "memory", "rdi", "rsi", "rdx", "rcx", "r8"\
131);
132
133#define DTRACE_CALL6ARGS(provider, name)\
134asm volatile ("movq\t0x0(%0),%%rdi""\n\t"\
135 "movq\t0x8(%0),%%rsi""\n\t"\
136 "movq\t0x10(%0),%%rdx""\n\t"\
137 "movq\t0x18(%0),%%rcx""\n\t"\
138 "movq\t0x20(%0),%%r8""\n\t"\
139 "movq\t0x28(%0),%%r9""\n\t"\
140 DTRACE_CALL(provider, name)\
141 :\
142 : "r" (__dtrace_args)\
143 : "memory", "rdi", "rsi", "rdx", "rcx", "r8", "r9"\
144);
145
146#define DTRACE_CALL7ARGS(provider, name)\
147asm volatile ("subq\t$0x8,%%rsp""\n\t"\
148 "movq\t0x0(%0),%%rdi""\n\t"\
149 "movq\t0x8(%0),%%rsi""\n\t"\
150 "movq\t0x10(%0),%%rdx""\n\t"\
151 "movq\t0x18(%0),%%rcx""\n\t"\
152 "movq\t0x20(%0),%%r8""\n\t"\
153 "movq\t0x28(%0),%%r9""\n\t"\
154 "movq\t0x30(%0),%%rax""\n\t"\
155 "movq\t%%rax,0x0(%%rsp)""\n\t"\
156 DTRACE_CALL(provider, name)\
157 "addq\t$0x8,%%rsp""\n\t"\
158 :\
159 : "r" (__dtrace_args)\
160 : "memory", "rdi", "rsi", "rdx", "rcx", "r8", "r9", "rax"\
161);
162
163#endif // __x86_64__
164
165#ifdef __i386__
166
167#define DTRACE_NOPS\
168"nop""\n\t"\
169"leal 0(%%esi), %%esi""\n\t"
170
171#define DTRACE_CALL_INSN(p,n)\
172"call _dtracetest" DTRACE_STRINGIFY(_##p##_##n)"\n\t"
173
174#define ARG1_EXTENT1
175#define ARGS2_EXTENT2
176#define ARGS3_EXTENT4
177#define ARGS4_EXTENT4
178#define ARGS5_EXTENT8
179#define ARGS6_EXTENT8
180#define ARGS7_EXTENT8
181#define ARGS8_EXTENT8
182#define ARGS9_EXTENT12
183#define ARGS10_EXTENT12
184
185/*
186 * Because this code is used in the kernel, we must not touch any floating point
187 * or specialized registers. This leaves the following registers:
188 *
189 * eax ; volatile, safe to use
190 * ebx ; PIC register, gcc error when used
191 * ecx ; volatile, safe to use
192 * edx ; volatile, safe to use
193 * esi ; non-volatile, otherwise safe to use
194 * edi ; non-volatile, otherwise safe to use
195 *
196 * Using any of the non volatile register causes a spill to stack which is almost
197 * certainly a net performance loss. Also, note that the array ref (__dtrace_args)
198 * consumes one free register. If all three of the volatile regs are used for load/store,
199 * the compiler will spill a register to hold the array ref.
200 *
201 * The end result is that we only pipeline two loads/stores at a time. Blech.
202 */
203
204#define DTRACE_CALL0ARGS(provider, name)\
205asm volatile (\
206 DTRACE_CALL(provider, name)\
207 "# eat trailing nl +tabfrom DTRACE_CALL"\
208 :\
209 :\
210);
211
212#define DTRACE_CALL1ARG(provider, name)\
213asm volatile ("subl\t$0x10,%%esp""\n\t"\
214 "movl\t0x0(%0),%%eax""\n\t"\
215 "movl\t%%eax,0x0(%%esp)""\n\t"\
216 DTRACE_CALL(provider, name)\
217 "addl\t$0x10,%%esp"\
218 :\
219 : "r" (__dtrace_args) \
220 : "memory", "eax"\
221);
222
223#define DTRACE_CALL2ARGS(provider, name)\
224asm volatile ("subl\t$0x10,%%esp""\n\t"\
225 "movl\t0x0(%0),%%eax""\n\t"\
226 "movl\t0x4(%0),%%edx""\n\t"\
227 "movl\t%%eax,0x0(%%esp)""\n\t"\
228 "movl\t%%edx,0x4(%%esp)""\n\t"\
229 DTRACE_CALL(provider, name)\
230 "addl\t$0x10,%%esp"\
231 :\
232 : "r" (__dtrace_args)\
233 : "memory", "eax", "edx"\
234);
235
236#define DTRACE_CALL3ARGS(provider, name)\
237asm volatile ("subl\t$0x10,%%esp""\n\t"\
238 "movl\t0x0(%0),%%eax""\n\t"\
239 "movl\t0x4(%0),%%edx""\n\t"\
240 "movl\t%%eax,0x0(%%esp)""\n\t"\
241 "movl\t%%edx,0x4(%%esp)""\n\t"\
242 "movl\t0x8(%0),%%eax""\n\t"\
243 "movl\t%%eax,0x8(%%esp)""\n\t"\
244 DTRACE_CALL(provider, name)\
245 "addl\t$0x10,%%esp"\
246 :\
247 : "r" (__dtrace_args)\
248 : "memory", "eax", "edx"\
249);
250
251#define DTRACE_CALL4ARGS(provider, name)\
252asm volatile ("subl\t$0x10,%%esp""\n\t"\
253 "movl\t0x0(%0),%%eax""\n\t"\
254 "movl\t0x4(%0),%%edx""\n\t"\
255 "movl\t%%eax,0x0(%%esp)""\n\t"\
256 "movl\t%%edx,0x4(%%esp)""\n\t"\
257 "movl\t0x8(%0),%%eax""\n\t"\
258 "movl\t0xC(%0),%%edx""\n\t"\
259 "movl\t%%eax,0x8(%%esp)""\n\t"\
260 "movl\t%%edx,0xC(%%esp)""\n\t"\
261 DTRACE_CALL(provider, name)\
262 "addl\t$0x10,%%esp"\
263 :\
264 : "r" (__dtrace_args)\
265 : "memory", "eax", "edx" \
266);
267
268#define DTRACE_CALL5ARGS(provider, name)\
269asm volatile ("subl\t$0x20,%%esp""\n\t"\
270 "movl\t0x0(%0),%%eax""\n\t"\
271 "movl\t0x4(%0),%%edx""\n\t"\
272 "movl\t%%eax,0x0(%%esp)""\n\t"\
273 "movl\t%%edx,0x4(%%esp)""\n\t"\
274 "movl\t0x8(%0),%%eax""\n\t"\
275 "movl\t0xC(%0),%%edx""\n\t"\
276 "movl\t%%eax,0x8(%%esp)""\n\t"\
277 "movl\t%%edx,0xC(%%esp)""\n\t"\
278 "movl\t0x10(%0),%%eax""\n\t"\
279 "movl\t%%eax,0x10(%%esp)""\n\t"\
280 DTRACE_CALL(provider, name)\
281 "addl\t$0x20,%%esp"\
282 :\
283 : "r" (__dtrace_args)\
284 : "memory", "eax", "edx" \
285);
286
287#define DTRACE_CALL6ARGS(provider, name)\
288asm volatile ("subl\t$0x20,%%esp""\n\t"\
289 "movl\t0x0(%0),%%eax""\n\t"\
290 "movl\t0x4(%0),%%edx""\n\t"\
291 "movl\t%%eax,0x0(%%esp)""\n\t"\
292 "movl\t%%edx,0x4(%%esp)""\n\t"\
293 "movl\t0x8(%0),%%eax""\n\t"\
294 "movl\t0xC(%0),%%edx""\n\t"\
295 "movl\t%%eax,0x8(%%esp)""\n\t"\
296 "movl\t%%edx,0xC(%%esp)""\n\t"\
297 "movl\t0x10(%0),%%eax""\n\t"\
298 "movl\t0x14(%0),%%edx""\n\t"\
299 "movl\t%%eax,0x10(%%esp)""\n\t"\
300 "movl\t%%edx,0x14(%%esp)""\n\t"\
301 DTRACE_CALL(provider, name)\
302 "addl\t$0x20,%%esp"\
303 :\
304 : "r" (__dtrace_args)\
305 : "memory", "eax", "edx" \
306);
307
308#define DTRACE_CALL7ARGS(provider, name)\
309asm volatile ("subl\t$0x20,%%esp""\n\t"\
310 "movl\t0x0(%0),%%eax""\n\t"\
311 "movl\t0x4(%0),%%edx""\n\t"\
312 "movl\t%%eax,0x0(%%esp)""\n\t"\
313 "movl\t%%edx,0x4(%%esp)""\n\t"\
314 "movl\t0x8(%0),%%eax""\n\t"\
315 "movl\t0xC(%0),%%edx""\n\t"\
316 "movl\t%%eax,0x8(%%esp)""\n\t"\
317 "movl\t%%edx,0xC(%%esp)""\n\t"\
318 "movl\t0x10(%0),%%eax""\n\t"\
319 "movl\t0x14(%0),%%edx""\n\t"\
320 "movl\t%%eax,0x10(%%esp)""\n\t"\
321 "movl\t%%edx,0x14(%%esp)""\n\t"\
322 "movl\t0x18(%0),%%eax""\n\t"\
323 "movl\t%%eax,0x18(%%esp)""\n\t"\
324 DTRACE_CALL(provider, name)\
325 "addl\t$0x20,%%esp"\
326 :\
327 : "r" (__dtrace_args)\
328 : "memory", "eax", "edx" \
329);
330
331#define DTRACE_CALL8ARGS(provider, name)\
332asm volatile ("subl\t$0x20,%%esp""\n\t"\
333 "movl\t0x0(%0),%%eax""\n\t"\
334 "movl\t0x4(%0),%%edx""\n\t"\
335 "movl\t%%eax,0x0(%%esp)""\n\t"\
336 "movl\t%%edx,0x4(%%esp)""\n\t"\
337 "movl\t0x8(%0),%%eax""\n\t"\
338 "movl\t0xC(%0),%%edx""\n\t"\
339 "movl\t%%eax,0x8(%%esp)""\n\t"\
340 "movl\t%%edx,0xC(%%esp)""\n\t"\
341 "movl\t0x10(%0),%%eax""\n\t"\
342 "movl\t0x14(%0),%%edx""\n\t"\
343 "movl\t%%eax,0x10(%%esp)""\n\t"\
344 "movl\t%%edx,0x14(%%esp)""\n\t"\
345 "movl\t0x18(%0),%%eax""\n\t"\
346 "movl\t0x1C(%0),%%edx""\n\t"\
347 "movl\t%%eax,0x18(%%esp)""\n\t"\
348 "movl\t%%edx,0x1C(%%esp)""\n\t"\
349 DTRACE_CALL(provider, name)\
350 "addl\t$0x20,%%esp"\
351 :\
352 : "r" (__dtrace_args)\
353 : "memory", "eax", "edx" \
354);
355
356#define DTRACE_CALL9ARGS(provider, name)\
357asm volatile ("subl\t$0x30,%%esp""\n\t"\
358 "movl\t0x0(%0),%%eax""\n\t"\
359 "movl\t0x4(%0),%%edx""\n\t"\
360 "movl\t%%eax,0x0(%%esp)""\n\t"\
361 "movl\t%%edx,0x4(%%esp)""\n\t"\
362 "movl\t0x8(%0),%%eax""\n\t"\
363 "movl\t0xC(%0),%%edx""\n\t"\
364 "movl\t%%eax,0x8(%%esp)""\n\t"\
365 "movl\t%%edx,0xC(%%esp)""\n\t"\
366 "movl\t0x10(%0),%%eax""\n\t"\
367 "movl\t0x14(%0),%%edx""\n\t"\
368 "movl\t%%eax,0x10(%%esp)""\n\t"\
369 "movl\t%%edx,0x14(%%esp)""\n\t"\
370 "movl\t0x18(%0),%%eax""\n\t"\
371 "movl\t0x1C(%0),%%edx""\n\t"\
372 "movl\t%%eax,0x18(%%esp)""\n\t"\
373 "movl\t%%edx,0x1C(%%esp)""\n\t"\
374 "movl\t0x20(%0),%%eax""\n\t"\
375 "movl\t%%eax,0x20(%%esp)""\n\t"\
376 DTRACE_CALL(provider, name)\
377 "addl\t$0x30,%%esp"\
378 :\
379 : "r" (__dtrace_args)\
380 : "memory", "eax", "edx" \
381);
382
383#define DTRACE_CALL10ARGS(provider, name)\
384asm volatile ("subl\t$0x30,%%esp""\n\t"\
385 "movl\t0x0(%0),%%eax""\n\t"\
386 "movl\t0x4(%0),%%edx""\n\t"\
387 "movl\t%%eax,0x0(%%esp)""\n\t"\
388 "movl\t%%edx,0x4(%%esp)""\n\t"\
389 "movl\t0x8(%0),%%eax""\n\t"\
390 "movl\t0xC(%0),%%edx""\n\t"\
391 "movl\t%%eax,0x8(%%esp)""\n\t"\
392 "movl\t%%edx,0xC(%%esp)""\n\t"\
393 "movl\t0x10(%0),%%eax""\n\t"\
394 "movl\t0x14(%0),%%edx""\n\t"\
395 "movl\t%%eax,0x10(%%esp)""\n\t"\
396 "movl\t%%edx,0x14(%%esp)""\n\t"\
397 "movl\t0x18(%0),%%eax""\n\t"\
398 "movl\t0x1C(%0),%%edx""\n\t"\
399 "movl\t%%eax,0x18(%%esp)""\n\t"\
400 "movl\t%%edx,0x1C(%%esp)""\n\t"\
401 "movl\t0x20(%0),%%eax""\n\t"\
402 "movl\t0x24(%0),%%edx""\n\t"\
403 "movl\t%%eax,0x20(%%esp)""\n\t"\
404 "movl\t%%edx,0x24(%%esp)""\n\t"\
405 DTRACE_CALL(provider, name)\
406 "addl\t$0x30,%%esp"\
407 :\
408 : "r" (__dtrace_args)\
409 : "memory", "eax", "edx" \
410);
411
412#endif // __i386__
413
414#endif/* _MACH_I386_SDT_ISA_H */
415

Archive Download this file

Revision: 2182