]>
Commit | Line | Data |
---|---|---|
2d21ac55 A |
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 _SDT_IMPL_H | |
28 | #define _SDT_IMPL_H | |
29 | ||
30 | /* | |
31 | * This file has been created by splitting up the original DTrace sdt.h | |
32 | * header. Keep the pragma notice here to allow version tracking. | |
33 | */ | |
34 | ||
35 | /* #pragma ident "@(#)sdt.h 1.7 05/06/08 SMI" */ | |
36 | ||
37 | #ifdef __cplusplus | |
38 | extern "C" { | |
39 | #endif | |
40 | ||
41 | extern const char *sdt_prefix; | |
42 | ||
43 | typedef struct sdt_probedesc { | |
44 | char *sdpd_name; /* name of this probe */ | |
45 | #if defined(__APPLE__) | |
46 | char *sdpd_func; | |
47 | #endif /* __APPLE__ */ | |
48 | unsigned long sdpd_offset; /* offset of call in text */ | |
49 | struct sdt_probedesc *sdpd_next; /* next static probe */ | |
50 | } sdt_probedesc_t; | |
51 | ||
52 | #ifdef __cplusplus | |
53 | } | |
54 | #endif | |
55 | ||
56 | /* #pragma ident "@(#)sdt_impl.h 1.3 05/06/08 SMI" */ | |
57 | ||
58 | #ifdef __cplusplus | |
59 | extern "C" { | |
60 | #endif | |
61 | ||
62 | #include <sys/dtrace.h> | |
63 | ||
64 | #if !defined(__APPLE__) | |
65 | #if defined(__i386) || defined(__amd64) | |
66 | typedef uint8_t sdt_instr_t; | |
67 | #else | |
68 | typedef uint32_t sdt_instr_t; | |
69 | #endif | |
70 | #else | |
71 | struct module { | |
72 | int sdt_nprobes; | |
73 | sdt_probedesc_t *sdt_probes; | |
74 | }; | |
75 | ||
76 | extern int sdt_invop(uintptr_t, uintptr_t *, uintptr_t); | |
6d2010ae A |
77 | #if defined (__APPLE__) |
78 | extern uint64_t sdt_getarg(void *, dtrace_id_t, void *, int, int); | |
79 | #endif /* __APPLE__ */ | |
2d21ac55 A |
80 | |
81 | void sdt_provide_module(void *, struct modctl *); | |
82 | void sdt_init(void); | |
83 | ||
84 | extern int sdt_probetab_size; | |
85 | extern int sdt_probetab_mask; | |
86 | #define SDT_ADDR2NDX(addr) ((((uintptr_t)(addr)) >> 4) & sdt_probetab_mask) | |
87 | ||
88 | ||
89 | #if defined(__i386__) || defined(__x86_64__) | |
90 | typedef uint8_t sdt_instr_t; | |
2d21ac55 A |
91 | #else |
92 | #error Unknown implementation | |
93 | #endif | |
94 | #endif /* __APPLE__ */ | |
95 | ||
96 | typedef struct sdt_provider { | |
97 | const char *sdtp_name; /* name of provider */ | |
98 | const char *sdtp_prefix; /* prefix for probe names */ | |
99 | dtrace_pattr_t *sdtp_attr; /* stability attributes */ | |
100 | dtrace_provider_id_t sdtp_id; /* provider ID */ | |
101 | } sdt_provider_t; | |
102 | ||
103 | extern sdt_provider_t sdt_providers[]; /* array of providers */ | |
104 | ||
105 | typedef struct sdt_probe { | |
106 | sdt_provider_t *sdp_provider; /* provider */ | |
107 | char *sdp_name; /* name of probe */ | |
108 | int sdp_namelen; /* length of allocated name */ | |
109 | dtrace_id_t sdp_id; /* probe ID */ | |
110 | struct modctl *sdp_ctl; /* modctl for module */ | |
111 | int sdp_loadcnt; /* load count for module */ | |
112 | int sdp_primary; /* non-zero if primary mod */ | |
113 | sdt_instr_t *sdp_patchpoint; /* patch point */ | |
114 | sdt_instr_t sdp_patchval; /* instruction to patch */ | |
115 | sdt_instr_t sdp_savedval; /* saved instruction value */ | |
116 | struct sdt_probe *sdp_next; /* next probe */ | |
117 | struct sdt_probe *sdp_hashnext; /* next on hash */ | |
118 | } sdt_probe_t; | |
119 | ||
120 | typedef struct sdt_argdesc { | |
121 | const char *sda_provider; /* provider for arg */ | |
122 | const char *sda_name; /* name of probe */ | |
123 | const int sda_ndx; /* argument index */ | |
124 | const int sda_mapping; /* mapping of argument */ | |
125 | const char *sda_native; /* native type of argument */ | |
126 | const char *sda_xlate; /* translated type of arg */ | |
127 | } sdt_argdesc_t; | |
128 | ||
129 | extern void sdt_getargdesc(void *, dtrace_id_t, void *, dtrace_argdesc_t *); | |
130 | ||
131 | #ifdef __cplusplus | |
132 | } | |
133 | #endif | |
134 | ||
135 | #endif /* _SDT_IMPL_H */ |