xref: /freebsd/sys/cddl/dev/fbt/fbt.h (revision 6b7b2d80ed4d728d3ffd12c422e57798c1b63a84)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  *
21  * Portions Copyright 2006-2008 John Birrell jb@freebsd.org
22  *
23  * $FreeBSD$
24  *
25  */
26 
27 /*
28  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
29  * Use is subject to license terms.
30  */
31 
32 #ifndef _FBT_H_
33 #define _FBT_H_
34 
35 #include "fbt_isa.h"
36 
37 typedef struct fbt_probe {
38 	struct fbt_probe *fbtp_hashnext;
39 	fbt_patchval_t	*fbtp_patchpoint;
40 	int8_t		fbtp_rval;
41 	fbt_patchval_t	fbtp_patchval;
42 	fbt_patchval_t	fbtp_savedval;
43 	uintptr_t	fbtp_roffset;
44 	dtrace_id_t	fbtp_id;
45 	const char	*fbtp_name;
46 	modctl_t	*fbtp_ctl;
47 	int		fbtp_loadcnt;
48 	int		fbtp_symindx;
49 	struct fbt_probe *fbtp_next;
50 } fbt_probe_t;
51 
52 struct linker_file;
53 struct linker_symval;
54 
55 int	fbt_invop(uintptr_t, uintptr_t *, uintptr_t);
56 void	fbt_patch_tracepoint(fbt_probe_t *, fbt_patchval_t);
57 int	fbt_provide_module_function(struct linker_file *, int,
58 	    struct linker_symval *, void *);
59 int	fbt_excluded(const char *name);
60 
61 extern dtrace_provider_id_t	fbt_id;
62 extern fbt_probe_t		**fbt_probetab;
63 extern int			fbt_probetab_mask;
64 
65 #define	FBT_ADDR2NDX(addr)	((((uintptr_t)(addr)) >> 4) & fbt_probetab_mask)
66 #define	FBT_PROBETAB_SIZE	0x8000		/* 32k entries -- 128K total */
67 
68 #ifdef MALLOC_DECLARE
69 MALLOC_DECLARE(M_FBT);
70 #endif
71 
72 #endif
73