From 0a1581f2c95a756da268203aa2296b4951b2ade0 Mon Sep 17 00:00:00 2001 From: shay margolis Date: Tue, 16 Jul 2024 21:46:08 +0300 Subject: [PATCH 1/2] pyvex: Add TILEGX to arches --- pyvex/__init__.py | 2 ++ pyvex/arches.py | 3 +++ pyvex/lifting/libvex.py | 1 + 3 files changed, 6 insertions(+) diff --git a/pyvex/__init__.py b/pyvex/__init__.py index 85529c14..c47ac348 100644 --- a/pyvex/__init__.py +++ b/pyvex/__init__.py @@ -22,6 +22,7 @@ ARCH_PPC64_LE, ARCH_RISCV64_LE, ARCH_S390X, + ARCH_TILEGX, ARCH_X86, ) from .block import IRSB, IRTypeEnv @@ -89,4 +90,5 @@ "ARCH_MIPS64_BE", "ARCH_MIPS64_LE", "ARCH_RISCV64_LE", + "ARCH_TILEGX", ] diff --git a/pyvex/arches.py b/pyvex/arches.py index 79bf50e5..b67a7c1f 100644 --- a/pyvex/arches.py +++ b/pyvex/arches.py @@ -28,6 +28,7 @@ def __init__(self, name: str, bits: int, memory_endness: str, instruction_endnes "MIPS32": "VexArchMIPS32", "MIPS64": "VexArchMIPS64", "RISCV64": "VexArchRISCV64", + "TILEGX": "VexArchTILEGX", }[name] self.ip_offset = guest_offsets[ ( @@ -43,6 +44,7 @@ def __init__(self, name: str, bits: int, memory_endness: str, instruction_endnes "MIPS32": "pc", "MIPS64": "pc", "RISCV64": "pc", + "TILEGX": "pc", }[name], ) ] @@ -92,3 +94,4 @@ def get_register_offset(self, name: str) -> int: ARCH_MIPS64_BE = PyvexArch("MIPS64", 64, "Iend_BE") ARCH_MIPS64_LE = PyvexArch("MIPS64", 64, "Iend_LE") ARCH_RISCV64_LE = PyvexArch("RISCV64", 64, "Iend_LE", instruction_endness="Iend_LE") +ARCH_TILEGX = PyvexArch("TILEGX", 64, "Iend_LE") diff --git a/pyvex/lifting/libvex.py b/pyvex/lifting/libvex.py index e7544caf..934a3109 100644 --- a/pyvex/lifting/libvex.py +++ b/pyvex/lifting/libvex.py @@ -26,6 +26,7 @@ "PPC64", "S390X", "RISCV64", + "TILEGX", } VEX_MAX_INSTRUCTIONS = 99 From 12a43c8ba211d546698395fb75d03c23676528b7 Mon Sep 17 00:00:00 2001 From: shay margolis Date: Tue, 16 Jul 2024 21:46:40 +0300 Subject: [PATCH 2/2] pyvex_c: Allow VexArchTILEGX lifting --- pyvex_c/pyvex.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyvex_c/pyvex.c b/pyvex_c/pyvex.c index dec54cc3..6ab77d8c 100644 --- a/pyvex_c/pyvex.c +++ b/pyvex_c/pyvex.c @@ -279,6 +279,9 @@ static void vex_prepare_vai(VexArch arch, VexArchInfo *vai) { case VexArchRISCV64: vai->hwcaps = 0; break; + case VexArchTILEGX: + vai->hwcaps = 0; + break; default: pyvex_error("Invalid arch in vex_prepare_vai.\n"); break;