Merge pull request #577 from lioncash/barrier

thumb32: Implement barrier instructions and CLREX
This commit is contained in:
merry 2021-02-19 22:51:13 +00:00 committed by GitHub
commit 75f4978da5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 4 deletions

View file

@ -106,10 +106,10 @@ INST(thumb32_MOVT, "MOVT", "11110i101100iiii0iiidd
//INST(thumb32_ENTERX, "ENTERX", "111100111011----10-0----0001----")
//INST(thumb32_LEAVEX, "LEAVEX", "111100111011----10-0----0000----")
//INST(thumb32_CLREX, "CLREX", "111100111011----10-0----0010----")
//INST(thumb32_DSB, "DSB", "111100111011----10-0----0100----")
//INST(thumb32_DMB, "DMB", "111100111011----10-0----0101----")
//INST(thumb32_ISB, "ISB", "111100111011----10-0----0110----")
INST(thumb32_CLREX, "CLREX", "11110011101111111000111100101111")
INST(thumb32_DSB, "DSB", "1111001110111111100011110100oooo")
INST(thumb32_DMB, "DMB", "1111001110111111100011110101oooo")
INST(thumb32_ISB, "ISB", "1111001110111111100011110110oooo")
//INST(thumb32_BXJ, "BXJ", "111100111100----1000111100000000")
//INST(thumb32_ERET, "ERET", "11110011110111101000111100000000")

View file

@ -7,6 +7,28 @@
namespace Dynarmic::A32 {
bool ThumbTranslatorVisitor::thumb32_CLREX() {
ir.ClearExclusive();
return true;
}
bool ThumbTranslatorVisitor::thumb32_DMB([[maybe_unused]] Imm<4> option) {
ir.DataMemoryBarrier();
return true;
}
bool ThumbTranslatorVisitor::thumb32_DSB([[maybe_unused]] Imm<4> option) {
ir.DataSynchronizationBarrier();
return true;
}
bool ThumbTranslatorVisitor::thumb32_ISB([[maybe_unused]] Imm<4> option) {
ir.InstructionSynchronizationBarrier();
ir.BranchWritePC(ir.Imm32(ir.current_location.PC() + 4));
ir.SetTerm(IR::Term::ReturnToDispatch{});
return false;
}
bool ThumbTranslatorVisitor::thumb32_UDF() {
return thumb16_UDF();
}

View file

@ -164,6 +164,10 @@ struct ThumbTranslatorVisitor final {
bool thumb32_MOVW_imm(Imm<1> imm1, Imm<4> imm4, Imm<3> imm3, Reg d, Imm<8> imm8);
// thumb32 miscellaneous control instructions
bool thumb32_CLREX();
bool thumb32_DMB(Imm<4> option);
bool thumb32_DSB(Imm<4> option);
bool thumb32_ISB(Imm<4> option);
bool thumb32_UDF();
// thumb32 branch instructions