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