Implement thumb16_SVC

This commit is contained in:
MerryMage 2016-07-14 15:01:30 +01:00
parent 181f78f36e
commit 63242924fc
3 changed files with 13 additions and 2 deletions

View file

@ -56,7 +56,7 @@ private:
}; };
template <typename V> template <typename V>
const std::array<Thumb16Matcher<V>, 35> g_thumb16_instruction_table = { const std::array<Thumb16Matcher<V>, 36> g_thumb16_instruction_table = {
#define INST(fn, name, bitstring) detail::detail<Thumb16Matcher, u16, 16>::GetMatcher<decltype(fn), fn>(name, bitstring) #define INST(fn, name, bitstring) detail::detail<Thumb16Matcher, u16, 16>::GetMatcher<decltype(fn), fn>(name, bitstring)
@ -140,7 +140,7 @@ const std::array<Thumb16Matcher<V>, 35> g_thumb16_instruction_table = {
//INST(&V::thumb16_BX, "BX (reg)", "010001110mmmm000"), // v4T //INST(&V::thumb16_BX, "BX (reg)", "010001110mmmm000"), // v4T
//INST(&V::thumb16_BLX, "BLX (reg)", "010001111mmmm000"), // v5T //INST(&V::thumb16_BLX, "BLX (reg)", "010001111mmmm000"), // v5T
INST(&V::thumb16_UDF, "UDF", "11011110--------"), INST(&V::thumb16_UDF, "UDF", "11011110--------"),
//INST(&V::thumb16_SWI, "SWI", "11011111xxxxxxxx"), INST(&V::thumb16_SVC, "SVC", "11011111xxxxxxxx"),
//INST(&V::thumb16_B_cond, "B (cond)", "1101ccccxxxxxxxx"), //INST(&V::thumb16_B_cond, "B (cond)", "1101ccccxxxxxxxx"),
//INST(&V::thumb16_B_imm, "B (imm)", "11100xxxxxxxxxxx"), //INST(&V::thumb16_B_imm, "B (imm)", "11100xxxxxxxxxxx"),
//INST(&V::thumb16_BLX_suffix, "BLX (imm, suffix)", "11101xxxxxxxxxx0"), //INST(&V::thumb16_BLX_suffix, "BLX (imm, suffix)", "11101xxxxxxxxxx0"),

View file

@ -247,6 +247,10 @@ public:
std::string thumb16_UDF() { std::string thumb16_UDF() {
return Common::StringFromFormat("udf"); return Common::StringFromFormat("udf");
} }
std::string thumb16_SVC(Imm8 imm8) {
return Common::StringFromFormat("svc #%u", imm8);
}
}; };
std::string DisassembleThumb16(u16 instruction) { std::string DisassembleThumb16(u16 instruction) {

View file

@ -443,6 +443,13 @@ struct ThumbTranslatorVisitor final {
bool thumb16_UDF() { bool thumb16_UDF() {
return TranslateThisInstruction(); return TranslateThisInstruction();
} }
bool thumb16_SVC(Imm8 imm8) {
u32 imm32 = imm8;
// SVC #<imm8>
ir.CallSupervisor(ir.Imm32(imm32));
return false;
}
}; };
enum class ThumbInstSize { enum class ThumbInstSize {