diff --git a/src/frontend/decoder/thumb16.h b/src/frontend/decoder/thumb16.h index c2565818..35f8845f 100644 --- a/src/frontend/decoder/thumb16.h +++ b/src/frontend/decoder/thumb16.h @@ -56,7 +56,7 @@ private: }; template -const std::array, 35> g_thumb16_instruction_table = { +const std::array, 36> g_thumb16_instruction_table = { #define INST(fn, name, bitstring) detail::detail::GetMatcher(name, bitstring) @@ -140,7 +140,7 @@ const std::array, 35> g_thumb16_instruction_table = { //INST(&V::thumb16_BX, "BX (reg)", "010001110mmmm000"), // v4T //INST(&V::thumb16_BLX, "BLX (reg)", "010001111mmmm000"), // v5T INST(&V::thumb16_UDF, "UDF", "11011110--------"), - //INST(&V::thumb16_SWI, "SWI", "11011111xxxxxxxx"), + INST(&V::thumb16_SVC, "SVC", "11011111xxxxxxxx"), //INST(&V::thumb16_B_cond, "B (cond)", "1101ccccxxxxxxxx"), //INST(&V::thumb16_B_imm, "B (imm)", "11100xxxxxxxxxxx"), //INST(&V::thumb16_BLX_suffix, "BLX (imm, suffix)", "11101xxxxxxxxxx0"), diff --git a/src/frontend/disassembler/disassembler_thumb.cpp b/src/frontend/disassembler/disassembler_thumb.cpp index d2ee495d..e17fe8b2 100644 --- a/src/frontend/disassembler/disassembler_thumb.cpp +++ b/src/frontend/disassembler/disassembler_thumb.cpp @@ -247,6 +247,10 @@ public: std::string thumb16_UDF() { return Common::StringFromFormat("udf"); } + + std::string thumb16_SVC(Imm8 imm8) { + return Common::StringFromFormat("svc #%u", imm8); + } }; std::string DisassembleThumb16(u16 instruction) { diff --git a/src/frontend/translate/translate_thumb.cpp b/src/frontend/translate/translate_thumb.cpp index e097d2da..7c777244 100644 --- a/src/frontend/translate/translate_thumb.cpp +++ b/src/frontend/translate/translate_thumb.cpp @@ -443,6 +443,13 @@ struct ThumbTranslatorVisitor final { bool thumb16_UDF() { return TranslateThisInstruction(); } + + bool thumb16_SVC(Imm8 imm8) { + u32 imm32 = imm8; + // SVC # + ir.CallSupervisor(ir.Imm32(imm32)); + return false; + } }; enum class ThumbInstSize {