Implement CPS (Thumb)

* Since currently only User mode is emulated, CPS is a NOP.
This commit is contained in:
MerryMage 2016-12-21 22:44:27 +00:00
parent c764a2b889
commit 967f3cf7e1
3 changed files with 11 additions and 1 deletions

View file

@ -95,7 +95,7 @@ boost::optional<const Thumb16Matcher<V>&> DecodeThumb16(u16 instruction) {
INST(&V::thumb16_PUSH, "PUSH", "1011010Mxxxxxxxx"), // v4T
INST(&V::thumb16_POP, "POP", "1011110Pxxxxxxxx"), // v4T
INST(&V::thumb16_SETEND, "SETEND", "101101100101x000"), // v6
//INST(&V::thumb16_CPS, "CPS", "10110110011m0aif"), // v6
INST(&V::thumb16_CPS, "CPS", "10110110011m0aif"), // v6
INST(&V::thumb16_REV, "REV", "1011101000mmmddd"), // v6
INST(&V::thumb16_REV16, "REV16", "1011101001mmmddd"), // v6
INST(&V::thumb16_REVSH, "REVSH", "1011101011mmmddd"), // v6

View file

@ -274,6 +274,10 @@ public:
return fmt::format("setend {}", E ? "BE" : "LE");
}
std::string thumb16_CPS(bool im, bool a, bool i, bool f) {
return fmt::format("cps{} {}{}{}", im ? "id" : "ie", a ? "a" : "", i ? "i" : "", f ? "f" : "");
}
std::string thumb16_REV(Reg m, Reg d) {
return fmt::format("rev {}, {}", d, m);
}

View file

@ -699,6 +699,12 @@ struct ThumbTranslatorVisitor final {
return false;
}
bool thumb16_CPS(bool, bool, bool, bool) {
// CPS{IE,ID} <a,i,f>
// A CPS is treated as a NOP in User mode.
return true;
}
bool thumb16_REV(Reg m, Reg d) {
// REV <Rd>, <Rm>
// Rd cannot encode R15.