xref: /freebsd/sys/cddl/dev/fbt/fbt.h (revision 6c2806594b351ec39cca31bf386bdee79571fa36)
1266b4a78SMark Johnston /*
2266b4a78SMark Johnston  * CDDL HEADER START
3266b4a78SMark Johnston  *
4266b4a78SMark Johnston  * The contents of this file are subject to the terms of the
5266b4a78SMark Johnston  * Common Development and Distribution License (the "License").
6266b4a78SMark Johnston  * You may not use this file except in compliance with the License.
7266b4a78SMark Johnston  *
8266b4a78SMark Johnston  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9266b4a78SMark Johnston  * or http://www.opensolaris.org/os/licensing.
10266b4a78SMark Johnston  * See the License for the specific language governing permissions
11266b4a78SMark Johnston  * and limitations under the License.
12266b4a78SMark Johnston  *
13266b4a78SMark Johnston  * When distributing Covered Code, include this CDDL HEADER in each
14266b4a78SMark Johnston  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15266b4a78SMark Johnston  * If applicable, add the following below this CDDL HEADER, with the
16266b4a78SMark Johnston  * fields enclosed by brackets "[]" replaced with your own identifying
17266b4a78SMark Johnston  * information: Portions Copyright [yyyy] [name of copyright owner]
18266b4a78SMark Johnston  *
19266b4a78SMark Johnston  * CDDL HEADER END
20266b4a78SMark Johnston  *
21266b4a78SMark Johnston  * Portions Copyright 2006-2008 John Birrell jb@freebsd.org
22266b4a78SMark Johnston  *
23266b4a78SMark Johnston  * $FreeBSD$
24266b4a78SMark Johnston  *
25266b4a78SMark Johnston  */
26266b4a78SMark Johnston 
27266b4a78SMark Johnston /*
28266b4a78SMark Johnston  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
29266b4a78SMark Johnston  * Use is subject to license terms.
30266b4a78SMark Johnston  */
31266b4a78SMark Johnston 
32266b4a78SMark Johnston #ifndef _FBT_H_
33266b4a78SMark Johnston #define _FBT_H_
34266b4a78SMark Johnston 
35266b4a78SMark Johnston #include "fbt_isa.h"
36266b4a78SMark Johnston 
37266b4a78SMark Johnston typedef struct fbt_probe {
38266b4a78SMark Johnston 	struct fbt_probe *fbtp_hashnext;
39266b4a78SMark Johnston 	fbt_patchval_t	*fbtp_patchpoint;
40266b4a78SMark Johnston 	int8_t		fbtp_rval;
41266b4a78SMark Johnston 	fbt_patchval_t	fbtp_patchval;
42266b4a78SMark Johnston 	fbt_patchval_t	fbtp_savedval;
43266b4a78SMark Johnston 	uintptr_t	fbtp_roffset;
44266b4a78SMark Johnston 	dtrace_id_t	fbtp_id;
45266b4a78SMark Johnston 	const char	*fbtp_name;
46266b4a78SMark Johnston 	modctl_t	*fbtp_ctl;
47266b4a78SMark Johnston 	int		fbtp_loadcnt;
48266b4a78SMark Johnston 	int		fbtp_symindx;
49266b4a78SMark Johnston 	struct fbt_probe *fbtp_next;
50266b4a78SMark Johnston } fbt_probe_t;
51266b4a78SMark Johnston 
52266b4a78SMark Johnston struct linker_file;
53266b4a78SMark Johnston struct linker_symval;
54*6c280659SMark Johnston struct trapframe;
55266b4a78SMark Johnston 
56*6c280659SMark Johnston int	fbt_invop(uintptr_t, struct trapframe *, uintptr_t);
57266b4a78SMark Johnston void	fbt_patch_tracepoint(fbt_probe_t *, fbt_patchval_t);
58266b4a78SMark Johnston int	fbt_provide_module_function(struct linker_file *, int,
59266b4a78SMark Johnston 	    struct linker_symval *, void *);
600ff41755SRuslan Bukin int	fbt_excluded(const char *name);
61266b4a78SMark Johnston 
62266b4a78SMark Johnston extern dtrace_provider_id_t	fbt_id;
63266b4a78SMark Johnston extern fbt_probe_t		**fbt_probetab;
64266b4a78SMark Johnston extern int			fbt_probetab_mask;
65266b4a78SMark Johnston 
66266b4a78SMark Johnston #define	FBT_ADDR2NDX(addr)	((((uintptr_t)(addr)) >> 4) & fbt_probetab_mask)
67266b4a78SMark Johnston #define	FBT_PROBETAB_SIZE	0x8000		/* 32k entries -- 128K total */
68266b4a78SMark Johnston 
69266b4a78SMark Johnston #ifdef MALLOC_DECLARE
70266b4a78SMark Johnston MALLOC_DECLARE(M_FBT);
71266b4a78SMark Johnston #endif
72266b4a78SMark Johnston 
73266b4a78SMark Johnston #endif
74