Chameleon

Chameleon Svn Source Tree

Root/branches/rewrite/i386/include/mach/i386/sdt_isa.h

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

Archive Download this file

Revision: 1146