Support RIP relative memory operands in patched instructions.

This commit is contained in:
squidbus 2024-07-21 04:21:02 -07:00 committed by TheTurtle
parent 088130863b
commit 615f4e770f
1 changed files with 4 additions and 0 deletions

View File

@ -44,6 +44,10 @@ static Xbyak::Address ZydisToXbyakMemoryOperand(const ZydisDecodedOperand& opera
ASSERT_MSG(operand.type == ZYDIS_OPERAND_TYPE_MEMORY, "Expected memory operand, got type: {}", ASSERT_MSG(operand.type == ZYDIS_OPERAND_TYPE_MEMORY, "Expected memory operand, got type: {}",
static_cast<u32>(operand.type)); static_cast<u32>(operand.type));
if (operand.mem.base == ZYDIS_REGISTER_RIP) {
return ptr[rip + operand.mem.disp.value];
}
Xbyak::RegExp expression{}; Xbyak::RegExp expression{};
if (operand.mem.base != ZYDIS_REGISTER_NONE) { if (operand.mem.base != ZYDIS_REGISTER_NONE) {
expression = expression + ZydisToXbyakRegister(operand.mem.base); expression = expression + ZydisToXbyakRegister(operand.mem.base);