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