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