Implement thumb1_MOV_reg
This commit is contained in:
parent
8920ce79b9
commit
f0f14fa5e8
3 changed files with 20 additions and 2 deletions
|
@ -56,7 +56,7 @@ private:
|
|||
};
|
||||
|
||||
template <typename V>
|
||||
static const std::array<Thumb1Matcher<V>, 29> g_thumb1_instruction_table {{
|
||||
static const std::array<Thumb1Matcher<V>, 30> g_thumb1_instruction_table {{
|
||||
|
||||
#define INST(fn, name, bitstring) detail::detail<Thumb1Matcher, u16, 16>::GetMatcher<decltype(fn), fn>(name, bitstring)
|
||||
|
||||
|
@ -94,7 +94,7 @@ static const std::array<Thumb1Matcher<V>, 29> g_thumb1_instruction_table {{
|
|||
// Special data instructions
|
||||
{ INST(&V::thumb1_ADD_reg_t2, "ADD (reg, T2)", "01000100Dmmmmddd") }, // v4T, Low regs: v6T2
|
||||
{ INST(&V::thumb1_CMP_reg_t2, "CMP (reg, T2)", "01000101Nmmmmnnn") }, // v4T
|
||||
//{ INST(&V::thumb1_MOV_high, "MOV (high)", "01000110dmmmmddd") }, // v4T, Low regs: v6
|
||||
{ INST(&V::thumb1_MOV_reg, "MOV (reg)", "01000110Dmmmmddd") }, // v4T, Low regs: v6
|
||||
|
||||
// Store/Load single data item instructions
|
||||
//{ INST(&V::thumb1_LDR_lit, "LDR (literal)", "01001dddvvvvvvvv") },
|
||||
|
|
|
@ -217,6 +217,11 @@ public:
|
|||
return Common::StringFromFormat("cmp %s, %s", RegStr(n), RegStr(m));
|
||||
}
|
||||
|
||||
std::string thumb1_MOV_reg(bool d_hi, Reg m, Reg d_lo) {
|
||||
Reg d = d_hi ? (d_lo + 8) : d_lo;
|
||||
return Common::StringFromFormat("mov %s, %s", RegStr(d), RegStr(m));
|
||||
}
|
||||
|
||||
std::string thumb1_UDF() {
|
||||
return Common::StringFromFormat("udf");
|
||||
}
|
||||
|
|
|
@ -351,6 +351,19 @@ struct TranslatorVisitor final {
|
|||
ir.SetVFlag(result.overflow);
|
||||
return true;
|
||||
}
|
||||
bool thumb1_MOV_reg(bool d_hi, Reg m, Reg d_lo) {
|
||||
Reg d = d_hi ? (d_lo + 8) : d_lo;
|
||||
// MOV <Rd>, <Rm>
|
||||
auto result = ir.GetRegister(m);
|
||||
if (d == Reg::PC) {
|
||||
ir.ALUWritePC(result);
|
||||
ir.SetTerm(IR::Term::ReturnToDispatch{});
|
||||
return false;
|
||||
} else {
|
||||
ir.SetRegister(d, result);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool thumb1_UDF() {
|
||||
return TranslateThisInstruction();
|
||||
|
|
Loading…
Reference in a new issue