From c39fc3830fe1be9c68e8d484b0c89c29a38fac92 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Fri, 13 Sep 2024 12:08:09 +0300 Subject: [PATCH] fix modrm rip displacement part 2 --- src/generator/X64Generator.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/generator/X64Generator.cpp b/src/generator/X64Generator.cpp index 2a955ba..f172216 100644 --- a/src/generator/X64Generator.cpp +++ b/src/generator/X64Generator.cpp @@ -426,7 +426,7 @@ Result<> X64HandlerGenerator::relocateRIPInstruction(cs_insn* insn, uint8_t* buf originalAddress += size; return Ok(); } - else if (detail->x86.encoding.modrm_offset > 0 && ((detail->x86.modrm | 0b11000111) == 5)) { + else if (detail->x86.encoding.modrm_offset > 0 && ((detail->x86.modrm & 0b11000111) == 5)) { // Trying to catch XMM instructions X64Assembler a(trampolineAddress); RegMem64 m; @@ -435,7 +435,6 @@ Result<> X64HandlerGenerator::relocateRIPInstruction(cs_insn* insn, uint8_t* buf auto const absolute = static_cast(originalAddress) + size + disp; a.mov(RAX, "absolute-pointer"); - a.mov(RAX, m[RAX]); for (size_t i = 0; i < size; ++i) { if (i == detail->x86.encoding.modrm_offset) { // remove the modrm displacement [rip + 0x##] to make it [rax]