thumb32: Implement MRS (register)

This commit is contained in:
MerryMage 2021-05-04 12:35:28 +01:00
parent a5a210a9a5
commit 61333917a4
4 changed files with 20 additions and 2 deletions

View file

@ -110,8 +110,7 @@ INST(thumb32_BXJ, "BXJ", "111100111100mmmm100011
//INST(thumb32_SUBS_pc_lr, "SUBS PC, LR", "111100111101111010001111--------")
//INST(thumb32_MRS_banked, "MRS (banked)", "11110011111-----10-0------1-----")
//INST(thumb32_MRS_reg_1, "MRS (reg)", "111100111111----10-0------0-----")
//INST(thumb32_MRS_reg_2, "MRS (reg)", "111100111110----10-0------0-----")
INST(thumb32_MRS_reg, "MRS (reg)", "11110011111R11111000dddd00000000")
//INST(thumb32_HVC, "HVC", "111101111110----1000------------")
//INST(thumb32_SMC, "SMC", "111101111111----1000000000000000")
INST(thumb32_UDF, "UDF", "111101111111----1010------------") // v6T2

View file

@ -66,4 +66,19 @@ bool TranslatorVisitor::thumb32_YIELD() {
return thumb16_YIELD();
}
bool TranslatorVisitor::thumb32_MRS_reg(bool read_spsr, Reg d) {
if (d == Reg::R15) {
return UnpredictableInstruction();
}
// TODO: Revisit when implementing more than user mode.
if (read_spsr) {
return UndefinedInstruction();
}
ir.SetRegister(d, ir.GetCpsr());
return true;
}
} // namespace Dynarmic::A32

View file

@ -575,6 +575,7 @@ struct TranslatorVisitor final {
bool thumb32_WFE();
bool thumb32_WFI();
bool thumb32_YIELD();
bool thumb32_MSR_reg(bool R, Reg n, Imm<4> mask);
// thumb32 branch instructions
bool thumb32_BL_imm(Imm<1> S, Imm<10> hi, Imm<1> j1, Imm<1> j2, Imm<11> lo);

View file

@ -192,6 +192,9 @@ std::vector<u16> GenRandomThumbInst(u32 pc, bool is_last_inst, A32::ITState it_s
// FPSCR is inaccurate
"vfp_VMRS",
// Unicorn is incorrect?
"thumb32_MRS_reg",
// Unicorn has incorrect implementation (incorrect rounding and unsets CPSR.T??)
"vfp_VCVT_to_fixed",
"vfp_VCVT_from_fixed",