10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 51545Seschrock * Common Development and Distribution License (the "License"). 61545Seschrock * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*9293SKuriakose.Kuruvilla@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate /* Copyright (c) 1988 AT&T */ 270Sstevel@tonic-gate /* All Rights Reserved */ 280Sstevel@tonic-gate 290Sstevel@tonic-gate 300Sstevel@tonic-gate #ifndef _DIS_TABLES_H 310Sstevel@tonic-gate #define _DIS_TABLES_H 320Sstevel@tonic-gate 330Sstevel@tonic-gate /* 340Sstevel@tonic-gate * Constants and prototypes for the IA32 disassembler backend. See dis_tables.c 350Sstevel@tonic-gate * for usage information and documentation. 360Sstevel@tonic-gate */ 370Sstevel@tonic-gate 380Sstevel@tonic-gate #ifdef __cplusplus 390Sstevel@tonic-gate extern "C" { 400Sstevel@tonic-gate #endif 410Sstevel@tonic-gate 420Sstevel@tonic-gate #include <sys/types.h> 432089Sdmick #include <sys/inttypes.h> 440Sstevel@tonic-gate #include <sys/param.h> 450Sstevel@tonic-gate 460Sstevel@tonic-gate /* 470Sstevel@tonic-gate * values for cpu mode 480Sstevel@tonic-gate */ 490Sstevel@tonic-gate #define SIZE16 1 500Sstevel@tonic-gate #define SIZE32 2 510Sstevel@tonic-gate #define SIZE64 3 520Sstevel@tonic-gate 530Sstevel@tonic-gate #define OPLEN 256 540Sstevel@tonic-gate #define PFIXLEN 8 55*9293SKuriakose.Kuruvilla@Sun.COM #define NCPS 20 /* number of chars per symbol */ 560Sstevel@tonic-gate 570Sstevel@tonic-gate /* 580Sstevel@tonic-gate * data structures that must be provided to dtrace_dis86() 590Sstevel@tonic-gate */ 600Sstevel@tonic-gate typedef struct d86opnd { 610Sstevel@tonic-gate char d86_opnd[OPLEN]; /* symbolic rep of operand */ 620Sstevel@tonic-gate char d86_prefix[PFIXLEN]; /* any prefix string or "" */ 630Sstevel@tonic-gate uint_t d86_mode; /* mode for immediate */ 640Sstevel@tonic-gate uint_t d86_value_size; /* size in bytes of d86_value */ 650Sstevel@tonic-gate uint64_t d86_value; /* immediate value of opnd */ 660Sstevel@tonic-gate } d86opnd_t; 670Sstevel@tonic-gate 680Sstevel@tonic-gate typedef struct dis86 { 690Sstevel@tonic-gate uint_t d86_mode; 700Sstevel@tonic-gate uint_t d86_error; 710Sstevel@tonic-gate uint_t d86_len; /* instruction length */ 720Sstevel@tonic-gate int d86_rmindex; /* index of modrm byte or -1 */ 730Sstevel@tonic-gate uint_t d86_memsize; /* size of memory referenced */ 740Sstevel@tonic-gate char d86_bytes[16]; /* bytes of instruction */ 752089Sdmick char d86_mnem[OPLEN]; 760Sstevel@tonic-gate uint_t d86_numopnds; 770Sstevel@tonic-gate uint_t d86_rex_prefix; /* value of REX prefix if !0 */ 780Sstevel@tonic-gate char *d86_seg_prefix; /* segment prefix, if any */ 790Sstevel@tonic-gate uint_t d86_opnd_size; 800Sstevel@tonic-gate uint_t d86_addr_size; 810Sstevel@tonic-gate uint_t d86_got_modrm; 824628Skk208521 struct d86opnd d86_opnd[4]; /* up to 4 operands */ 831545Seschrock int (*d86_check_func)(void *); 840Sstevel@tonic-gate int (*d86_get_byte)(void *); 850Sstevel@tonic-gate #ifdef DIS_TEXT 861545Seschrock int (*d86_sym_lookup)(void *, uint64_t, char *, size_t); 870Sstevel@tonic-gate int (*d86_sprintf_func)(char *, size_t, const char *, ...); 880Sstevel@tonic-gate int d86_flags; 890Sstevel@tonic-gate uint_t d86_imm_bytes; 900Sstevel@tonic-gate #endif 910Sstevel@tonic-gate void *d86_data; 920Sstevel@tonic-gate } dis86_t; 930Sstevel@tonic-gate 940Sstevel@tonic-gate extern int dtrace_disx86(dis86_t *x, uint_t cpu_mode); 950Sstevel@tonic-gate 962089Sdmick #define DIS_F_OCTAL 0x1 /* Print all numbers in octal */ 973892Sdmick #define DIS_F_NOIMMSYM 0x2 /* Don't print symbols for immediates (.o) */ 980Sstevel@tonic-gate 990Sstevel@tonic-gate #ifdef DIS_TEXT 1002089Sdmick extern void dtrace_disx86_str(dis86_t *x, uint_t cpu_mode, uint64_t pc, 1010Sstevel@tonic-gate char *buf, size_t len); 1020Sstevel@tonic-gate #endif 1030Sstevel@tonic-gate 1040Sstevel@tonic-gate #ifdef __cplusplus 1050Sstevel@tonic-gate } 1060Sstevel@tonic-gate #endif 1070Sstevel@tonic-gate 1080Sstevel@tonic-gate #endif /* _DIS_TABLES_H */ 109