17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5dc0093f4Seschrock * Common Development and Distribution License (the "License"). 6dc0093f4Seschrock * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22a2426e09SKuriakose Kuruvilla * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate /* Copyright (c) 1988 AT&T */ 277c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate #ifndef _DIS_TABLES_H 317c478bd9Sstevel@tonic-gate #define _DIS_TABLES_H 327c478bd9Sstevel@tonic-gate 337c478bd9Sstevel@tonic-gate /* 347c478bd9Sstevel@tonic-gate * Constants and prototypes for the IA32 disassembler backend. See dis_tables.c 357c478bd9Sstevel@tonic-gate * for usage information and documentation. 367c478bd9Sstevel@tonic-gate */ 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate #ifdef __cplusplus 397c478bd9Sstevel@tonic-gate extern "C" { 407c478bd9Sstevel@tonic-gate #endif 417c478bd9Sstevel@tonic-gate 427c478bd9Sstevel@tonic-gate #include <sys/types.h> 43d267098bSdmick #include <sys/inttypes.h> 447c478bd9Sstevel@tonic-gate #include <sys/param.h> 457c478bd9Sstevel@tonic-gate 467c478bd9Sstevel@tonic-gate /* 477c478bd9Sstevel@tonic-gate * values for cpu mode 487c478bd9Sstevel@tonic-gate */ 497c478bd9Sstevel@tonic-gate #define SIZE16 1 507c478bd9Sstevel@tonic-gate #define SIZE32 2 517c478bd9Sstevel@tonic-gate #define SIZE64 3 527c478bd9Sstevel@tonic-gate 537c478bd9Sstevel@tonic-gate #define OPLEN 256 547c478bd9Sstevel@tonic-gate #define PFIXLEN 8 55a2426e09SKuriakose Kuruvilla #define NCPS 20 /* number of chars per symbol */ 567c478bd9Sstevel@tonic-gate 577c478bd9Sstevel@tonic-gate /* 587c478bd9Sstevel@tonic-gate * data structures that must be provided to dtrace_dis86() 597c478bd9Sstevel@tonic-gate */ 607c478bd9Sstevel@tonic-gate typedef struct d86opnd { 617c478bd9Sstevel@tonic-gate char d86_opnd[OPLEN]; /* symbolic rep of operand */ 627c478bd9Sstevel@tonic-gate char d86_prefix[PFIXLEN]; /* any prefix string or "" */ 637c478bd9Sstevel@tonic-gate uint_t d86_mode; /* mode for immediate */ 647c478bd9Sstevel@tonic-gate uint_t d86_value_size; /* size in bytes of d86_value */ 657c478bd9Sstevel@tonic-gate uint64_t d86_value; /* immediate value of opnd */ 667c478bd9Sstevel@tonic-gate } d86opnd_t; 677c478bd9Sstevel@tonic-gate 687c478bd9Sstevel@tonic-gate typedef struct dis86 { 697c478bd9Sstevel@tonic-gate uint_t d86_mode; 707c478bd9Sstevel@tonic-gate uint_t d86_error; 717c478bd9Sstevel@tonic-gate uint_t d86_len; /* instruction length */ 727c478bd9Sstevel@tonic-gate int d86_rmindex; /* index of modrm byte or -1 */ 737c478bd9Sstevel@tonic-gate uint_t d86_memsize; /* size of memory referenced */ 747c478bd9Sstevel@tonic-gate char d86_bytes[16]; /* bytes of instruction */ 75d267098bSdmick char d86_mnem[OPLEN]; 767c478bd9Sstevel@tonic-gate uint_t d86_numopnds; 777c478bd9Sstevel@tonic-gate uint_t d86_rex_prefix; /* value of REX prefix if !0 */ 787c478bd9Sstevel@tonic-gate char *d86_seg_prefix; /* segment prefix, if any */ 797c478bd9Sstevel@tonic-gate uint_t d86_opnd_size; 807c478bd9Sstevel@tonic-gate uint_t d86_addr_size; 817c478bd9Sstevel@tonic-gate uint_t d86_got_modrm; 82*245ac945SRobert Mustacchi uint_t d86_vsib; /* Has a VSIB */ 83f8801251Skk208521 struct d86opnd d86_opnd[4]; /* up to 4 operands */ 84dc0093f4Seschrock int (*d86_check_func)(void *); 857c478bd9Sstevel@tonic-gate int (*d86_get_byte)(void *); 867c478bd9Sstevel@tonic-gate #ifdef DIS_TEXT 87dc0093f4Seschrock int (*d86_sym_lookup)(void *, uint64_t, char *, size_t); 887c478bd9Sstevel@tonic-gate int (*d86_sprintf_func)(char *, size_t, const char *, ...); 897c478bd9Sstevel@tonic-gate int d86_flags; 907c478bd9Sstevel@tonic-gate uint_t d86_imm_bytes; 917c478bd9Sstevel@tonic-gate #endif 927c478bd9Sstevel@tonic-gate void *d86_data; 937c478bd9Sstevel@tonic-gate } dis86_t; 947c478bd9Sstevel@tonic-gate 957c478bd9Sstevel@tonic-gate extern int dtrace_disx86(dis86_t *x, uint_t cpu_mode); 967c478bd9Sstevel@tonic-gate 97d267098bSdmick #define DIS_F_OCTAL 0x1 /* Print all numbers in octal */ 98e0070315Sdmick #define DIS_F_NOIMMSYM 0x2 /* Don't print symbols for immediates (.o) */ 997c478bd9Sstevel@tonic-gate 1007c478bd9Sstevel@tonic-gate #ifdef DIS_TEXT 101d267098bSdmick extern void dtrace_disx86_str(dis86_t *x, uint_t cpu_mode, uint64_t pc, 1027c478bd9Sstevel@tonic-gate char *buf, size_t len); 1037c478bd9Sstevel@tonic-gate #endif 1047c478bd9Sstevel@tonic-gate 1057c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1067c478bd9Sstevel@tonic-gate } 1077c478bd9Sstevel@tonic-gate #endif 1087c478bd9Sstevel@tonic-gate 1097c478bd9Sstevel@tonic-gate #endif /* _DIS_TABLES_H */ 110