pyvex 9.2.189__cp311-cp311-macosx_11_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pyvex might be problematic. Click here for more details.
- pyvex/__init__.py +92 -0
- pyvex/_register_info.py +1800 -0
- pyvex/arches.py +94 -0
- pyvex/block.py +697 -0
- pyvex/const.py +426 -0
- pyvex/const_val.py +26 -0
- pyvex/data_ref.py +55 -0
- pyvex/enums.py +156 -0
- pyvex/errors.py +31 -0
- pyvex/expr.py +974 -0
- pyvex/include/libvex.h +1029 -0
- pyvex/include/libvex_basictypes.h +236 -0
- pyvex/include/libvex_emnote.h +142 -0
- pyvex/include/libvex_guest_amd64.h +252 -0
- pyvex/include/libvex_guest_arm.h +224 -0
- pyvex/include/libvex_guest_arm64.h +203 -0
- pyvex/include/libvex_guest_mips32.h +175 -0
- pyvex/include/libvex_guest_mips64.h +173 -0
- pyvex/include/libvex_guest_offsets.h +941 -0
- pyvex/include/libvex_guest_ppc32.h +298 -0
- pyvex/include/libvex_guest_ppc64.h +343 -0
- pyvex/include/libvex_guest_riscv64.h +148 -0
- pyvex/include/libvex_guest_s390x.h +201 -0
- pyvex/include/libvex_guest_tilegx.h +149 -0
- pyvex/include/libvex_guest_x86.h +322 -0
- pyvex/include/libvex_ir.h +3113 -0
- pyvex/include/libvex_s390x_common.h +123 -0
- pyvex/include/libvex_trc_values.h +99 -0
- pyvex/include/pyvex.h +96 -0
- pyvex/lib/libpyvex.dylib +0 -0
- pyvex/lifting/__init__.py +18 -0
- pyvex/lifting/gym/README.md +7 -0
- pyvex/lifting/gym/__init__.py +5 -0
- pyvex/lifting/gym/aarch64_spotter.py +40 -0
- pyvex/lifting/gym/arm_spotter.py +427 -0
- pyvex/lifting/gym/x86_spotter.py +129 -0
- pyvex/lifting/libvex.py +117 -0
- pyvex/lifting/lift_function.py +304 -0
- pyvex/lifting/lifter.py +124 -0
- pyvex/lifting/post_processor.py +16 -0
- pyvex/lifting/util/__init__.py +14 -0
- pyvex/lifting/util/instr_helper.py +422 -0
- pyvex/lifting/util/lifter_helper.py +154 -0
- pyvex/lifting/util/syntax_wrapper.py +312 -0
- pyvex/lifting/util/vex_helper.py +301 -0
- pyvex/lifting/zerodivision.py +71 -0
- pyvex/native.py +63 -0
- pyvex/py.typed +1 -0
- pyvex/stmt.py +740 -0
- pyvex/types.py +48 -0
- pyvex/utils.py +63 -0
- pyvex/vex_ffi.py +1453 -0
- pyvex-9.2.189.dist-info/METADATA +181 -0
- pyvex-9.2.189.dist-info/RECORD +59 -0
- pyvex-9.2.189.dist-info/WHEEL +6 -0
- pyvex-9.2.189.dist-info/licenses/LICENSE +24 -0
- pyvex-9.2.189.dist-info/licenses/pyvex_c/LICENSE +339 -0
- pyvex-9.2.189.dist-info/licenses/vex/LICENSE.GPL +340 -0
- pyvex-9.2.189.dist-info/licenses/vex/LICENSE.README +23 -0
pyvex/arches.py
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
from ._register_info import REGISTER_OFFSETS
|
|
2
|
+
from .enums import default_vex_archinfo, vex_endness_from_string
|
|
3
|
+
from .types import Register
|
|
4
|
+
from .vex_ffi import guest_offsets
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class PyvexArch:
|
|
8
|
+
"""
|
|
9
|
+
An architecture definition for use with pyvex - usable version.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
def __init__(self, name: str, bits: int, memory_endness: str, instruction_endness: str = "Iend_BE"):
|
|
13
|
+
self.name = name
|
|
14
|
+
self.bits = bits
|
|
15
|
+
self.memory_endness = memory_endness
|
|
16
|
+
self.instruction_endness = instruction_endness
|
|
17
|
+
self.byte_width = 8
|
|
18
|
+
self.register_list: list[Register] = []
|
|
19
|
+
self.registers: dict[str, tuple[int, int]] = {}
|
|
20
|
+
self.vex_arch = {
|
|
21
|
+
"X86": "VexArchX86",
|
|
22
|
+
"AMD64": "VexArchAMD64",
|
|
23
|
+
"ARM": "VexArchARM",
|
|
24
|
+
"ARM64": "VexArchARM64",
|
|
25
|
+
"PPC32": "VexArchPPC32",
|
|
26
|
+
"PPC64": "VexArchPPC64",
|
|
27
|
+
"S390X": "VexArchS390X",
|
|
28
|
+
"MIPS32": "VexArchMIPS32",
|
|
29
|
+
"MIPS64": "VexArchMIPS64",
|
|
30
|
+
"RISCV64": "VexArchRISCV64",
|
|
31
|
+
}[name]
|
|
32
|
+
self.ip_offset = guest_offsets[
|
|
33
|
+
(
|
|
34
|
+
self.vex_name_small,
|
|
35
|
+
{
|
|
36
|
+
"X86": "eip",
|
|
37
|
+
"AMD64": "rip",
|
|
38
|
+
"ARM": "r15t",
|
|
39
|
+
"ARM64": "pc",
|
|
40
|
+
"PPC32": "cia",
|
|
41
|
+
"PPC64": "cia",
|
|
42
|
+
"S390X": "ia",
|
|
43
|
+
"MIPS32": "pc",
|
|
44
|
+
"MIPS64": "pc",
|
|
45
|
+
"RISCV64": "pc",
|
|
46
|
+
}[name],
|
|
47
|
+
)
|
|
48
|
+
]
|
|
49
|
+
self.vex_archinfo = default_vex_archinfo()
|
|
50
|
+
if memory_endness == "Iend_BE":
|
|
51
|
+
self.vex_archinfo["endness"] = vex_endness_from_string("VexEndnessBE")
|
|
52
|
+
|
|
53
|
+
def __repr__(self):
|
|
54
|
+
return f"<PyvexArch {self.name}>"
|
|
55
|
+
|
|
56
|
+
@property
|
|
57
|
+
def vex_name_small(self):
|
|
58
|
+
return self.vex_arch[7:].lower()
|
|
59
|
+
|
|
60
|
+
def translate_register_name(self, offset, size=None): # pylint: disable=unused-argument
|
|
61
|
+
for (arch, reg), offset2 in guest_offsets.items():
|
|
62
|
+
if arch == self.vex_name_small and offset2 == offset:
|
|
63
|
+
return reg
|
|
64
|
+
for (arch, reg), offset2 in REGISTER_OFFSETS.items():
|
|
65
|
+
if arch == self.vex_name_small and offset2 == offset:
|
|
66
|
+
return reg
|
|
67
|
+
return str(offset)
|
|
68
|
+
|
|
69
|
+
def get_register_offset(self, name: str) -> int:
|
|
70
|
+
arch_reg_tuple = (self.vex_name_small, name)
|
|
71
|
+
if arch_reg_tuple in guest_offsets:
|
|
72
|
+
return guest_offsets[arch_reg_tuple]
|
|
73
|
+
elif arch_reg_tuple in REGISTER_OFFSETS:
|
|
74
|
+
return REGISTER_OFFSETS[arch_reg_tuple]
|
|
75
|
+
else:
|
|
76
|
+
raise KeyError(f"Unknown register {name} for architecture {self.name}")
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
ARCH_X86 = PyvexArch("X86", 32, "Iend_LE")
|
|
80
|
+
ARCH_AMD64 = PyvexArch("AMD64", 64, "Iend_LE")
|
|
81
|
+
ARCH_ARM_LE = PyvexArch("ARM", 32, "Iend_LE", instruction_endness="Iend_LE")
|
|
82
|
+
ARCH_ARM_BE_LE = PyvexArch("ARM", 32, "Iend_BE", instruction_endness="Iend_LE")
|
|
83
|
+
ARCH_ARM_BE = PyvexArch("ARM", 32, "Iend_LE")
|
|
84
|
+
ARCH_ARM64_LE = PyvexArch("ARM64", 64, "Iend_LE", instruction_endness="Iend_LE")
|
|
85
|
+
ARCH_ARM64_BE = PyvexArch("ARM64", 64, "Iend_BE")
|
|
86
|
+
ARCH_PPC32 = PyvexArch("PPC32", 32, "Iend_BE")
|
|
87
|
+
ARCH_PPC64_BE = PyvexArch("PPC64", 64, "Iend_BE")
|
|
88
|
+
ARCH_PPC64_LE = PyvexArch("PPC64", 64, "Iend_LE")
|
|
89
|
+
ARCH_S390X = PyvexArch("S390X", 64, "Iend_BE")
|
|
90
|
+
ARCH_MIPS32_BE = PyvexArch("MIPS32", 32, "Iend_BE")
|
|
91
|
+
ARCH_MIPS32_LE = PyvexArch("MIPS32", 32, "Iend_LE")
|
|
92
|
+
ARCH_MIPS64_BE = PyvexArch("MIPS64", 64, "Iend_BE")
|
|
93
|
+
ARCH_MIPS64_LE = PyvexArch("MIPS64", 64, "Iend_LE")
|
|
94
|
+
ARCH_RISCV64_LE = PyvexArch("RISCV64", 64, "Iend_LE", instruction_endness="Iend_LE")
|