Path: blob/main/sys/cddl/dev/dtrace/x86/dis_tables.h
48375 views
/*1* CDDL HEADER START2*3* The contents of this file are subject to the terms of the4* Common Development and Distribution License (the "License").5* You may not use this file except in compliance with the License.6*7* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE8* or http://www.opensolaris.org/os/licensing.9* See the License for the specific language governing permissions10* and limitations under the License.11*12* When distributing Covered Code, include this CDDL HEADER in each13* file and include the License file at usr/src/OPENSOLARIS.LICENSE.14* If applicable, add the following below this CDDL HEADER, with the15* fields enclosed by brackets "[]" replaced with your own identifying16* information: Portions Copyright [yyyy] [name of copyright owner]17*18* CDDL HEADER END19*/20/*21* Copyright 2009 Sun Microsystems, Inc. All rights reserved.22* Use is subject to license terms.23*/2425/* Copyright (c) 1988 AT&T */26/* All Rights Reserved */2728/*29*/3031#ifndef _DIS_TABLES_H32#define _DIS_TABLES_H3334/*35* Constants and prototypes for the IA32 disassembler backend. See dis_tables.c36* for usage information and documentation.37*/3839#ifdef __cplusplus40extern "C" {41#endif4243#include <sys/types.h>44#include <sys/param.h>4546/*47* values for cpu mode48*/49#define SIZE16 150#define SIZE32 251#define SIZE64 35253#define OPLEN 25654#define PFIXLEN 855#define NCPS 20 /* number of chars per symbol */5657/*58* data structures that must be provided to dtrace_dis86()59*/60typedef struct d86opnd {61char d86_opnd[OPLEN]; /* symbolic rep of operand */62char d86_prefix[PFIXLEN]; /* any prefix string or "" */63uint_t d86_mode; /* mode for immediate */64uint_t d86_value_size; /* size in bytes of d86_value */65uint64_t d86_value; /* immediate value of opnd */66} d86opnd_t;6768typedef struct dis86 {69uint_t d86_mode;70uint_t d86_error;71uint_t d86_len; /* instruction length */72int d86_rmindex; /* index of modrm byte or -1 */73uint_t d86_memsize; /* size of memory referenced */74char d86_bytes[16]; /* bytes of instruction */75char d86_mnem[OPLEN];76uint_t d86_numopnds;77uint_t d86_rex_prefix; /* value of REX prefix if !0 */78char *d86_seg_prefix; /* segment prefix, if any */79uint_t d86_opnd_size;80uint_t d86_addr_size;81uint_t d86_got_modrm;82uint_t d86_vsib; /* Has a VSIB */83struct d86opnd d86_opnd[4]; /* up to 4 operands */84int (*d86_check_func)(void *);85int (*d86_get_byte)(void *);86#ifdef DIS_TEXT87int (*d86_sym_lookup)(void *, uint64_t, char *, size_t);88int (*d86_sprintf_func)(char *, size_t, const char *, ...);89int d86_flags;90uint_t d86_imm_bytes;91#endif92void *d86_data;93} dis86_t;9495extern int dtrace_disx86(dis86_t *x, uint_t cpu_mode);9697#define DIS_F_OCTAL 0x1 /* Print all numbers in octal */98#define DIS_F_NOIMMSYM 0x2 /* Don't print symbols for immediates (.o) */99100#ifdef DIS_TEXT101extern void dtrace_disx86_str(dis86_t *x, uint_t cpu_mode, uint64_t pc,102char *buf, size_t len);103#endif104105#ifdef __cplusplus106}107#endif108109#endif /* _DIS_TABLES_H */110111112