Merge pull request #495 from lioncash/bkpt

A32: Implement Thumb-16's variant of BKPT
This commit is contained in:
Merry 2019-05-03 21:10:24 +01:00 committed by MerryMage
commit 81b908b077
3 changed files with 14 additions and 1 deletions

View file

@ -99,7 +99,7 @@ std::optional<std::reference_wrapper<const Thumb16Matcher<V>>> DecodeThumb16(u16
INST(&V::thumb16_REV, "REV", "1011101000mmmddd"), // v6
INST(&V::thumb16_REV16, "REV16", "1011101001mmmddd"), // v6
INST(&V::thumb16_REVSH, "REVSH", "1011101011mmmddd"), // v6
//INST(&V::thumb16_BKPT, "BKPT", "10111110xxxxxxxx"), // v5
INST(&V::thumb16_BKPT, "BKPT", "10111110xxxxxxxx"), // v5
// Store/Load multiple registers
INST(&V::thumb16_STMIA, "STMIA", "11000nnnxxxxxxxx"),

View file

@ -292,6 +292,10 @@ public:
return fmt::format("revsh {}, {}", d, m);
}
std::string thumb16_BKPT(Imm<8> imm8) {
return fmt::format("bkpt #{}", imm8.ZeroExtend());
}
std::string thumb16_STMIA(Reg n, RegList reg_list) {
return fmt::format("stm {}!, {{{}}}", n, RegListToString(reg_list));
}

View file

@ -6,6 +6,8 @@
#include <tuple>
#include <dynarmic/A32/config.h>
#include "common/assert.h"
#include "common/bit_util.h"
#include "frontend/imm.h"
@ -804,6 +806,13 @@ struct ThumbTranslatorVisitor final {
return true;
}
// BKPT #<imm8>
bool thumb16_BKPT([[maybe_unused]] Imm<8> imm8) {
ir.ExceptionRaised(Exception::Breakpoint);
ir.SetTerm(IR::Term::CheckHalt{IR::Term::ReturnToDispatch{}});
return false;
}
// STM <Rn>!, <reg_list>
bool thumb16_STMIA(Reg n, RegList reg_list) {
auto address = ir.GetRegister(n);