17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*ac448965Sahl * Common Development and Distribution License (the "License"). 6*ac448965Sahl * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 21*ac448965Sahl 227c478bd9Sstevel@tonic-gate /* 234b499cecSahl * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate #ifndef _DT_PROVIDER_H 287c478bd9Sstevel@tonic-gate #define _DT_PROVIDER_H 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate #include <dt_impl.h> 317c478bd9Sstevel@tonic-gate #include <dt_ident.h> 327c478bd9Sstevel@tonic-gate #include <dt_list.h> 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate #ifdef __cplusplus 357c478bd9Sstevel@tonic-gate extern "C" { 367c478bd9Sstevel@tonic-gate #endif 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate typedef struct dt_provider { 397c478bd9Sstevel@tonic-gate dt_list_t pv_list; /* list forward/back pointers */ 407c478bd9Sstevel@tonic-gate struct dt_provider *pv_next; /* pointer to next provider in hash */ 417c478bd9Sstevel@tonic-gate dtrace_providerdesc_t pv_desc; /* provider name and attributes */ 427c478bd9Sstevel@tonic-gate dt_idhash_t *pv_probes; /* probe defs (if user-declared) */ 437c478bd9Sstevel@tonic-gate dt_node_t *pv_nodes; /* parse node allocation list */ 441a7c1b72Smws ulong_t *pv_xrefs; /* translator reference bitmap */ 451a7c1b72Smws ulong_t pv_xrmax; /* number of valid bits in pv_xrefs */ 467c478bd9Sstevel@tonic-gate ulong_t pv_gen; /* generation # that created me */ 477c478bd9Sstevel@tonic-gate dtrace_hdl_t *pv_hdl; /* pointer to containing dtrace_hdl */ 487c478bd9Sstevel@tonic-gate uint_t pv_flags; /* flags (see below) */ 497c478bd9Sstevel@tonic-gate } dt_provider_t; 507c478bd9Sstevel@tonic-gate 517c478bd9Sstevel@tonic-gate #define DT_PROVIDER_INTF 0x1 /* provider interface declaration */ 527c478bd9Sstevel@tonic-gate #define DT_PROVIDER_IMPL 0x2 /* provider implementation is loaded */ 537c478bd9Sstevel@tonic-gate 547c478bd9Sstevel@tonic-gate typedef struct dt_probe_iter { 557c478bd9Sstevel@tonic-gate dtrace_probedesc_t pit_desc; /* description storage */ 567c478bd9Sstevel@tonic-gate dtrace_hdl_t *pit_hdl; /* libdtrace handle */ 577c478bd9Sstevel@tonic-gate dt_provider_t *pit_pvp; /* current provider */ 587c478bd9Sstevel@tonic-gate const char *pit_pat; /* caller's name pattern (or NULL) */ 597c478bd9Sstevel@tonic-gate dtrace_probe_f *pit_func; /* caller's function */ 607c478bd9Sstevel@tonic-gate void *pit_arg; /* caller's argument */ 617c478bd9Sstevel@tonic-gate uint_t pit_matches; /* number of matches */ 627c478bd9Sstevel@tonic-gate } dt_probe_iter_t; 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gate typedef struct dt_probe_instance { 657c478bd9Sstevel@tonic-gate char pi_fname[DTRACE_FUNCNAMELEN]; /* function name */ 664b499cecSahl char pi_rname[DTRACE_FUNCNAMELEN + 20]; /* mangled relocation name */ 677c478bd9Sstevel@tonic-gate uint32_t *pi_offs; /* offsets into the function */ 68*ac448965Sahl uint32_t *pi_enoffs; /* is-enabled offsets */ 697c478bd9Sstevel@tonic-gate uint_t pi_noffs; /* number of offsets */ 707c478bd9Sstevel@tonic-gate uint_t pi_maxoffs; /* size of pi_offs allocation */ 71*ac448965Sahl uint_t pi_nenoffs; /* number of is-enabled offsets */ 72*ac448965Sahl uint_t pi_maxenoffs; /* size of pi_enoffs allocation */ 737c478bd9Sstevel@tonic-gate struct dt_probe_instance *pi_next; /* next instance in the list */ 747c478bd9Sstevel@tonic-gate } dt_probe_instance_t; 757c478bd9Sstevel@tonic-gate 767c478bd9Sstevel@tonic-gate typedef struct dt_probe { 777c478bd9Sstevel@tonic-gate dt_provider_t *pr_pvp; /* pointer to containing provider */ 787c478bd9Sstevel@tonic-gate dt_ident_t *pr_ident; /* pointer to probe identifier */ 797c478bd9Sstevel@tonic-gate const char *pr_name; /* pointer to name component */ 807c478bd9Sstevel@tonic-gate dt_node_t *pr_nargs; /* native argument list */ 817c478bd9Sstevel@tonic-gate dt_node_t **pr_nargv; /* native argument vector */ 827c478bd9Sstevel@tonic-gate uint_t pr_nargc; /* native argument count */ 837c478bd9Sstevel@tonic-gate dt_node_t *pr_xargs; /* translated argument list */ 847c478bd9Sstevel@tonic-gate dt_node_t **pr_xargv; /* translated argument vector */ 857c478bd9Sstevel@tonic-gate uint_t pr_xargc; /* translated argument count */ 867c478bd9Sstevel@tonic-gate uint8_t *pr_mapping; /* translated argument mapping */ 877c478bd9Sstevel@tonic-gate dt_probe_instance_t *pr_inst; /* list of functions and offsets */ 887c478bd9Sstevel@tonic-gate dtrace_typeinfo_t *pr_argv; /* output argument types */ 897c478bd9Sstevel@tonic-gate int pr_argc; /* output argument count */ 907c478bd9Sstevel@tonic-gate } dt_probe_t; 917c478bd9Sstevel@tonic-gate 927c478bd9Sstevel@tonic-gate extern dt_provider_t *dt_provider_lookup(dtrace_hdl_t *, const char *); 937c478bd9Sstevel@tonic-gate extern dt_provider_t *dt_provider_create(dtrace_hdl_t *, const char *); 947c478bd9Sstevel@tonic-gate extern void dt_provider_destroy(dtrace_hdl_t *, dt_provider_t *); 951a7c1b72Smws extern int dt_provider_xref(dtrace_hdl_t *, dt_provider_t *, id_t); 967c478bd9Sstevel@tonic-gate 971a7c1b72Smws extern dt_probe_t *dt_probe_create(dtrace_hdl_t *, dt_ident_t *, int, 987c478bd9Sstevel@tonic-gate dt_node_t *, uint_t, dt_node_t *, uint_t); 997c478bd9Sstevel@tonic-gate 1007c478bd9Sstevel@tonic-gate extern dt_probe_t *dt_probe_info(dtrace_hdl_t *, 1017c478bd9Sstevel@tonic-gate const dtrace_probedesc_t *, dtrace_probeinfo_t *); 1027c478bd9Sstevel@tonic-gate 1037c478bd9Sstevel@tonic-gate extern dt_probe_t *dt_probe_lookup(dt_provider_t *, const char *); 1047c478bd9Sstevel@tonic-gate extern void dt_probe_declare(dt_provider_t *, dt_probe_t *); 1057c478bd9Sstevel@tonic-gate extern void dt_probe_destroy(dt_probe_t *); 1067c478bd9Sstevel@tonic-gate 1077c478bd9Sstevel@tonic-gate extern int dt_probe_define(dt_provider_t *, dt_probe_t *, 108*ac448965Sahl const char *, const char *, uint32_t, int); 1097c478bd9Sstevel@tonic-gate 1101a7c1b72Smws extern dt_node_t *dt_probe_tag(dt_probe_t *, uint_t, dt_node_t *); 1111a7c1b72Smws 1127c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1137c478bd9Sstevel@tonic-gate } 1147c478bd9Sstevel@tonic-gate #endif 1157c478bd9Sstevel@tonic-gate 1167c478bd9Sstevel@tonic-gate #endif /* _DT_PROVIDER_H */ 117