1/* $NetBSD$ */ 2 3/* 4 * CDDL HEADER START 5 * 6 * The contents of this file are subject to the terms of the 7 * Common Development and Distribution License (the "License"). 8 * You may not use this file except in compliance with the License. 9 * 10 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 11 * or http://www.opensolaris.org/os/licensing. 12 * See the License for the specific language governing permissions 13 * and limitations under the License. 14 * 15 * When distributing Covered Code, include this CDDL HEADER in each 16 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 17 * If applicable, add the following below this CDDL HEADER, with the 18 * fields enclosed by brackets "[]" replaced with your own identifying 19 * information: Portions Copyright [yyyy] [name of copyright owner] 20 * 21 * CDDL HEADER END 22 * 23 * $FreeBSD: src/sys/cddl/dev/dtrace/amd64/dis_tables.h,v 1.1.4.1 2009/08/03 08:13:06 kensmith Exp $ 24 */ 25/* 26 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 27 * Use is subject to license terms. 28 */ 29 30/* Copyright (c) 1988 AT&T */ 31/* All Rights Reserved */ 32 33 34#ifndef _DIS_TABLES_H 35#define _DIS_TABLES_H 36 37#if defined(sun) 38#pragma ident "@(#)dis_tables.h 1.7 06/03/02 SMI" 39#endif 40 41/* 42 * Constants and prototypes for the IA32 disassembler backend. See dis_tables.c 43 * for usage information and documentation. 44 */ 45 46#ifdef __cplusplus 47extern "C" { 48#endif 49 50#include <sys/types.h> 51#include <sys/param.h> 52 53/* 54 * values for cpu mode 55 */ 56#define SIZE16 1 57#define SIZE32 2 58#define SIZE64 3 59 60#define OPLEN 256 61#define PFIXLEN 8 62#define NCPS 12 /* number of chars per symbol */ 63 64/* 65 * data structures that must be provided to dtrace_dis86() 66 */ 67typedef struct d86opnd { 68 char d86_opnd[OPLEN]; /* symbolic rep of operand */ 69 char d86_prefix[PFIXLEN]; /* any prefix string or "" */ 70 uint_t d86_mode; /* mode for immediate */ 71 uint_t d86_value_size; /* size in bytes of d86_value */ 72 uint64_t d86_value; /* immediate value of opnd */ 73} d86opnd_t; 74 75typedef struct dis86 { 76 uint_t d86_mode; 77 uint_t d86_error; 78 uint_t d86_len; /* instruction length */ 79 int d86_rmindex; /* index of modrm byte or -1 */ 80 uint_t d86_memsize; /* size of memory referenced */ 81 char d86_bytes[16]; /* bytes of instruction */ 82 char d86_mneu[OPLEN]; 83 uint_t d86_numopnds; 84 uint_t d86_rex_prefix; /* value of REX prefix if !0 */ 85 char *d86_seg_prefix; /* segment prefix, if any */ 86 uint_t d86_opnd_size; 87 uint_t d86_addr_size; 88 uint_t d86_got_modrm; 89 struct d86opnd d86_opnd[3]; /* up to 3 operands */ 90 int (*d86_check_func)(void *); 91 int (*d86_get_byte)(void *); 92#ifdef DIS_TEXT 93 int (*d86_sym_lookup)(void *, uint64_t, char *, size_t); 94 int (*d86_sprintf_func)(char *, size_t, const char *, ...); 95 int d86_flags; 96 uint_t d86_imm_bytes; 97#endif 98 void *d86_data; 99} dis86_t; 100 101extern int dtrace_disx86(dis86_t *x, uint_t cpu_mode); 102 103#define DIS_OP_OCTAL 0x1 /* Print all numbers in octal */ 104 105#ifdef DIS_TEXT 106extern void dtrace_disx86_str(dis86_t *x, uint_t cpu_mode, uintptr_t pc, 107 char *buf, size_t len); 108#endif 109 110#ifdef __cplusplus 111} 112#endif 113 114#endif /* _DIS_TABLES_H */ 115