From 2d9ea42df27a0b7b7b942d46a6d561b19d9e10a1 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Fri, 29 Jan 2021 23:13:58 +0100 Subject: [PATCH] Arm64Emitter: Add asserts for LDP/STP imm out of range --- Source/Core/Common/Arm64Emitter.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/Core/Common/Arm64Emitter.cpp b/Source/Core/Common/Arm64Emitter.cpp index fa95589db1..aeee7d2891 100644 --- a/Source/Core/Common/Arm64Emitter.cpp +++ b/Source/Core/Common/Arm64Emitter.cpp @@ -856,6 +856,8 @@ void ARM64XEmitter::EncodeLoadStorePair(u32 op, u32 load, IndexType type, ARM64R Rt2 = DecodeReg(Rt2); Rn = DecodeReg(Rn); + ASSERT_MSG(DYNA_REC, imm >= -64 && imm < 64, "imm too large for load/store pair!"); + Write32((op << 30) | (0b101 << 27) | (type_encode << 23) | (load << 22) | ((imm & 0x7F) << 15) | (Rt2 << 10) | (Rn << 5) | Rt); } @@ -2611,6 +2613,8 @@ void ARM64FloatEmitter::EncodeLoadStorePair(u32 size, bool load, IndexType type, Rt2 = DecodeReg(Rt2); Rn = DecodeReg(Rn); + ASSERT_MSG(DYNA_REC, imm >= -64 && imm < 64, "imm too large for load/store pair!"); + Write32((opc << 30) | (0b1011 << 26) | (type_encode << 23) | (load << 22) | ((imm & 0x7F) << 15) | (Rt2 << 10) | (Rn << 5) | Rt); }