]>
Commit | Line | Data |
---|---|---|
2d21ac55 A |
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 | /* | |
b0d623f7 | 22 | * Copyright 2007 Sun Microsystems, Inc. All rights reserved. |
2d21ac55 A |
23 | * Use is subject to license terms. |
24 | */ | |
25 | ||
26 | /* Copyright (c) 1988 AT&T */ | |
27 | /* All Rights Reserved */ | |
28 | ||
29 | ||
30 | #ifndef _DIS_TABLES_H | |
31 | #define _DIS_TABLES_H | |
32 | ||
b0d623f7 | 33 | /* #pragma ident "@(#)dis_tables.h 1.10 07/07/10 SMI" */ |
2d21ac55 A |
34 | |
35 | /* | |
36 | * Constants and prototypes for the IA32 disassembler backend. See dis_tables.c | |
37 | * for usage information and documentation. | |
38 | */ | |
39 | ||
5ba3f43e A |
40 | /* |
41 | * APPLE NOTE: There is a copy of this file for userspace in | |
42 | * dtrace:sys_dis_tables.h | |
43 | * | |
44 | * It needs to be in sync with this file. | |
45 | */ | |
46 | ||
2d21ac55 A |
47 | #ifdef __cplusplus |
48 | extern "C" { | |
49 | #endif | |
50 | ||
2d21ac55 A |
51 | #include <sys/types.h> |
52 | #include <stdint.h> | |
53 | #include <sys/param.h> | |
2d21ac55 A |
54 | |
55 | /* | |
56 | * values for cpu mode | |
57 | */ | |
58 | #define SIZE16 1 | |
59 | #define SIZE32 2 | |
60 | #define SIZE64 3 | |
61 | ||
62 | #define OPLEN 256 | |
63 | #define PFIXLEN 8 | |
5ba3f43e | 64 | #define NCPS 20 /* number of chars per symbol */ |
2d21ac55 A |
65 | |
66 | /* | |
67 | * data structures that must be provided to dtrace_dis86() | |
68 | */ | |
69 | typedef struct d86opnd { | |
70 | char d86_opnd[OPLEN]; /* symbolic rep of operand */ | |
71 | char d86_prefix[PFIXLEN]; /* any prefix string or "" */ | |
72 | uint_t d86_mode; /* mode for immediate */ | |
73 | uint_t d86_value_size; /* size in bytes of d86_value */ | |
74 | uint64_t d86_value; /* immediate value of opnd */ | |
75 | } d86opnd_t; | |
76 | ||
77 | typedef struct dis86 { | |
78 | uint_t d86_mode; | |
79 | uint_t d86_error; | |
80 | uint_t d86_len; /* instruction length */ | |
81 | int d86_rmindex; /* index of modrm byte or -1 */ | |
82 | uint_t d86_memsize; /* size of memory referenced */ | |
83 | char d86_bytes[16]; /* bytes of instruction */ | |
84 | char d86_mnem[OPLEN]; | |
85 | uint_t d86_numopnds; | |
86 | uint_t d86_rex_prefix; /* value of REX prefix if !0 */ | |
87 | char *d86_seg_prefix; /* segment prefix, if any */ | |
88 | uint_t d86_opnd_size; | |
89 | uint_t d86_addr_size; | |
90 | uint_t d86_got_modrm; | |
5ba3f43e | 91 | uint_t d86_vsib; /* Has a VSIB */ |
b0d623f7 | 92 | struct d86opnd d86_opnd[4]; /* up to 4 operands */ |
2d21ac55 A |
93 | int (*d86_check_func)(void *); |
94 | int (*d86_get_byte)(void *); | |
95 | #ifdef DIS_TEXT | |
96 | int (*d86_sym_lookup)(void *, uint64_t, char *, size_t); | |
97 | int (*d86_sprintf_func)(char *, size_t, const char *, ...); | |
98 | int d86_flags; | |
99 | uint_t d86_imm_bytes; | |
100 | #endif | |
101 | void *d86_data; | |
102 | } dis86_t; | |
103 | ||
104 | extern int dtrace_disx86(dis86_t *x, uint_t cpu_mode); | |
105 | ||
106 | #define DIS_F_OCTAL 0x1 /* Print all numbers in octal */ | |
b0d623f7 | 107 | #define DIS_F_NOIMMSYM 0x2 /* Don't print symbols for immediates (.o) */ |
2d21ac55 A |
108 | |
109 | #ifdef DIS_TEXT | |
110 | extern void dtrace_disx86_str(dis86_t *x, uint_t cpu_mode, uint64_t pc, | |
111 | char *buf, size_t len); | |
112 | #endif | |
113 | ||
114 | #ifdef __cplusplus | |
115 | } | |
116 | #endif | |
117 | ||
118 | #endif /* _DIS_TABLES_H */ | |
119 |