-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathi386.py
More file actions
54 lines (45 loc) · 1.04 KB
/
i386.py
File metadata and controls
54 lines (45 loc) · 1.04 KB
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
"""i386 architecture definition."""
from arch.base_arch import BaseArch, FlagRegister
class I386(BaseArch):
"""
These are currently hardcoded for i386.
"""
bits = 32
max_instr_size = 15
gpr_registers = [
"eax",
"ebx",
"ecx",
"edx",
"edi",
"esi",
"ebp",
"esp",
"eip",
"cs",
"fs",
"gs",
"ss",
"ds",
"es",
]
gpr_key = "general purpose"
# Bitmasks used to extract flag bits from eflags register value
_eflags_register_bit_masks = {
"zero": 0x40,
"carry": 0x1,
"parity": 0x4,
"adjust": 0x10,
"sign": 0x80,
"trap": 0x100,
"interrupt": 0x200,
"direction": 0x400,
"overflow": 0x800,
"resume": 0x10000,
"virtual8086": 0x20000,
"identification": 0x200000,
}
flag_registers = [
FlagRegister("eflags", _eflags_register_bit_masks),
FlagRegister("rflags", _eflags_register_bit_masks),
]