From 9cb4790428f8f1f54ec54016df33a04beed711cb Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 12 Mar 2021 19:43:44 -0500 Subject: [PATCH] thumb32: Implement POP This can just be treated as an alias to LDMIA --- src/frontend/A32/decoder/thumb32.inc | 2 +- .../A32/translate/impl/thumb32_load_store_multiple.cpp | 4 ++++ src/frontend/A32/translate/impl/translate_thumb.h | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/frontend/A32/decoder/thumb32.inc b/src/frontend/A32/decoder/thumb32.inc index 63292053..e104fd43 100644 --- a/src/frontend/A32/decoder/thumb32.inc +++ b/src/frontend/A32/decoder/thumb32.inc @@ -2,7 +2,7 @@ //INST(thumb32_SRS_1, "SRS", "1110100000-0--------------------") //INST(thumb32_RFE_2, "RFE", "1110100000-1--------------------") INST(thumb32_STMIA, "STMIA/STMEA", "1110100010W0nnnn0iiiiiiiiiiiiiii") -//INST(thumb32_POP, "POP", "1110100010111101----------------") +INST(thumb32_POP, "POP", "1110100010111101iiiiiiiiiiiiiiii") INST(thumb32_LDMIA, "LDMIA/LDMFD", "1110100010W1nnnniiiiiiiiiiiiiiii") //INST(thumb32_PUSH, "PUSH", "1110100100101101----------------") INST(thumb32_STMDB, "STMDB/STMFD", "1110100100W0nnnn0iiiiiiiiiiiiiii") diff --git a/src/frontend/A32/translate/impl/thumb32_load_store_multiple.cpp b/src/frontend/A32/translate/impl/thumb32_load_store_multiple.cpp index b538bfef..bac48eb3 100644 --- a/src/frontend/A32/translate/impl/thumb32_load_store_multiple.cpp +++ b/src/frontend/A32/translate/impl/thumb32_load_store_multiple.cpp @@ -101,6 +101,10 @@ bool ThumbTranslatorVisitor::thumb32_LDMIA(bool W, Reg n, Imm<16> reg_list) { return LDMHelper(ir, W, n, regs_imm, start_address, writeback_address); } +bool ThumbTranslatorVisitor::thumb32_POP(Imm<16> reg_list) { + return thumb32_LDMIA(true, Reg::SP, reg_list); +} + bool ThumbTranslatorVisitor::thumb32_STMIA(bool W, Reg n, Imm<15> reg_list) { const auto regs_imm = reg_list.ZeroExtend(); const auto num_regs = static_cast(Common::BitCount(regs_imm)); diff --git a/src/frontend/A32/translate/impl/translate_thumb.h b/src/frontend/A32/translate/impl/translate_thumb.h index 5a066cdd..495a7d9d 100644 --- a/src/frontend/A32/translate/impl/translate_thumb.h +++ b/src/frontend/A32/translate/impl/translate_thumb.h @@ -174,6 +174,7 @@ struct ThumbTranslatorVisitor final { // thumb32 load/store multiple instructions bool thumb32_LDMDB(bool W, Reg n, Imm<16> reg_list); bool thumb32_LDMIA(bool W, Reg n, Imm<16> reg_list); + bool thumb32_POP(Imm<16> reg_list); bool thumb32_STMIA(bool W, Reg n, Imm<15> reg_list); bool thumb32_STMDB(bool W, Reg n, Imm<15> reg_list);