diff --git a/src/core/cpu_patches.cpp b/src/core/cpu_patches.cpp index a88977a35..02879a8ab 100644 --- a/src/core/cpu_patches.cpp +++ b/src/core/cpu_patches.cpp @@ -511,7 +511,9 @@ static std::pair TryPatch(u8* code, PatchModule* module) { #if defined(ARCH_X86_64) -static bool TryExecuteIllegalInstruction(void* ctx, void* code_address, ZydisDecodedInstruction& instruction, ZydisDecodedOperand* operands) { +static bool TryExecuteIllegalInstruction(void* ctx, void* code_address, + ZydisDecodedInstruction& instruction, + ZydisDecodedOperand* operands) { switch (instruction.mnemonic) { case ZYDIS_MNEMONIC_EXTRQ: { bool immediateForm = operands[1].type == ZYDIS_OPERAND_TYPE_IMMEDIATE && @@ -644,7 +646,8 @@ static bool TryExecuteIllegalInstruction(void* ctx, void* code_address, ZydisDec #elif defined(ARCH_ARM64) // These functions shouldn't be needed for ARM as it will use a JIT so there's no need to patch // instructions. -static bool TryExecuteIllegalInstruction(void*, void*, ZydisDecodedInstruction&, ZydisDecodedOperand*) { +static bool TryExecuteIllegalInstruction(void*, void*, ZydisDecodedInstruction&, + ZydisDecodedOperand*) { return false; } #else @@ -691,20 +694,23 @@ static bool PatchesIllegalInstructionHandler(void* context) { void* code_address = Common::GetRip(context); ZydisDecodedInstruction instruction; ZydisDecodedOperand operands[ZYDIS_MAX_OPERAND_COUNT]; - const auto status = Common::Decoder::Instance()->decodeInstruction(instruction, operands, code_address); + const auto status = + Common::Decoder::Instance()->decodeInstruction(instruction, operands, code_address); if (!ZYAN_SUCCESS(status)) { return false; } if (instruction.length < 5) { - // The instruction is not big enough for a relative jump, don't try to patch it and pass it to - // our illegal instruction interpreter directly + // The instruction is not big enough for a relative jump, don't try to patch it and pass it + // to our illegal instruction interpreter directly return TryExecuteIllegalInstruction(context, code_address, instruction, operands); } else { if (!TryPatchJit(code_address)) { - // Any instructions >= 5 bytes should get successfully patched and the above will return true - // Returning false would be an error as we previously check that the instruction is >= 5 to get here - LOG_ERROR(Core, "Failed to patch address %lx -- mnemonic: %d", (u64)code_address, (int)instruction.mnemonic); + // Any instructions >= 5 bytes should get successfully patched and the above will return + // true Returning false would be an error as we previously check that the instruction is + // >= 5 to get here + LOG_ERROR(Core, "Failed to patch address %lx -- mnemonic: %d", (u64)code_address, + (int)instruction.mnemonic); } }