xref: /titanic_52/usr/src/cmd/mdb/common/mdb/mdb_whatis_impl.h (revision 4a1c24318fe7c9bdae38ce58a2e4624597d297e2)
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 /*
22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_MDB_WHATIS_IMPL_H
27 #define	_MDB_WHATIS_IMPL_H
28 
29 #include <mdb/mdb_module.h>
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 #define	WHATIS_MS(c, s) (((uint64_t)(c)) << (s))
36 
37 #define	WHATIS_MAGIC 	/* whatis 0x2009 */ \
38 	(WHATIS_MS('w', 56) | WHATIS_MS('h', 48) | WHATIS_MS('a', 40) | \
39 	    WHATIS_MS('t', 32) | WHATIS_MS('i', 24) | WHATIS_MS('s', 16) | \
40 	    WHATIS_MS(0x2009, 0))
41 
42 struct mdb_whatis {
43 	uint64_t w_magic;	/* just for sanity */
44 	uintptr_t *w_addrs;	/* w_naddr sorted addresses */
45 	char *w_addrfound;	/* array of w_naddr "found" flags */
46 	size_t w_naddrs;
47 	size_t w_match_next;	/* next match offset, or 0 if no active match */
48 	uintptr_t w_match_base;	/* base of current match */
49 	size_t w_match_size;	/* size of current match */
50 	size_t w_found;		/* count of set entries in w_addrfound */
51 	uint_t w_flags;		/* see WHATIS_* for details */
52 	uint8_t w_done;		/* set when no more processing is needed */
53 };
54 
55 #define	WHATIS_PUBLIC		0x0ffff
56 
57 /* flags which aren't part of the public interface */
58 #define	WHATIS_ALL		0x10000	/* -a, report all matches */
59 
60 #define	WHATIS_PRIO_MIN		99
61 
62 extern int cmd_whatis(uintptr_t, uint_t, int, const mdb_arg_t *);
63 extern void whatis_help(void);
64 
65 /* built-in callbacks */
66 extern int whatis_run_mappings(struct mdb_whatis *, void *);
67 
68 /* callback at module unload time */
69 extern void mdb_whatis_unregister_module(mdb_module_t *);
70 
71 #ifdef	__cplusplus
72 }
73 #endif
74 
75 #endif	/* _MDB_WHATIS_IMPL_H */
76