xref: /titanic_50/usr/src/lib/libdisasm/common/dis_sparc.h (revision f7184619589931c4b827180c213074c470f08a8f)
1*f7184619SJoshua M. Clulow /*
2*f7184619SJoshua M. Clulow  * CDDL HEADER START
3*f7184619SJoshua M. Clulow  *
4*f7184619SJoshua M. Clulow  * The contents of this file are subject to the terms of the
5*f7184619SJoshua M. Clulow  * Common Development and Distribution License (the "License").
6*f7184619SJoshua M. Clulow  * You may not use this file except in compliance with the License.
7*f7184619SJoshua M. Clulow  *
8*f7184619SJoshua M. Clulow  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*f7184619SJoshua M. Clulow  * or http://www.opensolaris.org/os/licensing.
10*f7184619SJoshua M. Clulow  * See the License for the specific language governing permissions
11*f7184619SJoshua M. Clulow  * and limitations under the License.
12*f7184619SJoshua M. Clulow  *
13*f7184619SJoshua M. Clulow  * When distributing Covered Code, include this CDDL HEADER in each
14*f7184619SJoshua M. Clulow  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*f7184619SJoshua M. Clulow  * If applicable, add the following below this CDDL HEADER, with the
16*f7184619SJoshua M. Clulow  * fields enclosed by brackets "[]" replaced with your own identifying
17*f7184619SJoshua M. Clulow  * information: Portions Copyright [yyyy] [name of copyright owner]
18*f7184619SJoshua M. Clulow  *
19*f7184619SJoshua M. Clulow  * CDDL HEADER END
20*f7184619SJoshua M. Clulow  */
21*f7184619SJoshua M. Clulow 
22*f7184619SJoshua M. Clulow /*
23*f7184619SJoshua M. Clulow  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24*f7184619SJoshua M. Clulow  * Use is subject to license terms.
25*f7184619SJoshua M. Clulow  */
26*f7184619SJoshua M. Clulow 
27*f7184619SJoshua M. Clulow /*
28*f7184619SJoshua M. Clulow  * Copyright 2007 Jason King.  All rights reserved.
29*f7184619SJoshua M. Clulow  * Use is subject to license terms.
30*f7184619SJoshua M. Clulow  */
31*f7184619SJoshua M. Clulow 
32*f7184619SJoshua M. Clulow 
33*f7184619SJoshua M. Clulow #ifndef _DIS_SPARC_H
34*f7184619SJoshua M. Clulow #define	_DIS_SPARC_H
35*f7184619SJoshua M. Clulow 
36*f7184619SJoshua M. Clulow #ifdef	__cplusplus
37*f7184619SJoshua M. Clulow extern "C" {
38*f7184619SJoshua M. Clulow #endif
39*f7184619SJoshua M. Clulow 
40*f7184619SJoshua M. Clulow #include <sys/types.h>
41*f7184619SJoshua M. Clulow 
42*f7184619SJoshua M. Clulow #define	DIS_DEBUG_NONE		0x00L
43*f7184619SJoshua M. Clulow #define	DIS_DEBUG_COMPAT	0x01L
44*f7184619SJoshua M. Clulow #define	DIS_DEBUG_SYN_ALL	0x02L
45*f7184619SJoshua M. Clulow #define	DIS_DEBUG_PRTBIN	0x04L
46*f7184619SJoshua M. Clulow #define	DIS_DEBUG_PRTFMT	0x08L
47*f7184619SJoshua M. Clulow 
48*f7184619SJoshua M. Clulow #define	DIS_DEBUG_ALL DIS_DEBUG_SYN_ALL|DIS_DEBUG_PRTBIN|DIS_DEBUG_PRTFMT
49*f7184619SJoshua M. Clulow 
50*f7184619SJoshua M. Clulow typedef struct dis_handle_sparc {
51*f7184619SJoshua M. Clulow 	char		*dhx_buf;
52*f7184619SJoshua M. Clulow 	size_t		dhx_buflen;
53*f7184619SJoshua M. Clulow 	int		dhx_debug;
54*f7184619SJoshua M. Clulow } dis_handle_sparc_t;
55*f7184619SJoshua M. Clulow 
56*f7184619SJoshua M. Clulow /* different types of things we can have in inst_t */
57*f7184619SJoshua M. Clulow #define	INST_NONE	0x00
58*f7184619SJoshua M. Clulow #define	INST_DEF	0x01
59*f7184619SJoshua M. Clulow #define	INST_TBL	0x02
60*f7184619SJoshua M. Clulow 
61*f7184619SJoshua M. Clulow struct inst;
62*f7184619SJoshua M. Clulow struct overlay;
63*f7184619SJoshua M. Clulow 
64*f7184619SJoshua M. Clulow typedef struct inst inst_t;
65*f7184619SJoshua M. Clulow typedef struct overlay overlay_t;
66*f7184619SJoshua M. Clulow 
67*f7184619SJoshua M. Clulow typedef int (*format_fcn)(dis_handle_t *, uint32_t, const inst_t *, int);
68*f7184619SJoshua M. Clulow 
69*f7184619SJoshua M. Clulow typedef struct table {
70*f7184619SJoshua M. Clulow 	const struct inst	*tbl_inp;
71*f7184619SJoshua M. Clulow 	const struct overlay	*tbl_ovp;
72*f7184619SJoshua M. Clulow 	format_fcn		tbl_fmt;
73*f7184619SJoshua M. Clulow 	uint32_t		tbl_field;
74*f7184619SJoshua M. Clulow 	uint32_t		tbl_len;
75*f7184619SJoshua M. Clulow } table_t;
76*f7184619SJoshua M. Clulow 
77*f7184619SJoshua M. Clulow struct inst {
78*f7184619SJoshua M. Clulow 	int in_type;
79*f7184619SJoshua M. Clulow 	int in_arch;
80*f7184619SJoshua M. Clulow 	union {
81*f7184619SJoshua M. Clulow 		struct {
82*f7184619SJoshua M. Clulow 			const char	*in_name;
83*f7184619SJoshua M. Clulow 			uint32_t	in_flags;
84*f7184619SJoshua M. Clulow 		} in_def;
85*f7184619SJoshua M. Clulow 		const table_t *in_tbl;
86*f7184619SJoshua M. Clulow 	} in_data;
87*f7184619SJoshua M. Clulow };
88*f7184619SJoshua M. Clulow 
89*f7184619SJoshua M. Clulow struct overlay {
90*f7184619SJoshua M. Clulow 	int	ov_idx;
91*f7184619SJoshua M. Clulow 	inst_t	ov_inst;
92*f7184619SJoshua M. Clulow };
93*f7184619SJoshua M. Clulow 
94*f7184619SJoshua M. Clulow extern const table_t initial_table;
95*f7184619SJoshua M. Clulow 
96*f7184619SJoshua M. Clulow void prt_binary(uint32_t, int);
97*f7184619SJoshua M. Clulow #ifdef	__cplusplus
98*f7184619SJoshua M. Clulow }
99*f7184619SJoshua M. Clulow #endif
100*f7184619SJoshua M. Clulow 
101*f7184619SJoshua M. Clulow #endif	/* _DIS_SPARC_H */
102