xref: /titanic_44/usr/src/cmd/mdb/common/mdb/mdb_disasm_impl.h (revision dc0093f44ee4fac928e006850f8ed53f68277af5)
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 2006 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_MDB_DISASM_IMPL_H
27 #define	_MDB_DISASM_IMPL_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 /*
32  * Disassembler Implementation
33  *
34  * Each disassembler provides a string name (for selection with $V or -V),
35  * a brief description, and the set of operations defined in mdb_dis_ops_t.
36  * Currently the interface defined here is very primitive, but we hope to
37  * greatly enhance it in the future if we have a two-pass disassembler.
38  */
39 
40 #include <mdb/mdb_disasm.h>
41 #include <mdb/mdb_module.h>
42 
43 #ifdef	__cplusplus
44 extern "C" {
45 #endif
46 
47 typedef struct mdb_dis_ops {
48 	void (*dis_destroy)(mdb_disasm_t *);
49 	mdb_tgt_addr_t (*dis_ins2str)(mdb_disasm_t *, mdb_tgt_t *,
50 	    mdb_tgt_as_t, char *, size_t, mdb_tgt_addr_t);
51 	mdb_tgt_addr_t (*dis_previns)(mdb_disasm_t *, mdb_tgt_t *,
52 	    mdb_tgt_as_t, mdb_tgt_addr_t, uint_t);
53 	mdb_tgt_addr_t (*dis_nextins)(mdb_disasm_t *, mdb_tgt_t *,
54 	    mdb_tgt_as_t, mdb_tgt_addr_t);
55 } mdb_dis_ops_t;
56 
57 struct mdb_disasm {
58 	const char *dis_name;		/* Disassembler name */
59 	const char *dis_desc;		/* Brief description */
60 	mdb_module_t *dis_module;	/* Backpointer to containing module */
61 	const mdb_dis_ops_t *dis_ops;	/* Pointer to ops vector */
62 	void *dis_data;			/* Private storage */
63 };
64 
65 #ifdef	__cplusplus
66 }
67 #endif
68 
69 #endif	/* _MDB_DISASM_IMPL_H */
70