dis_tables.h revision 179237
1195098Sed/* 2195098Sed * CDDL HEADER START 3195098Sed * 4195098Sed * The contents of this file are subject to the terms of the 5195098Sed * Common Development and Distribution License (the "License"). 6195098Sed * You may not use this file except in compliance with the License. 7195098Sed * 8195098Sed * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9195340Sed * or http://www.opensolaris.org/os/licensing. 10195340Sed * See the License for the specific language governing permissions 11195340Sed * and limitations under the License. 12195340Sed * 13195098Sed * When distributing Covered Code, include this CDDL HEADER in each 14195098Sed * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15195098Sed * If applicable, add the following below this CDDL HEADER, with the 16195098Sed * fields enclosed by brackets "[]" replaced with your own identifying 17249423Sdim * information: Portions Copyright [yyyy] [name of copyright owner] 18249423Sdim * 19249423Sdim * CDDL HEADER END 20202878Srdivacky * 21218893Sdim * $FreeBSD: head/sys/cddl/dev/dtrace/amd64/dis_tables.h 179237 2008-05-23 05:59:42Z jb $ 22223017Sdim */ 23249423Sdim/* 24249423Sdim * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 25195098Sed * Use is subject to license terms. 26195098Sed */ 27263508Sdim 28263508Sdim/* Copyright (c) 1988 AT&T */ 29263508Sdim/* All Rights Reserved */ 30263508Sdim 31263508Sdim 32263508Sdim#ifndef _DIS_TABLES_H 33263508Sdim#define _DIS_TABLES_H 34263508Sdim 35263508Sdim#if defined(sun) 36263508Sdim#pragma ident "@(#)dis_tables.h 1.7 06/03/02 SMI" 37263508Sdim#endif 38263508Sdim 39263508Sdim/* 40195098Sed * Constants and prototypes for the IA32 disassembler backend. See dis_tables.c 41263508Sdim * for usage information and documentation. 42251662Sdim */ 43263508Sdim 44263508Sdim#ifdef __cplusplus 45263508Sdimextern "C" { 46263508Sdim#endif 47263508Sdim 48263508Sdim#include <sys/types.h> 49263508Sdim#include <sys/param.h> 50263508Sdim 51263508Sdim/* 52263508Sdim * values for cpu mode 53263508Sdim */ 54263508Sdim#define SIZE16 1 55263508Sdim#define SIZE32 2 56263508Sdim#define SIZE64 3 57263508Sdim 58263508Sdim#define OPLEN 256 59263508Sdim#define PFIXLEN 8 60263508Sdim#define NCPS 12 /* number of chars per symbol */ 61263508Sdim 62263508Sdim/* 63263508Sdim * data structures that must be provided to dtrace_dis86() 64263508Sdim */ 65263508Sdimtypedef struct d86opnd { 66263508Sdim char d86_opnd[OPLEN]; /* symbolic rep of operand */ 67263508Sdim char d86_prefix[PFIXLEN]; /* any prefix string or "" */ 68263508Sdim uint_t d86_mode; /* mode for immediate */ 69263508Sdim uint_t d86_value_size; /* size in bytes of d86_value */ 70249423Sdim uint64_t d86_value; /* immediate value of opnd */ 71263508Sdim} d86opnd_t; 72263508Sdim 73263508Sdimtypedef struct dis86 { 74263508Sdim uint_t d86_mode; 75249423Sdim uint_t d86_error; 76263508Sdim uint_t d86_len; /* instruction length */ 77263508Sdim int d86_rmindex; /* index of modrm byte or -1 */ 78263508Sdim uint_t d86_memsize; /* size of memory referenced */ 79263508Sdim char d86_bytes[16]; /* bytes of instruction */ 80263508Sdim char d86_mneu[OPLEN]; 81263508Sdim uint_t d86_numopnds; 82263508Sdim uint_t d86_rex_prefix; /* value of REX prefix if !0 */ 83263508Sdim char *d86_seg_prefix; /* segment prefix, if any */ 84263508Sdim uint_t d86_opnd_size; 85263508Sdim uint_t d86_addr_size; 86263508Sdim uint_t d86_got_modrm; 87263508Sdim struct d86opnd d86_opnd[3]; /* up to 3 operands */ 88263508Sdim int (*d86_check_func)(void *); 89263508Sdim int (*d86_get_byte)(void *); 90263508Sdim#ifdef DIS_TEXT 91195098Sed int (*d86_sym_lookup)(void *, uint64_t, char *, size_t); 92263508Sdim int (*d86_sprintf_func)(char *, size_t, const char *, ...); 93263508Sdim int d86_flags; 94263508Sdim uint_t d86_imm_bytes; 95263508Sdim#endif 96263508Sdim void *d86_data; 97263508Sdim} dis86_t; 98195098Sed 99263508Sdimextern int dtrace_disx86(dis86_t *x, uint_t cpu_mode); 100263508Sdim 101263508Sdim#define DIS_OP_OCTAL 0x1 /* Print all numbers in octal */ 102263508Sdim 103263508Sdim#ifdef DIS_TEXT 104263508Sdimextern void dtrace_disx86_str(dis86_t *x, uint_t cpu_mode, uintptr_t pc, 105263508Sdim char *buf, size_t len); 106263508Sdim#endif 107263508Sdim 108263508Sdim#ifdef __cplusplus 109263508Sdim} 110263508Sdim#endif 111223017Sdim 112263508Sdim#endif /* _DIS_TABLES_H */ 113263508Sdim