VirtualBox

source: vbox/trunk/src/VBox/Disassembler/DisasmInternal.h@ 48030

Last change on this file since 48030 was 41796, checked in by vboxsync, 13 years ago

DIS: Dropped most of the little hacks in the groups for dealing with instructions that doesn't actually parse modrm bytes. Only group 7 and the FPU instructions are left with this hack.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.1 KB
Line 
1/* $Id: DisasmInternal.h 41796 2012-06-17 01:40:36Z vboxsync $ */
2/** @file
3 * VBox disassembler - Internal header.
4 */
5
6/*
7 * Copyright (C) 2006-2012 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef ___DisasmInternal_h___
19#define ___DisasmInternal_h___
20
21#include <VBox/types.h>
22#include <VBox/dis.h>
23
24
25/** @defgroup grp_dis_int Internals.
26 * @ingroup grp_dis
27 * @{
28 */
29
30/** @name Index into g_apfnCalcSize and g_apfnFullDisasm.
31 * @{ */
32#define IDX_ParseNop 0
33#define IDX_ParseModRM 1
34#define IDX_UseModRM 2
35#define IDX_ParseImmByte 3
36#define IDX_ParseImmBRel 4
37#define IDX_ParseImmUshort 5
38#define IDX_ParseImmV 6
39#define IDX_ParseImmVRel 7
40#define IDX_ParseImmAddr 8
41#define IDX_ParseFixedReg 9
42#define IDX_ParseImmUlong 10
43#define IDX_ParseImmQword 11
44#define IDX_ParseTwoByteEsc 12
45#define IDX_ParseImmGrpl 13
46#define IDX_ParseShiftGrp2 14
47#define IDX_ParseGrp3 15
48#define IDX_ParseGrp4 16
49#define IDX_ParseGrp5 17
50#define IDX_Parse3DNow 18
51#define IDX_ParseGrp6 19
52#define IDX_ParseGrp7 20
53#define IDX_ParseGrp8 21
54#define IDX_ParseGrp9 22
55#define IDX_ParseGrp10 23
56#define IDX_ParseGrp12 24
57#define IDX_ParseGrp13 25
58#define IDX_ParseGrp14 26
59#define IDX_ParseGrp15 27
60#define IDX_ParseGrp16 28
61#define IDX_ParseModFence 29
62#define IDX_ParseYv 30
63#define IDX_ParseYb 31
64#define IDX_ParseXv 32
65#define IDX_ParseXb 33
66#define IDX_ParseEscFP 34
67#define IDX_ParseNopPause 35
68#define IDX_ParseImmByteSX 36
69#define IDX_ParseImmZ 37
70#define IDX_ParseThreeByteEsc4 38
71#define IDX_ParseThreeByteEsc5 39
72#define IDX_ParseImmAddrF 40
73#define IDX_ParseInvOpModRM 41
74#define IDX_ParseMax (IDX_ParseInvOpModRM+1)
75/** @} */
76
77
78/** @name Opcode maps.
79 * @{ */
80extern const DISOPCODE g_InvalidOpcode[1];
81
82extern const DISOPCODE g_aOneByteMapX86[256];
83extern const DISOPCODE g_aOneByteMapX64[256];
84extern const DISOPCODE g_aTwoByteMapX86[256];
85
86/** Two byte opcode map with prefix 0x66 */
87extern const DISOPCODE g_aTwoByteMapX86_PF66[256];
88
89/** Two byte opcode map with prefix 0xF2 */
90extern const DISOPCODE g_aTwoByteMapX86_PFF2[256];
91
92/** Two byte opcode map with prefix 0xF3 */
93extern const DISOPCODE g_aTwoByteMapX86_PFF3[256];
94
95/** Three byte opcode map (0xF 0x38) */
96extern PCDISOPCODE const g_apThreeByteMapX86_0F38[16];
97
98/** Three byte opcode map with prefix 0x66 (0xF 0x38) */
99extern PCDISOPCODE const g_apThreeByteMapX86_660F38[16];
100
101/** Three byte opcode map with prefix 0xF2 (0xF 0x38) */
102extern PCDISOPCODE const g_apThreeByteMapX86_F20F38[16];
103
104/** Three byte opcode map with prefix 0x66 (0xF 0x3A) */
105extern PCDISOPCODE const g_apThreeByteMapX86_660F3A[16];
106/** @} */
107
108/** @name Opcode extensions (Group tables)
109 * @{ */
110extern const DISOPCODE g_aMapX86_Group1[8*4];
111extern const DISOPCODE g_aMapX86_Group2[8*6];
112extern const DISOPCODE g_aMapX86_Group3[8*2];
113extern const DISOPCODE g_aMapX86_Group4[8];
114extern const DISOPCODE g_aMapX86_Group5[8];
115extern const DISOPCODE g_aMapX86_Group6[8];
116extern const DISOPCODE g_aMapX86_Group7_mem[8];
117extern const DISOPCODE g_aMapX86_Group7_mod11_rm000[8];
118extern const DISOPCODE g_aMapX86_Group7_mod11_rm001[8];
119extern const DISOPCODE g_aMapX86_Group8[8];
120extern const DISOPCODE g_aMapX86_Group9[8];
121extern const DISOPCODE g_aMapX86_Group10[8];
122extern const DISOPCODE g_aMapX86_Group11[8*2];
123extern const DISOPCODE g_aMapX86_Group12[8*2];
124extern const DISOPCODE g_aMapX86_Group13[8*2];
125extern const DISOPCODE g_aMapX86_Group14[8*2];
126extern const DISOPCODE g_aMapX86_Group15_mem[8];
127extern const DISOPCODE g_aMapX86_Group15_mod11_rm000[8];
128extern const DISOPCODE g_aMapX86_Group16[8];
129extern const DISOPCODE g_aMapX86_NopPause[2];
130/** @} */
131
132/** 3DNow! map (0x0F 0x0F prefix) */
133extern const DISOPCODE g_aTwoByteMapX86_3DNow[256];
134
135/** Floating point opcodes starting with escape byte 0xDF
136 * @{ */
137extern const DISOPCODE g_aMapX86_EscF0_Low[8];
138extern const DISOPCODE g_aMapX86_EscF0_High[16*4];
139extern const DISOPCODE g_aMapX86_EscF1_Low[8];
140extern const DISOPCODE g_aMapX86_EscF1_High[16*4];
141extern const DISOPCODE g_aMapX86_EscF2_Low[8];
142extern const DISOPCODE g_aMapX86_EscF2_High[16*4];
143extern const DISOPCODE g_aMapX86_EscF3_Low[8];
144extern const DISOPCODE g_aMapX86_EscF3_High[16*4];
145extern const DISOPCODE g_aMapX86_EscF4_Low[8];
146extern const DISOPCODE g_aMapX86_EscF4_High[16*4];
147extern const DISOPCODE g_aMapX86_EscF5_Low[8];
148extern const DISOPCODE g_aMapX86_EscF5_High[16*4];
149extern const DISOPCODE g_aMapX86_EscF6_Low[8];
150extern const DISOPCODE g_aMapX86_EscF6_High[16*4];
151extern const DISOPCODE g_aMapX86_EscF7_Low[8];
152extern const DISOPCODE g_aMapX86_EscF7_High[16*4];
153
154extern const PCDISOPCODE g_apMapX86_FP_Low[8];
155extern const PCDISOPCODE g_apMapX86_FP_High[8];
156/** @} */
157
158/** @def OP
159 * Wrapper which initializes an OPCODE.
160 * We must use this so that we can exclude unused fields in order
161 * to save precious bytes in the GC version.
162 *
163 * @internal
164 */
165#ifndef DIS_CORE_ONLY
166# define OP(pszOpcode, idxParse1, idxParse2, idxParse3, opcode, param1, param2, param3, optype) \
167 { pszOpcode, idxParse1, idxParse2, idxParse3, 0, opcode, param1, param2, param3, optype }
168#else
169# define OP(pszOpcode, idxParse1, idxParse2, idxParse3, opcode, param1, param2, param3, optype) \
170 { idxParse1, idxParse2, idxParse3, 0, opcode, param1, param2, param3, optype }
171#endif
172
173
174size_t disFormatBytes(PCDISSTATE pDis, char *pszDst, size_t cchDst, uint32_t fFlags);
175
176/** @} */
177#endif
178
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette