smallworld-re 1.0.2__py3-none-any.whl → 2.0.0__py3-none-any.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.
- smallworld/analyses/__init__.py +8 -0
- smallworld/analyses/analysis.py +8 -67
- smallworld/analyses/code_coverage.py +1 -2
- smallworld/analyses/colorizer.py +301 -534
- smallworld/analyses/colorizer_def_use.py +217 -0
- smallworld/analyses/colorizer_summary.py +173 -83
- smallworld/analyses/field_detection/field_analysis.py +7 -8
- smallworld/analyses/field_detection/hints.py +1 -1
- smallworld/analyses/field_detection/malloc.py +2 -2
- smallworld/analyses/trace_execution.py +160 -0
- smallworld/analyses/trace_execution_types.py +42 -0
- smallworld/analyses/unstable/angr/divergence.py +1 -2
- smallworld/analyses/unstable/angr/model.py +5 -6
- smallworld/analyses/unstable/angr_nwbt.py +3 -4
- smallworld/analyses/unstable/code_coverage.py +2 -3
- smallworld/analyses/unstable/code_reachable.py +2 -3
- smallworld/analyses/unstable/control_flow_tracer.py +2 -3
- smallworld/analyses/unstable/pointer_finder.py +2 -3
- smallworld/analyses/unstable/utils/tui.py +71 -0
- smallworld/emulators/__init__.py +3 -1
- smallworld/emulators/angr/angr.py +30 -9
- smallworld/emulators/angr/machdefs/__init__.py +2 -0
- smallworld/emulators/angr/machdefs/aarch64.py +1 -1
- smallworld/emulators/angr/machdefs/amd64.py +0 -4
- smallworld/emulators/angr/machdefs/arm.py +0 -2
- smallworld/emulators/angr/machdefs/i386.py +0 -2
- smallworld/emulators/angr/machdefs/loongarch.py +340 -0
- smallworld/emulators/angr/machdefs/machdef.py +1 -8
- smallworld/emulators/angr/machdefs/mips.py +0 -2
- smallworld/emulators/angr/machdefs/mips64.py +0 -2
- smallworld/emulators/angr/machdefs/ppc.py +1 -2
- smallworld/emulators/angr/machdefs/riscv.py +8 -10
- smallworld/emulators/angr/machdefs/xtensa.py +7 -4
- smallworld/emulators/emulator.py +22 -0
- smallworld/emulators/ghidra/__init__.py +37 -0
- smallworld/emulators/ghidra/ghidra.py +513 -0
- smallworld/emulators/ghidra/machdefs/__init__.py +31 -0
- smallworld/emulators/ghidra/machdefs/aarch64.py +289 -0
- smallworld/emulators/ghidra/machdefs/amd64.py +185 -0
- smallworld/emulators/ghidra/machdefs/arm.py +370 -0
- smallworld/emulators/ghidra/machdefs/i386.py +109 -0
- smallworld/emulators/ghidra/machdefs/loongarch.py +162 -0
- smallworld/emulators/ghidra/machdefs/machdef.py +81 -0
- smallworld/emulators/ghidra/machdefs/mips.py +163 -0
- smallworld/emulators/ghidra/machdefs/mips64.py +186 -0
- smallworld/emulators/ghidra/machdefs/ppc.py +98 -0
- smallworld/emulators/ghidra/machdefs/riscv.py +208 -0
- smallworld/emulators/ghidra/machdefs/xtensa.py +21 -0
- smallworld/emulators/ghidra/typing.py +28 -0
- smallworld/emulators/hookable.py +18 -4
- smallworld/emulators/panda/machdefs/__init__.py +2 -2
- smallworld/emulators/panda/machdefs/aarch64.py +186 -11
- smallworld/emulators/panda/machdefs/amd64.py +103 -11
- smallworld/emulators/panda/machdefs/arm.py +216 -20
- smallworld/emulators/panda/machdefs/i386.py +30 -7
- smallworld/emulators/panda/machdefs/machdef.py +9 -16
- smallworld/emulators/panda/machdefs/mips.py +49 -5
- smallworld/emulators/panda/machdefs/mips64.py +57 -5
- smallworld/emulators/panda/machdefs/ppc.py +38 -13
- smallworld/emulators/panda/panda.py +146 -44
- smallworld/emulators/unicorn/__init__.py +2 -0
- smallworld/emulators/unicorn/machdefs/aarch64.py +253 -264
- smallworld/emulators/unicorn/machdefs/amd64.py +254 -259
- smallworld/emulators/unicorn/machdefs/arm.py +200 -212
- smallworld/emulators/unicorn/machdefs/i386.py +84 -90
- smallworld/emulators/unicorn/machdefs/machdef.py +2 -23
- smallworld/emulators/unicorn/machdefs/mips.py +127 -135
- smallworld/emulators/unicorn/unicorn.py +52 -13
- smallworld/helpers.py +4 -19
- smallworld/hinting/hinting.py +22 -192
- smallworld/hinting/hints.py +50 -18
- smallworld/instructions/bsid.py +8 -8
- smallworld/logging.py +4 -2
- smallworld/platforms/__init__.py +12 -0
- smallworld/platforms/defs/__init__.py +36 -0
- smallworld/platforms/defs/aarch64.py +450 -0
- smallworld/platforms/defs/amd64.py +463 -0
- smallworld/platforms/defs/arm.py +519 -0
- smallworld/platforms/defs/i386.py +258 -0
- smallworld/platforms/defs/loongarch.py +270 -0
- smallworld/platforms/defs/mips.py +321 -0
- smallworld/platforms/defs/mips64.py +313 -0
- smallworld/platforms/defs/platformdef.py +97 -0
- smallworld/platforms/defs/powerpc.py +259 -0
- smallworld/platforms/defs/riscv.py +257 -0
- smallworld/platforms/defs/xtensa.py +96 -0
- smallworld/{platforms.py → platforms/platforms.py} +3 -0
- smallworld/state/cpus/__init__.py +2 -0
- smallworld/state/cpus/aarch64.py +0 -9
- smallworld/state/cpus/amd64.py +6 -28
- smallworld/state/cpus/arm.py +0 -11
- smallworld/state/cpus/cpu.py +0 -11
- smallworld/state/cpus/i386.py +0 -7
- smallworld/state/cpus/loongarch.py +299 -0
- smallworld/state/cpus/mips.py +4 -47
- smallworld/state/cpus/mips64.py +18 -58
- smallworld/state/cpus/powerpc.py +2 -9
- smallworld/state/cpus/riscv.py +1 -11
- smallworld/state/cpus/xtensa.py +0 -5
- smallworld/state/memory/code.py +44 -2
- smallworld/state/memory/elf/__init__.py +5 -1
- smallworld/state/memory/elf/coredump/__init__.py +3 -0
- smallworld/state/memory/elf/coredump/coredump.py +46 -0
- smallworld/state/memory/elf/coredump/prstatus/__init__.py +27 -0
- smallworld/state/memory/elf/coredump/prstatus/aarch64.py +46 -0
- smallworld/state/memory/elf/coredump/prstatus/amd64.py +40 -0
- smallworld/state/memory/elf/coredump/prstatus/arm.py +53 -0
- smallworld/state/memory/elf/coredump/prstatus/i386.py +30 -0
- smallworld/state/memory/elf/coredump/prstatus/mips.py +55 -0
- smallworld/state/memory/elf/coredump/prstatus/mips64.py +57 -0
- smallworld/state/memory/elf/coredump/prstatus/ppc.py +82 -0
- smallworld/state/memory/elf/coredump/prstatus/prstatus.py +129 -0
- smallworld/state/memory/elf/elf.py +225 -61
- smallworld/state/memory/elf/register_state.py +36 -0
- smallworld/state/memory/elf/rela/__init__.py +2 -0
- smallworld/state/memory/elf/rela/aarch64.py +3 -1
- smallworld/state/memory/elf/rela/amd64.py +4 -2
- smallworld/state/memory/elf/rela/arm.py +4 -2
- smallworld/state/memory/elf/rela/i386.py +4 -2
- smallworld/state/memory/elf/rela/loongarch.py +32 -0
- smallworld/state/memory/elf/rela/mips.py +39 -18
- smallworld/state/memory/elf/rela/ppc.py +31 -14
- smallworld/state/memory/elf/structs.py +3 -0
- smallworld/state/memory/heap.py +2 -2
- smallworld/state/memory/memory.py +18 -0
- smallworld/state/memory/pe/__init__.py +3 -0
- smallworld/state/memory/pe/pe.py +361 -0
- smallworld/state/memory/pe/structs.py +60 -0
- smallworld/state/memory/stack/__init__.py +2 -0
- smallworld/state/memory/stack/loongarch.py +26 -0
- smallworld/state/models/__init__.py +29 -2
- smallworld/state/models/aarch64/__init__.py +1 -0
- smallworld/state/models/aarch64/systemv/__init__.py +6 -0
- smallworld/state/models/aarch64/systemv/c99/__init__.py +12 -0
- smallworld/state/models/aarch64/systemv/c99/signal.py +16 -0
- smallworld/state/models/aarch64/systemv/c99/stdio.py +265 -0
- smallworld/state/models/aarch64/systemv/c99/stdlib.py +169 -0
- smallworld/state/models/aarch64/systemv/c99/string.py +139 -0
- smallworld/state/models/aarch64/systemv/c99/time.py +61 -0
- smallworld/state/models/aarch64/systemv/posix/__init__.py +6 -0
- smallworld/state/models/aarch64/systemv/posix/libgen.py +16 -0
- smallworld/state/models/aarch64/systemv/posix/signal.py +157 -0
- smallworld/state/models/aarch64/systemv/systemv.py +80 -0
- smallworld/state/models/amd64/__init__.py +1 -0
- smallworld/state/models/amd64/systemv/__init__.py +6 -0
- smallworld/state/models/amd64/systemv/c99/__init__.py +12 -0
- smallworld/state/models/amd64/systemv/c99/signal.py +16 -0
- smallworld/state/models/amd64/systemv/c99/stdio.py +265 -0
- smallworld/state/models/amd64/systemv/c99/stdlib.py +169 -0
- smallworld/state/models/amd64/systemv/c99/string.py +139 -0
- smallworld/state/models/amd64/systemv/c99/time.py +61 -0
- smallworld/state/models/amd64/systemv/posix/__init__.py +6 -0
- smallworld/state/models/amd64/systemv/posix/libgen.py +16 -0
- smallworld/state/models/amd64/systemv/posix/signal.py +157 -0
- smallworld/state/models/amd64/systemv/systemv.py +78 -0
- smallworld/state/models/armel/__init__.py +1 -0
- smallworld/state/models/armel/systemv/__init__.py +6 -0
- smallworld/state/models/armel/systemv/c99/__init__.py +12 -0
- smallworld/state/models/armel/systemv/c99/signal.py +16 -0
- smallworld/state/models/armel/systemv/c99/stdio.py +265 -0
- smallworld/state/models/armel/systemv/c99/stdlib.py +169 -0
- smallworld/state/models/armel/systemv/c99/string.py +139 -0
- smallworld/state/models/armel/systemv/c99/time.py +61 -0
- smallworld/state/models/armel/systemv/posix/__init__.py +6 -0
- smallworld/state/models/armel/systemv/posix/libgen.py +16 -0
- smallworld/state/models/armel/systemv/posix/signal.py +157 -0
- smallworld/state/models/armel/systemv/systemv.py +82 -0
- smallworld/state/models/armhf/__init__.py +1 -0
- smallworld/state/models/armhf/systemv/__init__.py +6 -0
- smallworld/state/models/armhf/systemv/c99/__init__.py +12 -0
- smallworld/state/models/armhf/systemv/c99/signal.py +16 -0
- smallworld/state/models/armhf/systemv/c99/stdio.py +265 -0
- smallworld/state/models/armhf/systemv/c99/stdlib.py +169 -0
- smallworld/state/models/armhf/systemv/c99/string.py +139 -0
- smallworld/state/models/armhf/systemv/c99/time.py +61 -0
- smallworld/state/models/armhf/systemv/posix/__init__.py +6 -0
- smallworld/state/models/armhf/systemv/posix/libgen.py +16 -0
- smallworld/state/models/armhf/systemv/posix/signal.py +157 -0
- smallworld/state/models/armhf/systemv/systemv.py +77 -0
- smallworld/state/models/c99/__init__.py +12 -0
- smallworld/state/models/c99/fmt_print.py +915 -0
- smallworld/state/models/c99/fmt_scan.py +864 -0
- smallworld/state/models/c99/math.py +362 -0
- smallworld/state/models/c99/signal.py +71 -0
- smallworld/state/models/c99/stdio.py +1305 -0
- smallworld/state/models/c99/stdlib.py +595 -0
- smallworld/state/models/c99/string.py +674 -0
- smallworld/state/models/c99/time.py +340 -0
- smallworld/state/models/c99/utils.py +89 -0
- smallworld/state/models/cstd.py +759 -0
- smallworld/state/models/errno.py +581 -0
- smallworld/state/models/filedesc.py +515 -0
- smallworld/state/models/i386/__init__.py +1 -0
- smallworld/state/models/i386/systemv/__init__.py +6 -0
- smallworld/state/models/i386/systemv/c99/__init__.py +12 -0
- smallworld/state/models/i386/systemv/c99/signal.py +16 -0
- smallworld/state/models/i386/systemv/c99/stdio.py +265 -0
- smallworld/state/models/i386/systemv/c99/stdlib.py +169 -0
- smallworld/state/models/i386/systemv/c99/string.py +139 -0
- smallworld/state/models/i386/systemv/c99/time.py +61 -0
- smallworld/state/models/i386/systemv/posix/__init__.py +6 -0
- smallworld/state/models/i386/systemv/posix/libgen.py +16 -0
- smallworld/state/models/i386/systemv/posix/signal.py +157 -0
- smallworld/state/models/i386/systemv/systemv.py +71 -0
- smallworld/state/models/loongarch64/__init__.py +1 -0
- smallworld/state/models/loongarch64/systemv/__init__.py +6 -0
- smallworld/state/models/loongarch64/systemv/c99/__init__.py +12 -0
- smallworld/state/models/loongarch64/systemv/c99/signal.py +16 -0
- smallworld/state/models/loongarch64/systemv/c99/stdio.py +265 -0
- smallworld/state/models/loongarch64/systemv/c99/stdlib.py +169 -0
- smallworld/state/models/loongarch64/systemv/c99/string.py +139 -0
- smallworld/state/models/loongarch64/systemv/c99/time.py +61 -0
- smallworld/state/models/loongarch64/systemv/posix/__init__.py +6 -0
- smallworld/state/models/loongarch64/systemv/posix/libgen.py +16 -0
- smallworld/state/models/loongarch64/systemv/posix/signal.py +157 -0
- smallworld/state/models/loongarch64/systemv/systemv.py +83 -0
- smallworld/state/models/mips/__init__.py +1 -0
- smallworld/state/models/mips/systemv/__init__.py +6 -0
- smallworld/state/models/mips/systemv/c99/__init__.py +12 -0
- smallworld/state/models/mips/systemv/c99/signal.py +16 -0
- smallworld/state/models/mips/systemv/c99/stdio.py +265 -0
- smallworld/state/models/mips/systemv/c99/stdlib.py +169 -0
- smallworld/state/models/mips/systemv/c99/string.py +139 -0
- smallworld/state/models/mips/systemv/c99/time.py +61 -0
- smallworld/state/models/mips/systemv/posix/__init__.py +6 -0
- smallworld/state/models/mips/systemv/posix/libgen.py +16 -0
- smallworld/state/models/mips/systemv/posix/signal.py +157 -0
- smallworld/state/models/mips/systemv/systemv.py +78 -0
- smallworld/state/models/mips64/__init__.py +1 -0
- smallworld/state/models/mips64/systemv/__init__.py +6 -0
- smallworld/state/models/mips64/systemv/c99/__init__.py +12 -0
- smallworld/state/models/mips64/systemv/c99/signal.py +16 -0
- smallworld/state/models/mips64/systemv/c99/stdio.py +265 -0
- smallworld/state/models/mips64/systemv/c99/stdlib.py +169 -0
- smallworld/state/models/mips64/systemv/c99/string.py +139 -0
- smallworld/state/models/mips64/systemv/c99/time.py +61 -0
- smallworld/state/models/mips64/systemv/posix/__init__.py +6 -0
- smallworld/state/models/mips64/systemv/posix/libgen.py +16 -0
- smallworld/state/models/mips64/systemv/posix/signal.py +157 -0
- smallworld/state/models/mips64/systemv/systemv.py +98 -0
- smallworld/state/models/mips64el/__init__.py +1 -0
- smallworld/state/models/mips64el/systemv/__init__.py +6 -0
- smallworld/state/models/mips64el/systemv/c99/__init__.py +12 -0
- smallworld/state/models/mips64el/systemv/c99/signal.py +16 -0
- smallworld/state/models/mips64el/systemv/c99/stdio.py +265 -0
- smallworld/state/models/mips64el/systemv/c99/stdlib.py +169 -0
- smallworld/state/models/mips64el/systemv/c99/string.py +139 -0
- smallworld/state/models/mips64el/systemv/c99/time.py +61 -0
- smallworld/state/models/mips64el/systemv/posix/__init__.py +6 -0
- smallworld/state/models/mips64el/systemv/posix/libgen.py +16 -0
- smallworld/state/models/mips64el/systemv/posix/signal.py +157 -0
- smallworld/state/models/mips64el/systemv/systemv.py +96 -0
- smallworld/state/models/mipsel/__init__.py +1 -0
- smallworld/state/models/mipsel/systemv/__init__.py +6 -0
- smallworld/state/models/mipsel/systemv/c99/__init__.py +12 -0
- smallworld/state/models/mipsel/systemv/c99/signal.py +16 -0
- smallworld/state/models/mipsel/systemv/c99/stdio.py +265 -0
- smallworld/state/models/mipsel/systemv/c99/stdlib.py +169 -0
- smallworld/state/models/mipsel/systemv/c99/string.py +139 -0
- smallworld/state/models/mipsel/systemv/c99/time.py +61 -0
- smallworld/state/models/mipsel/systemv/posix/__init__.py +6 -0
- smallworld/state/models/mipsel/systemv/posix/libgen.py +16 -0
- smallworld/state/models/mipsel/systemv/posix/signal.py +157 -0
- smallworld/state/models/mipsel/systemv/systemv.py +78 -0
- smallworld/state/models/model.py +27 -2
- smallworld/state/models/posix/__init__.py +6 -0
- smallworld/state/models/posix/libgen.py +123 -0
- smallworld/state/models/posix/signal.py +690 -0
- smallworld/state/models/powerpc/__init__.py +1 -0
- smallworld/state/models/powerpc/systemv/__init__.py +6 -0
- smallworld/state/models/powerpc/systemv/c99/__init__.py +12 -0
- smallworld/state/models/powerpc/systemv/c99/signal.py +16 -0
- smallworld/state/models/powerpc/systemv/c99/stdio.py +265 -0
- smallworld/state/models/powerpc/systemv/c99/stdlib.py +169 -0
- smallworld/state/models/powerpc/systemv/c99/string.py +139 -0
- smallworld/state/models/powerpc/systemv/c99/time.py +61 -0
- smallworld/state/models/powerpc/systemv/posix/__init__.py +6 -0
- smallworld/state/models/powerpc/systemv/posix/libgen.py +16 -0
- smallworld/state/models/powerpc/systemv/posix/signal.py +157 -0
- smallworld/state/models/powerpc/systemv/systemv.py +93 -0
- smallworld/state/models/riscv64/__init__.py +1 -0
- smallworld/state/models/riscv64/systemv/__init__.py +6 -0
- smallworld/state/models/riscv64/systemv/c99/__init__.py +12 -0
- smallworld/state/models/riscv64/systemv/c99/signal.py +16 -0
- smallworld/state/models/riscv64/systemv/c99/stdio.py +265 -0
- smallworld/state/models/riscv64/systemv/c99/stdlib.py +169 -0
- smallworld/state/models/riscv64/systemv/c99/string.py +139 -0
- smallworld/state/models/riscv64/systemv/c99/time.py +61 -0
- smallworld/state/models/riscv64/systemv/posix/__init__.py +6 -0
- smallworld/state/models/riscv64/systemv/posix/libgen.py +16 -0
- smallworld/state/models/riscv64/systemv/posix/signal.py +157 -0
- smallworld/state/models/riscv64/systemv/systemv.py +85 -0
- smallworld/state/state.py +65 -24
- smallworld/state/unstable/elf.py +16 -31
- smallworld/utils.py +6 -1
- {smallworld_re-1.0.2.dist-info → smallworld_re-2.0.0.dist-info}/METADATA +76 -43
- smallworld_re-2.0.0.dist-info/RECORD +374 -0
- {smallworld_re-1.0.2.dist-info → smallworld_re-2.0.0.dist-info}/WHEEL +1 -1
- smallworld/state/models/x86/__init__.py +0 -2
- smallworld/state/models/x86/microsoftcdecl.py +0 -35
- smallworld/state/models/x86/systemv.py +0 -240
- smallworld_re-1.0.2.dist-info/RECORD +0 -166
- /smallworld/state/models/{posix.py → _posix.py} +0 -0
- {smallworld_re-1.0.2.dist-info → smallworld_re-2.0.0.dist-info}/entry_points.txt +0 -0
- {smallworld_re-1.0.2.dist-info → smallworld_re-2.0.0.dist-info/licenses}/LICENSE.txt +0 -0
- {smallworld_re-1.0.2.dist-info → smallworld_re-2.0.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,289 @@
|
|
1
|
+
from ....platforms import Architecture, Byteorder
|
2
|
+
from .machdef import GhidraMachineDef
|
3
|
+
|
4
|
+
|
5
|
+
class AArch64MachineDef(GhidraMachineDef):
|
6
|
+
arch = Architecture.AARCH64
|
7
|
+
byteorder = Byteorder.LITTLE
|
8
|
+
language_id = "AARCH64:LE:64:v8A"
|
9
|
+
|
10
|
+
_registers = {
|
11
|
+
# *** General Purpose Registers ***
|
12
|
+
"x0": "x0",
|
13
|
+
"w0": "w0",
|
14
|
+
"x1": "x1",
|
15
|
+
"w1": "w1",
|
16
|
+
"x2": "x2",
|
17
|
+
"w2": "w2",
|
18
|
+
"x3": "x3",
|
19
|
+
"w3": "w3",
|
20
|
+
"x4": "x4",
|
21
|
+
"w4": "w4",
|
22
|
+
"x5": "x5",
|
23
|
+
"w5": "w5",
|
24
|
+
"x6": "x6",
|
25
|
+
"w6": "w6",
|
26
|
+
"x7": "x7",
|
27
|
+
"w7": "w7",
|
28
|
+
"x8": "x8",
|
29
|
+
"w8": "w8",
|
30
|
+
"x9": "x9",
|
31
|
+
"w9": "w9",
|
32
|
+
"x10": "x10",
|
33
|
+
"w10": "w10",
|
34
|
+
"x11": "x11",
|
35
|
+
"w11": "w11",
|
36
|
+
"x12": "x12",
|
37
|
+
"w12": "w12",
|
38
|
+
"x13": "x13",
|
39
|
+
"w13": "w13",
|
40
|
+
"x14": "x14",
|
41
|
+
"w14": "w14",
|
42
|
+
"x15": "x15",
|
43
|
+
"w15": "w15",
|
44
|
+
"x16": "x16",
|
45
|
+
"w16": "w16",
|
46
|
+
"x17": "x17",
|
47
|
+
"w17": "w17",
|
48
|
+
"x18": "x18",
|
49
|
+
"w18": "w18",
|
50
|
+
"x19": "x19",
|
51
|
+
"w19": "w19",
|
52
|
+
"x20": "x20",
|
53
|
+
"w20": "w20",
|
54
|
+
"x21": "x21",
|
55
|
+
"w21": "w21",
|
56
|
+
"x22": "x22",
|
57
|
+
"w22": "w22",
|
58
|
+
"x23": "x23",
|
59
|
+
"w23": "w23",
|
60
|
+
"x24": "x24",
|
61
|
+
"w24": "w24",
|
62
|
+
"x25": "x25",
|
63
|
+
"w25": "w25",
|
64
|
+
"x26": "x26",
|
65
|
+
"w26": "w26",
|
66
|
+
"x27": "x27",
|
67
|
+
"w27": "w27",
|
68
|
+
"x28": "x28",
|
69
|
+
"w28": "w28",
|
70
|
+
"x29": "x29",
|
71
|
+
"w29": "w29",
|
72
|
+
"x30": "x30",
|
73
|
+
"w30": "w30",
|
74
|
+
"pc": "pc",
|
75
|
+
"sp": "sp",
|
76
|
+
"wsp": "wsp",
|
77
|
+
"fp": "x29",
|
78
|
+
"lr": "x30",
|
79
|
+
"xzr": "xzr",
|
80
|
+
"wzr": "wzr",
|
81
|
+
# *** System Control Registers ***
|
82
|
+
# NOTE: "_elX" indicates that only exception level X or greater can access this register.
|
83
|
+
# NOTE: This list is far from complete; it only covers what Unicorn supports
|
84
|
+
# NOTE: angr's aarch64 model is aggressively userspace-only. None of these are supported
|
85
|
+
# Condition Code Register
|
86
|
+
"fpcr": None,
|
87
|
+
# Floating Point Status Register
|
88
|
+
"fpsr": None,
|
89
|
+
# Banked stack pointers for exception handlers
|
90
|
+
"sp_el0": None,
|
91
|
+
"sp_el1": None,
|
92
|
+
"sp_el2": None,
|
93
|
+
"sp_el3": None,
|
94
|
+
# Banked link registers for exception handlers
|
95
|
+
# NOTE: Unicorn thinks there's an elr_el0; according to docs, it doesn't exist
|
96
|
+
"elr_el1": None,
|
97
|
+
"elr_el2": None,
|
98
|
+
"elr_el3": None,
|
99
|
+
# Banked exception syndrome registers for exception handlers
|
100
|
+
# NOTE: Unicorn thinks there's a far_el0; according to docs, it doesn't exist
|
101
|
+
"far_el1": None,
|
102
|
+
"far_el2": None,
|
103
|
+
"far_el3": None,
|
104
|
+
# Banked vector base address registers for exception handlers
|
105
|
+
# NOTE: vbar_el0 and vbar_el1 are aliases for each other.
|
106
|
+
# Since vbar_el0 doesn't exist in angr, vbar_el1 has to be the "real" copy.
|
107
|
+
"vbar_el1": None,
|
108
|
+
"vbar_el0": None,
|
109
|
+
"vbar_el2": None,
|
110
|
+
"vbar_el3": None,
|
111
|
+
# Coprocessor access control register
|
112
|
+
"cpacr_el1": None,
|
113
|
+
# Memory Attribute Indirection Register
|
114
|
+
"mair_el1": None,
|
115
|
+
# Physical Address Register
|
116
|
+
"par_el1": None,
|
117
|
+
# Translation Table Zero Base Register
|
118
|
+
"ttbr0_el1": None,
|
119
|
+
# Translation Table One Base Register
|
120
|
+
"ttbr1_el1": None,
|
121
|
+
# Thread ID Register
|
122
|
+
# NOTE: According to docs, there should be an el2 and el3 copy, too.
|
123
|
+
"tpidr_el0": None,
|
124
|
+
"tpidr_el1": None,
|
125
|
+
# Userspace-visible Thread ID register
|
126
|
+
"tpidrro_el0": None,
|
127
|
+
# *** Floating Point Registers ***
|
128
|
+
# Scalar Floating Point Registers
|
129
|
+
"q0": "q0",
|
130
|
+
"d0": "d0",
|
131
|
+
"s0": "s0",
|
132
|
+
"h0": "h0",
|
133
|
+
"b0": "b0",
|
134
|
+
"q1": "q1",
|
135
|
+
"d1": "d1",
|
136
|
+
"s1": "s1",
|
137
|
+
"h1": "h1",
|
138
|
+
"b1": "b1",
|
139
|
+
"q2": "q2",
|
140
|
+
"d2": "d2",
|
141
|
+
"s2": "s2",
|
142
|
+
"h2": "h2",
|
143
|
+
"b2": "b2",
|
144
|
+
"q3": "q3",
|
145
|
+
"d3": "d3",
|
146
|
+
"s3": "s3",
|
147
|
+
"h3": "h3",
|
148
|
+
"b3": "b3",
|
149
|
+
"q4": "q4",
|
150
|
+
"d4": "d4",
|
151
|
+
"s4": "s4",
|
152
|
+
"h4": "h4",
|
153
|
+
"b4": "b4",
|
154
|
+
"q5": "q5",
|
155
|
+
"d5": "d5",
|
156
|
+
"s5": "s5",
|
157
|
+
"h5": "h5",
|
158
|
+
"b5": "b5",
|
159
|
+
"q6": "q6",
|
160
|
+
"d6": "d6",
|
161
|
+
"s6": "s6",
|
162
|
+
"h6": "h6",
|
163
|
+
"b6": "b6",
|
164
|
+
"q7": "q7",
|
165
|
+
"d7": "d7",
|
166
|
+
"s7": "s7",
|
167
|
+
"h7": "h7",
|
168
|
+
"b7": "b7",
|
169
|
+
"q8": "q8",
|
170
|
+
"d8": "d8",
|
171
|
+
"s8": "s8",
|
172
|
+
"h8": "h8",
|
173
|
+
"b8": "b8",
|
174
|
+
"q9": "q9",
|
175
|
+
"d9": "d9",
|
176
|
+
"s9": "s9",
|
177
|
+
"h9": "h9",
|
178
|
+
"b9": "b9",
|
179
|
+
"q10": "q10",
|
180
|
+
"d10": "d10",
|
181
|
+
"s10": "s10",
|
182
|
+
"h10": "h10",
|
183
|
+
"b10": "b10",
|
184
|
+
"q11": "q11",
|
185
|
+
"d11": "d11",
|
186
|
+
"s11": "s11",
|
187
|
+
"h11": "h11",
|
188
|
+
"b11": "b11",
|
189
|
+
"q12": "q12",
|
190
|
+
"d12": "d12",
|
191
|
+
"s12": "s12",
|
192
|
+
"h12": "h12",
|
193
|
+
"b12": "b12",
|
194
|
+
"q13": "q13",
|
195
|
+
"d13": "d13",
|
196
|
+
"s13": "s13",
|
197
|
+
"h13": "h13",
|
198
|
+
"b13": "b13",
|
199
|
+
"q14": "q14",
|
200
|
+
"d14": "d14",
|
201
|
+
"s14": "s14",
|
202
|
+
"h14": "h14",
|
203
|
+
"b14": "b14",
|
204
|
+
"q15": "q15",
|
205
|
+
"d15": "d15",
|
206
|
+
"s15": "s15",
|
207
|
+
"h15": "h15",
|
208
|
+
"b15": "b15",
|
209
|
+
"q16": "q16",
|
210
|
+
"d16": "d16",
|
211
|
+
"s16": "s16",
|
212
|
+
"h16": "h16",
|
213
|
+
"b16": "b16",
|
214
|
+
"q17": "q17",
|
215
|
+
"d17": "d17",
|
216
|
+
"s17": "s17",
|
217
|
+
"h17": "h17",
|
218
|
+
"b17": "b17",
|
219
|
+
"q18": "q18",
|
220
|
+
"d18": "d18",
|
221
|
+
"s18": "s18",
|
222
|
+
"h18": "h18",
|
223
|
+
"b18": "b18",
|
224
|
+
"q19": "q19",
|
225
|
+
"d19": "d19",
|
226
|
+
"s19": "s19",
|
227
|
+
"h19": "h19",
|
228
|
+
"b19": "b19",
|
229
|
+
"q20": "q20",
|
230
|
+
"d20": "d20",
|
231
|
+
"s20": "s20",
|
232
|
+
"h20": "h20",
|
233
|
+
"b20": "b20",
|
234
|
+
"q21": "q21",
|
235
|
+
"d21": "d21",
|
236
|
+
"s21": "s21",
|
237
|
+
"h21": "h21",
|
238
|
+
"b21": "b21",
|
239
|
+
"q22": "q22",
|
240
|
+
"d22": "d22",
|
241
|
+
"s22": "s22",
|
242
|
+
"h22": "h22",
|
243
|
+
"b22": "b22",
|
244
|
+
"q23": "q23",
|
245
|
+
"d23": "d23",
|
246
|
+
"s23": "s23",
|
247
|
+
"h23": "h23",
|
248
|
+
"b23": "b23",
|
249
|
+
"q24": "q24",
|
250
|
+
"d24": "d24",
|
251
|
+
"s24": "s24",
|
252
|
+
"h24": "h24",
|
253
|
+
"b24": "b24",
|
254
|
+
"q25": "q25",
|
255
|
+
"d25": "d25",
|
256
|
+
"s25": "s25",
|
257
|
+
"h25": "h25",
|
258
|
+
"b25": "b25",
|
259
|
+
"q26": "q26",
|
260
|
+
"d26": "d26",
|
261
|
+
"s26": "s26",
|
262
|
+
"h26": "h26",
|
263
|
+
"b26": "b26",
|
264
|
+
"q27": "q27",
|
265
|
+
"d27": "d27",
|
266
|
+
"s27": "s27",
|
267
|
+
"h27": "h27",
|
268
|
+
"b27": "b27",
|
269
|
+
"q28": "q28",
|
270
|
+
"d28": "d28",
|
271
|
+
"s28": "s28",
|
272
|
+
"h28": "h28",
|
273
|
+
"b28": "b28",
|
274
|
+
"q29": "q29",
|
275
|
+
"d29": "d29",
|
276
|
+
"s29": "s29",
|
277
|
+
"h29": "h29",
|
278
|
+
"b29": "b29",
|
279
|
+
"q30": "q30",
|
280
|
+
"d30": "d30",
|
281
|
+
"s30": "s30",
|
282
|
+
"h30": "h30",
|
283
|
+
"b30": "b30",
|
284
|
+
"q31": "q31",
|
285
|
+
"d31": "d31",
|
286
|
+
"s31": "s31",
|
287
|
+
"h31": "h31",
|
288
|
+
"b31": "b31",
|
289
|
+
}
|
@@ -0,0 +1,185 @@
|
|
1
|
+
import typing
|
2
|
+
|
3
|
+
from .... import platforms
|
4
|
+
from .machdef import GhidraMachineDef
|
5
|
+
|
6
|
+
|
7
|
+
class AMD64MachineDef(GhidraMachineDef):
|
8
|
+
arch: platforms.Architecture = platforms.Architecture.X86_64
|
9
|
+
byteorder: platforms.Byteorder = platforms.Byteorder.LITTLE
|
10
|
+
language_id: str = "x86:LE:64:default"
|
11
|
+
|
12
|
+
_registers: typing.Dict[str, typing.Optional[str]] = {
|
13
|
+
# *** General Purpose Registers ***
|
14
|
+
"rax": "rax",
|
15
|
+
"eax": "eax",
|
16
|
+
"ax": "ax",
|
17
|
+
"al": "al",
|
18
|
+
"ah": "ah",
|
19
|
+
"rbx": "rbx",
|
20
|
+
"ebx": "ebx",
|
21
|
+
"bx": "bx",
|
22
|
+
"bl": "bl",
|
23
|
+
"bh": "bh",
|
24
|
+
"rcx": "rcx",
|
25
|
+
"ecx": "ecx",
|
26
|
+
"cx": "cx",
|
27
|
+
"cl": "cl",
|
28
|
+
"ch": "ch",
|
29
|
+
"rdx": "rdx",
|
30
|
+
"edx": "edx",
|
31
|
+
"dx": "dx",
|
32
|
+
"dl": "dl",
|
33
|
+
"dh": "dh",
|
34
|
+
"r8": "r8",
|
35
|
+
"r8d": "r8d",
|
36
|
+
"r8w": "r8w",
|
37
|
+
"r8b": "r8b",
|
38
|
+
"r9": "r9",
|
39
|
+
"r9d": "r9d",
|
40
|
+
"r9w": "r9w",
|
41
|
+
"r9b": "r9b",
|
42
|
+
"r10": "r10",
|
43
|
+
"r10d": "r10d",
|
44
|
+
"r10w": "r10w",
|
45
|
+
"r10b": "r10b",
|
46
|
+
"r11": "r11",
|
47
|
+
"r11d": "r11d",
|
48
|
+
"r11w": "r11w",
|
49
|
+
"r11b": "r11b",
|
50
|
+
"r12": "r12",
|
51
|
+
"r12d": "r12d",
|
52
|
+
"r12w": "r12w",
|
53
|
+
"r12b": "r12b",
|
54
|
+
"r13": "r13",
|
55
|
+
"r13d": "r13d",
|
56
|
+
"r13w": "r13w",
|
57
|
+
"r13b": "r13b",
|
58
|
+
"r14": "r14",
|
59
|
+
"r14d": "r14d",
|
60
|
+
"r14w": "r14w",
|
61
|
+
"r14b": "r14b",
|
62
|
+
"r15": "r15",
|
63
|
+
"r15d": "r15d",
|
64
|
+
"r15w": "r15w",
|
65
|
+
"r15b": "r15b",
|
66
|
+
"rsi": "rsi",
|
67
|
+
"esi": "esi",
|
68
|
+
"si": "si",
|
69
|
+
"sil": "sil",
|
70
|
+
"rdi": "rdi",
|
71
|
+
"edi": "edi",
|
72
|
+
"di": "di",
|
73
|
+
"dil": "dil",
|
74
|
+
"rbp": "rbp",
|
75
|
+
"ebp": "ebp",
|
76
|
+
"bp": "bp",
|
77
|
+
"bpl": "bpl",
|
78
|
+
"rsp": "rsp",
|
79
|
+
"esp": "esp",
|
80
|
+
"sp": "sp",
|
81
|
+
"spl": "spl",
|
82
|
+
# *** Instruction Pointer ***
|
83
|
+
"rip": "rip",
|
84
|
+
"eip": "eip",
|
85
|
+
"ip": "ip",
|
86
|
+
# *** Segment Registers ***
|
87
|
+
"cs": "cs",
|
88
|
+
"ds": "ds",
|
89
|
+
"es": "es",
|
90
|
+
"fs": "fs",
|
91
|
+
"gs": "gs",
|
92
|
+
"ss": "ss",
|
93
|
+
# *** Flags Register ***
|
94
|
+
"rflags": "rflags",
|
95
|
+
"eflags": "eflags",
|
96
|
+
"flags": "flags",
|
97
|
+
# *** Control Registers ***
|
98
|
+
# NOTE: Ghidra happily supports up to cr15
|
99
|
+
"cr0": "cr0",
|
100
|
+
"cr1": "cr1",
|
101
|
+
"cr2": "cr2",
|
102
|
+
"cr3": "cr3",
|
103
|
+
"cr4": "cr4",
|
104
|
+
"cr8": "cr8",
|
105
|
+
# *** Debug Registers ***
|
106
|
+
"dr0": "dr0",
|
107
|
+
"dr1": "dr1",
|
108
|
+
"dr2": "dr2",
|
109
|
+
"dr3": "dr3",
|
110
|
+
"dr6": "dr6",
|
111
|
+
"dr7": "dr7",
|
112
|
+
"dr8": "dr8",
|
113
|
+
"dr9": "dr9",
|
114
|
+
"dr10": "dr10",
|
115
|
+
"dr11": "dr11",
|
116
|
+
"dr12": "dr12",
|
117
|
+
"dr13": "dr13",
|
118
|
+
"dr14": "dr14",
|
119
|
+
"dr15": "dr15",
|
120
|
+
# *** Descriptor Table Registers ***
|
121
|
+
"gdtr": "gdtr",
|
122
|
+
"idtr": "idtr",
|
123
|
+
"ldtr": "ldtr",
|
124
|
+
# *** Task Register ***
|
125
|
+
"tr": "tr",
|
126
|
+
# *** x87 Registers ***
|
127
|
+
# TODO: Ghidra appears to support x87, but I have no idea how it works
|
128
|
+
"fpr0": None,
|
129
|
+
"fpr1": None,
|
130
|
+
"fpr2": None,
|
131
|
+
"fpr3": None,
|
132
|
+
"fpr4": None,
|
133
|
+
"fpr5": None,
|
134
|
+
"fpr6": None,
|
135
|
+
"fpr7": None,
|
136
|
+
"fctrl": None,
|
137
|
+
"fstat": None,
|
138
|
+
"ftag": None,
|
139
|
+
"fip": None,
|
140
|
+
"fdp": None,
|
141
|
+
"fop": None,
|
142
|
+
# *** MMX Registers ***
|
143
|
+
# TODO: Ghidra appears to support mmx, but I have no idea how it works.
|
144
|
+
"mm0": None,
|
145
|
+
"mm1": None,
|
146
|
+
"mm2": None,
|
147
|
+
"mm3": None,
|
148
|
+
"mm4": None,
|
149
|
+
"mm5": None,
|
150
|
+
"mm6": None,
|
151
|
+
"mm7": None,
|
152
|
+
# SSE/AVX registers
|
153
|
+
"ymm0": "ymm0",
|
154
|
+
"xmm0": "xmm0",
|
155
|
+
"ymm1": "ymm1",
|
156
|
+
"xmm1": "xmm1",
|
157
|
+
"ymm2": "ymm2",
|
158
|
+
"xmm2": "xmm2",
|
159
|
+
"ymm3": "ymm3",
|
160
|
+
"xmm3": "xmm3",
|
161
|
+
"ymm4": "ymm4",
|
162
|
+
"xmm4": "xmm4",
|
163
|
+
"ymm5": "ymm5",
|
164
|
+
"xmm5": "xmm5",
|
165
|
+
"ymm6": "ymm6",
|
166
|
+
"xmm6": "xmm6",
|
167
|
+
"ymm7": "ymm7",
|
168
|
+
"xmm7": "xmm7",
|
169
|
+
"ymm8": "ymm8",
|
170
|
+
"xmm8": "xmm8",
|
171
|
+
"ymm9": "ymm9",
|
172
|
+
"xmm9": "xmm9",
|
173
|
+
"ymm10": "ymm10",
|
174
|
+
"xmm10": "xmm10",
|
175
|
+
"ymm11": "ymm11",
|
176
|
+
"xmm11": "xmm11",
|
177
|
+
"ymm12": "ymm12",
|
178
|
+
"xmm12": "xmm12",
|
179
|
+
"ymm13": "ymm13",
|
180
|
+
"xmm13": "xmm13",
|
181
|
+
"ymm14": "ymm14",
|
182
|
+
"xmm14": "xmm14",
|
183
|
+
"ymm15": "ymm15",
|
184
|
+
"xmm15": "xmm15",
|
185
|
+
}
|