From 89838c5ce4dd329958caddd96bafc22863d31850 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 22 Feb 2021 07:41:29 -0500 Subject: [PATCH] thumb32: Implement BXJ We handle this as a regular BX call, given we don't support Jazelle. --- src/frontend/A32/decoder/thumb32.inc | 2 +- src/frontend/A32/translate/impl/thumb32_control.cpp | 8 ++++++++ src/frontend/A32/translate/impl/translate_thumb.h | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/frontend/A32/decoder/thumb32.inc b/src/frontend/A32/decoder/thumb32.inc index 01325409..798be05d 100644 --- a/src/frontend/A32/decoder/thumb32.inc +++ b/src/frontend/A32/decoder/thumb32.inc @@ -111,7 +111,7 @@ INST(thumb32_DSB, "DSB", "1111001110111111100011 INST(thumb32_DMB, "DMB", "1111001110111111100011110101oooo") INST(thumb32_ISB, "ISB", "1111001110111111100011110110oooo") -//INST(thumb32_BXJ, "BXJ", "111100111100----1000111100000000") +INST(thumb32_BXJ, "BXJ", "111100111100mmmm1000111100000000") //INST(thumb32_ERET, "ERET", "11110011110111101000111100000000") //INST(thumb32_SUBS_pc_lr, "SUBS PC, LR", "111100111101111010001111--------") diff --git a/src/frontend/A32/translate/impl/thumb32_control.cpp b/src/frontend/A32/translate/impl/thumb32_control.cpp index ed2dc29b..93a45d8d 100644 --- a/src/frontend/A32/translate/impl/thumb32_control.cpp +++ b/src/frontend/A32/translate/impl/thumb32_control.cpp @@ -7,6 +7,14 @@ namespace Dynarmic::A32 { +bool ThumbTranslatorVisitor::thumb32_BXJ(Reg m) { + if (m == Reg::PC) { + return UnpredictableInstruction(); + } + + return thumb16_BX(m); +} + bool ThumbTranslatorVisitor::thumb32_CLREX() { ir.ClearExclusive(); return true; diff --git a/src/frontend/A32/translate/impl/translate_thumb.h b/src/frontend/A32/translate/impl/translate_thumb.h index eae0f7c6..a577731a 100644 --- a/src/frontend/A32/translate/impl/translate_thumb.h +++ b/src/frontend/A32/translate/impl/translate_thumb.h @@ -164,6 +164,7 @@ struct ThumbTranslatorVisitor final { bool thumb32_MOVW_imm(Imm<1> imm1, Imm<4> imm4, Imm<3> imm3, Reg d, Imm<8> imm8); // thumb32 miscellaneous control instructions + bool thumb32_BXJ(Reg m); bool thumb32_CLREX(); bool thumb32_DMB(Imm<4> option); bool thumb32_DSB(Imm<4> option);