A32: Implement Thumb-1 variant of WFI

This commit is contained in:
Lioncash 2019-05-03 10:48:04 -04:00 committed by MerryMage
parent b4110af22a
commit ebab7ede55
3 changed files with 10 additions and 0 deletions

View File

@ -91,6 +91,7 @@ std::optional<std::reference_wrapper<const Thumb16Matcher<V>>> DecodeThumb16(u16
INST(&V::thumb16_NOP, "NOP", "1011111100000000"), // v6T2 INST(&V::thumb16_NOP, "NOP", "1011111100000000"), // v6T2
INST(&V::thumb16_SEV, "SEV", "1011111101000000"), // v7 INST(&V::thumb16_SEV, "SEV", "1011111101000000"), // v7
INST(&V::thumb16_WFE, "WFE", "1011111100100000"), // v7 INST(&V::thumb16_WFE, "WFE", "1011111100100000"), // v7
INST(&V::thumb16_WFI, "WFI", "1011111100110000"), // v7
// Miscellaneous 16-bit instructions // Miscellaneous 16-bit instructions
INST(&V::thumb16_SXTH, "SXTH", "1011001000mmmddd"), // v6 INST(&V::thumb16_SXTH, "SXTH", "1011001000mmmddd"), // v6

View File

@ -258,6 +258,10 @@ public:
return "wfe"; return "wfe";
} }
std::string thumb16_WFI() {
return "wfi";
}
std::string thumb16_SXTH(Reg m, Reg d) { std::string thumb16_SXTH(Reg m, Reg d) {
return fmt::format("sxth {}, {}", d, m); return fmt::format("sxth {}, {}", d, m);
} }

View File

@ -689,6 +689,11 @@ struct ThumbTranslatorVisitor final {
return RaiseException(Exception::WaitForEvent); return RaiseException(Exception::WaitForEvent);
} }
// WFI<c>
bool thumb16_WFI() {
return RaiseException(Exception::WaitForInterrupt);
}
// SXTH <Rd>, <Rm> // SXTH <Rd>, <Rm>
// Rd cannot encode R15. // Rd cannot encode R15.
bool thumb16_SXTH(Reg m, Reg d) { bool thumb16_SXTH(Reg m, Reg d) {