From bac945f2d834f3bf497c86a9fbe0a2594f65015a Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 30 Apr 2019 23:58:39 -0400 Subject: [PATCH] A32: Resolve parameter discrepancies discovered via use of the Imm template --- src/frontend/A32/disassembler/disassembler_thumb.cpp | 8 ++++---- src/frontend/A32/translate/translate_thumb.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/frontend/A32/disassembler/disassembler_thumb.cpp b/src/frontend/A32/disassembler/disassembler_thumb.cpp index 658a508a..37e8719c 100644 --- a/src/frontend/A32/disassembler/disassembler_thumb.cpp +++ b/src/frontend/A32/disassembler/disassembler_thumb.cpp @@ -216,13 +216,13 @@ public: return fmt::format("ldrh {}, [{}, #{}]", t, n, imm32); } - std::string thumb16_STR_imm_t2(Reg t, Imm<5> imm5) { - const u32 imm32 = imm5.ZeroExtend() << 2; + std::string thumb16_STR_imm_t2(Reg t, Imm<8> imm8) { + const u32 imm32 = imm8.ZeroExtend() << 2; return fmt::format("str {}, [sp, #{}]", t, imm32); } - std::string thumb16_LDR_imm_t2(Reg t, Imm<5> imm5) { - const u32 imm32 = imm5.ZeroExtend() << 2; + std::string thumb16_LDR_imm_t2(Reg t, Imm<8> imm8) { + const u32 imm32 = imm8.ZeroExtend() << 2; return fmt::format("ldr {}, [sp, #{}]", t, imm32); } diff --git a/src/frontend/A32/translate/translate_thumb.cpp b/src/frontend/A32/translate/translate_thumb.cpp index 64b23d53..1227cda5 100644 --- a/src/frontend/A32/translate/translate_thumb.cpp +++ b/src/frontend/A32/translate/translate_thumb.cpp @@ -604,8 +604,8 @@ struct ThumbTranslatorVisitor final { // STR , [, #] // Rt cannot encode R15. - bool thumb16_STR_imm_t2(Reg t, Imm<5> imm5) { - const u32 imm32 = imm5.ZeroExtend() << 2; + bool thumb16_STR_imm_t2(Reg t, Imm<8> imm8) { + const u32 imm32 = imm8.ZeroExtend() << 2; const Reg n = Reg::SP; const auto address = ir.Add(ir.GetRegister(n), ir.Imm32(imm32)); const auto data = ir.GetRegister(t); @@ -616,8 +616,8 @@ struct ThumbTranslatorVisitor final { // LDR , [, #] // Rt cannot encode R15. - bool thumb16_LDR_imm_t2(Reg t, Imm<5> imm5) { - const u32 imm32 = imm5.ZeroExtend() << 2; + bool thumb16_LDR_imm_t2(Reg t, Imm<8> imm8) { + const u32 imm32 = imm8.ZeroExtend() << 2; const Reg n = Reg::SP; const auto address = ir.Add(ir.GetRegister(n), ir.Imm32(imm32)); const auto data = ir.ReadMemory32(address);