mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-22 10:04:39 +00:00
Add an unreachable on hitting ud2 instead of getting stuck in an infinite loop (#3257)
* Add an unreachable on hitting ud2 instead of getting stuck in an infinite loop * Add [[unlikely]] to get ahead of the inevitable PR review comment
This commit is contained in:
parent
161aa49f37
commit
fddded8d20
@ -753,6 +753,10 @@ static bool PatchesIllegalInstructionHandler(void* context) {
|
|||||||
ZydisDecodedOperand operands[ZYDIS_MAX_OPERAND_COUNT];
|
ZydisDecodedOperand operands[ZYDIS_MAX_OPERAND_COUNT];
|
||||||
const auto status =
|
const auto status =
|
||||||
Common::Decoder::Instance()->decodeInstruction(instruction, operands, code_address);
|
Common::Decoder::Instance()->decodeInstruction(instruction, operands, code_address);
|
||||||
|
if (ZYAN_SUCCESS(status) && instruction.mnemonic == ZydisMnemonic::ZYDIS_MNEMONIC_UD2)
|
||||||
|
[[unlikely]] {
|
||||||
|
UNREACHABLE_MSG("ud2 at code address {:#x}", (u64)code_address);
|
||||||
|
}
|
||||||
LOG_ERROR(Core, "Failed to patch address {:x} -- mnemonic: {}", (u64)code_address,
|
LOG_ERROR(Core, "Failed to patch address {:x} -- mnemonic: {}", (u64)code_address,
|
||||||
ZYAN_SUCCESS(status) ? ZydisMnemonicGetString(instruction.mnemonic)
|
ZYAN_SUCCESS(status) ? ZydisMnemonicGetString(instruction.mnemonic)
|
||||||
: "Failed to decode");
|
: "Failed to decode");
|
||||||
|
Loading…
Reference in New Issue
Block a user