diff --git a/src/core/cpu_patches.cpp b/src/core/cpu_patches.cpp index 202cfbb85..3404496ce 100644 --- a/src/core/cpu_patches.cpp +++ b/src/core/cpu_patches.cpp @@ -1053,7 +1053,14 @@ static bool TryExecuteIllegalInstruction(void* ctx, void* code_address) { } u64 index = (lowQWordSrc >> 8) & 0x3F; - ASSERT_MSG(length + index <= 64, "length + index must be less than or equal to 64."); + if (length + index > 64) { + // Undefined behavior if length + index is bigger than 64 according to the spec, + // we'll warn and continue execution. + LOG_WARNING(Core, + "extrq at {:x} with length {} and index {} is bigger than 64, " + "undefined behavior", + fmt::ptr(code_address), length, index); + } lowQWordDst >>= index; lowQWordDst &= mask; @@ -1106,7 +1113,14 @@ static bool TryExecuteIllegalInstruction(void* ctx, void* code_address) { } u64 index = (highQWordSrc >> 8) & 0x3F; - ASSERT_MSG(length + index <= 64, "length + index must be less than or equal to 64."); + if (length + index > 64) { + // Undefined behavior if length + index is bigger than 64 according to the spec, + // we'll warn and continue execution. + LOG_WARNING(Core, + "insertq at {:x} with length {} and index {} is bigger than 64, " + "undefined behavior", + fmt::ptr(code_address), length, index); + } lowQWordSrc &= mask; lowQWordDst &= ~(mask << index);