-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathx86_64.py
More file actions
58 lines (49 loc) · 1.22 KB
/
x86_64.py
File metadata and controls
58 lines (49 loc) · 1.22 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
55
56
57
58
"""x86_64 architecture definition."""
from arch.base_arch import BaseArch, FlagRegister
class X86_64(BaseArch):
"""
These are currently hardcoded for X86_64.
"""
bits = 64
max_instr_size = 15
gpr_registers = [
"rax",
"rbx",
"rcx",
"rdx",
"rdi",
"rsi",
"r8",
"r9",
"r10",
"r11",
"r12",
"r13",
"r14",
"r15",
"rsp",
"rbp",
"rip",
]
gpr_key = "general purpose"
# Bitmasks used to extract flag bits from eflags register value
_eflag_register_bit_masks = {
"zero": 0x40,
"carry": 0x1,
"parity": 0x4,
"adjust": 0x10,
"sign": 0x80,
"trap": 0x100,
"interrupt": 0x200,
"direction": 0x400,
"overflow": 0x800,
"resume": 0x10000,
"virtualx86": 0x20000,
"identification": 0x200000,
}
# Whether LLDB exposes eflags or rflags varies depending on the platform
# rflags and eflags bit masks are identical for the lower 32-bits
flag_registers = [
FlagRegister("rflags", _eflag_register_bit_masks),
FlagRegister("eflags", _eflag_register_bit_masks),
]