From 95588d3faa4bef8532e96ac20e3836a7bdedcabc Mon Sep 17 00:00:00 2001 From: MerryMage Date: Mon, 18 Jul 2016 22:48:23 +0100 Subject: [PATCH] Fix Thumb BLX (imm), BL (imm) for negative immediates --- src/frontend/translate/translate_thumb.cpp | 4 ++-- tests/arm/test_thumb_instructions.cpp | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/frontend/translate/translate_thumb.cpp b/src/frontend/translate/translate_thumb.cpp index d16dc2a4..cdd77e7b 100644 --- a/src/frontend/translate/translate_thumb.cpp +++ b/src/frontend/translate/translate_thumb.cpp @@ -789,7 +789,7 @@ struct ThumbTranslatorVisitor final { } bool thumb32_BL_imm(Imm11 hi, Imm11 lo) { - s32 imm32 = Common::SignExtend<32, s32>((hi << 12) | (lo << 1)); + s32 imm32 = Common::SignExtend<23, s32>((hi << 12) | (lo << 1)); // BL