-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathModRmFlagsTables.inc
130 lines (117 loc) · 5.29 KB
/
ModRmFlagsTables.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
// **************************************************************************************************
// Part of x86 Instruction Decode Library [InstDecode]
//
// https://github.com/MahdiSafsafi/DDetours
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License, v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at
// https://mozilla.org/MPL/2.0/.
// **************************************************************************************************
{ Reference : Intel® 64 and IA-32 Architectures Software Developer’s Manual Vol 2 }
type
TModRmFlagsArray = array [Byte] of Byte;
PModRmFlagsArray = ^TModRmFlagsArray;
{
ModRMFlags :
Bits:4 3 2 1 0 .
Bit 0 : Set ==> Register Indirect Addressing Mode .
Bit 1 : Set ==> Displacement 8 bit .
Bit 2 : Set ==> Displacement 16 bit .
Bit 3 : Set ==> Displacement 32 bit.
Bit 4 : Set ==> SIB Used .
Values:
$00 ==> Register .
$01 ==> Register Indirect Addressing Mode with No Displacement .
$03 ==> Register Indirect Addressing Mode + 8 bit Displacement .
$04 ==> 16 bit Displacement only without register .
$05 ==> Register Indirect Addressing Mode + 16 bit Displacement .
$08 ==> 32 bit Displacement only without register .
$09 ==> Register Indirect Addressing Mode + 32 bit Displacement .
$11 ==> Register Indirect Addressing Mode + SIB .
$13 ==> Register Indirect Addressing Mode + SIB + 8 bit Displacement .
$19 ==> Register Indirect Addressing Mode + SIB + 32 bit Displacement .
}
const
ModRM16Flags: TModRmFlagsArray = (
{ => Mod=00b <= }
$01, $01, $01, $01, $01, $01, $04, $01, { 00 }
$01, $01, $01, $01, $01, $01, $04, $01, { 00 }
$01, $01, $01, $01, $01, $01, $04, $01, { 00 }
$01, $01, $01, $01, $01, $01, $04, $01, { 00 }
$01, $01, $01, $01, $01, $01, $04, $01, { 00 }
$01, $01, $01, $01, $01, $01, $04, $01, { 00 }
$01, $01, $01, $01, $01, $01, $04, $01, { 00 }
$01, $01, $01, $01, $01, $01, $04, $01, { 00 }
{ => Mod=01b <= }
$03, $03, $03, $03, $03, $03, $03, $03, { 01 }
$03, $03, $03, $03, $03, $03, $03, $03, { 01 }
$03, $03, $03, $03, $03, $03, $03, $03, { 01 }
$03, $03, $03, $03, $03, $03, $03, $03, { 01 }
$03, $03, $03, $03, $03, $03, $03, $03, { 01 }
$03, $03, $03, $03, $03, $03, $03, $03, { 01 }
$03, $03, $03, $03, $03, $03, $03, $03, { 01 }
$03, $03, $03, $03, $03, $03, $03, $03, { 01 }
{ => Mod=10b <= }
$05, $05, $05, $05, $05, $05, $05, $05, { 10 }
$05, $05, $05, $05, $05, $05, $05, $05, { 10 }
$05, $05, $05, $05, $05, $05, $05, $05, { 10 }
$05, $05, $05, $05, $05, $05, $05, $05, { 10 }
$05, $05, $05, $05, $05, $05, $05, $05, { 10 }
$05, $05, $05, $05, $05, $05, $05, $05, { 10 }
$05, $05, $05, $05, $05, $05, $05, $05, { 10 }
$05, $05, $05, $05, $05, $05, $05, $05, { 10 }
{ => Mod=11b <= }
$00, $00, $00, $00, $00, $00, $00, $00, { 11 }
$00, $00, $00, $00, $00, $00, $00, $00, { 11 }
$00, $00, $00, $00, $00, $00, $00, $00, { 11 }
$00, $00, $00, $00, $00, $00, $00, $00, { 11 }
$00, $00, $00, $00, $00, $00, $00, $00, { 11 }
$00, $00, $00, $00, $00, $00, $00, $00, { 11 }
$00, $00, $00, $00, $00, $00, $00, $00, { 11 }
$00, $00, $00, $00, $00, $00, $00, $00 { 11 }
);
ModRM32Flags: TModRmFlagsArray = (
{ => Mod=00b <= }
$01, $01, $01, $01, $11, $08, $01, $01, { 00 }
$01, $01, $01, $01, $11, $08, $01, $01, { 00 }
$01, $01, $01, $01, $11, $08, $01, $01, { 00 }
$01, $01, $01, $01, $11, $08, $01, $01, { 00 }
$01, $01, $01, $01, $11, $08, $01, $01, { 00 }
$01, $01, $01, $01, $11, $08, $01, $01, { 00 }
$01, $01, $01, $01, $11, $08, $01, $01, { 00 }
$01, $01, $01, $01, $11, $08, $01, $01, { 00 }
{ => Mod=01b <= }
$03, $03, $03, $03, $13, $03, $03, $03, { 01 }
$03, $03, $03, $03, $13, $03, $03, $03, { 01 }
$03, $03, $03, $03, $13, $03, $03, $03, { 01 }
$03, $03, $03, $03, $13, $03, $03, $03, { 01 }
$03, $03, $03, $03, $13, $03, $03, $03, { 01 }
$03, $03, $03, $03, $13, $03, $03, $03, { 01 }
$03, $03, $03, $03, $13, $03, $03, $03, { 01 }
$03, $03, $03, $03, $13, $03, $03, $03, { 01 }
{ => Mod=10b <= }
$09, $09, $09, $09, $19, $09, $09, $09, { 10 }
$09, $09, $09, $09, $19, $09, $09, $09, { 10 }
$09, $09, $09, $09, $19, $09, $09, $09, { 10 }
$09, $09, $09, $09, $19, $09, $09, $09, { 10 }
$09, $09, $09, $09, $19, $09, $09, $09, { 10 }
$09, $09, $09, $09, $19, $09, $09, $09, { 10 }
$09, $09, $09, $09, $19, $09, $09, $09, { 10 }
$09, $09, $09, $09, $19, $09, $09, $09, { 10 }
{ => Mod=11b <= }
$00, $00, $00, $00, $00, $00, $00, $00, { 11 }
$00, $00, $00, $00, $00, $00, $00, $00, { 11 }
$00, $00, $00, $00, $00, $00, $00, $00, { 11 }
$00, $00, $00, $00, $00, $00, $00, $00, { 11 }
$00, $00, $00, $00, $00, $00, $00, $00, { 11 }
$00, $00, $00, $00, $00, $00, $00, $00, { 11 }
$00, $00, $00, $00, $00, $00, $00, $00, { 11 }
$00, $00, $00, $00, $00, $00, $00, $00 { 11 }
);
ModRmFlags: array [0 .. 3] of PModRmFlagsArray = ( //
nil,
@ModRM16Flags, { AddrMode 16-bits }
@ModRM32Flags, { AddrMode 32-bits }
@ModRM32Flags { AddrMode 64-bits }
);