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