mdb_disasm_impl.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
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, Version 1.0 only
6 * (the "License").  You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22/*
23 * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24 * Use is subject to license terms.
25 */
26
27#ifndef	_MDB_DISASM_IMPL_H
28#define	_MDB_DISASM_IMPL_H
29
30#pragma ident	"%Z%%M%	%I%	%E% SMI"
31
32/*
33 * Disassembler Implementation
34 *
35 * Each disassembler provides a string name (for selection with $V or -V),
36 * a brief description, and the set of operations defined in mdb_dis_ops_t.
37 * Currently the interface defined here is very primitive, but we hope to
38 * greatly enhance it in the future if we have a two-pass disassembler.
39 */
40
41#include <mdb/mdb_disasm.h>
42#include <mdb/mdb_module.h>
43
44#ifdef	__cplusplus
45extern "C" {
46#endif
47
48typedef struct mdb_dis_ops {
49	void (*dis_destroy)(mdb_disasm_t *);
50	mdb_tgt_addr_t (*dis_ins2str)(mdb_disasm_t *, mdb_tgt_t *,
51	    mdb_tgt_as_t, char *, size_t, mdb_tgt_addr_t);
52	mdb_tgt_addr_t (*dis_previns)(mdb_disasm_t *, mdb_tgt_t *,
53	    mdb_tgt_as_t, mdb_tgt_addr_t, uint_t);
54	mdb_tgt_addr_t (*dis_nextins)(mdb_disasm_t *, mdb_tgt_t *,
55	    mdb_tgt_as_t, mdb_tgt_addr_t);
56} mdb_dis_ops_t;
57
58struct mdb_disasm {
59	const char *dis_name;		/* Disassembler name */
60	const char *dis_desc;		/* Brief description */
61	mdb_module_t *dis_module;	/* Backpointer to containing module */
62	const mdb_dis_ops_t *dis_ops;	/* Pointer to ops vector */
63	void *dis_data;			/* Private storage */
64};
65
66#ifdef _MDB
67
68#if defined(__sparc)
69extern mdb_dis_ctor_f sparc1_create;
70extern mdb_dis_ctor_f sparc2_create;
71extern mdb_dis_ctor_f sparc4_create;
72extern mdb_dis_ctor_f sparcv8_create;
73extern mdb_dis_ctor_f sparcv9_create;
74extern mdb_dis_ctor_f sparcv9plus_create;
75#else /* __i386 */
76extern mdb_dis_ctor_f ia32_create;
77#if defined(__amd64)
78extern mdb_dis_ctor_f amd64_create;
79#endif /* __amd64 */
80#endif	/* __sparc */
81
82#endif	/* _MDB */
83
84#ifdef	__cplusplus
85}
86#endif
87
88#endif	/* _MDB_DISASM_IMPL_H */
89