A64: Implement BRK

Currently, we can just implement this as part of the exception
interface, similar to how it's done for the A32 interface with BKPT.
This commit is contained in:
Lioncash 2018-09-18 21:17:55 -04:00 committed by MerryMage
parent b915364c16
commit 6b5ea6ee66
3 changed files with 9 additions and 1 deletions

View file

@ -38,6 +38,8 @@ enum class Exception {
SendEventLocal, SendEventLocal,
/// A YIELD instruction was executed. /// A YIELD instruction was executed.
Yield, Yield,
/// A BRK instruction was executed.
Breakpoint,
}; };
enum class DataCacheOperation { enum class DataCacheOperation {

View file

@ -34,7 +34,7 @@ INST(B_cond, "B.cond", "01010
INST(SVC, "SVC", "11010100000iiiiiiiiiiiiiiii00001") INST(SVC, "SVC", "11010100000iiiiiiiiiiiiiiii00001")
//INST(HVC, "HVC", "11010100000iiiiiiiiiiiiiiii00010") //INST(HVC, "HVC", "11010100000iiiiiiiiiiiiiiii00010")
//INST(SMC, "SMC", "11010100000iiiiiiiiiiiiiiii00011") //INST(SMC, "SMC", "11010100000iiiiiiiiiiiiiiii00011")
//INST(BRK, "BRK", "11010100001iiiiiiiiiiiiiiii00000") INST(BRK, "BRK", "11010100001iiiiiiiiiiiiiiii00000")
//INST(HLT, "HLT", "11010100010iiiiiiiiiiiiiiii00000") //INST(HLT, "HLT", "11010100010iiiiiiiiiiiiiiii00000")
//INST(DCPS1, "DCPS1", "11010100101iiiiiiiiiiiiiiii00001") //INST(DCPS1, "DCPS1", "11010100101iiiiiiiiiiiiiiii00001")
//INST(DCPS2, "DCPS2", "11010100101iiiiiiiiiiiiiiii00010") //INST(DCPS2, "DCPS2", "11010100101iiiiiiiiiiiiiiii00010")

View file

@ -8,6 +8,12 @@
namespace Dynarmic::A64 { namespace Dynarmic::A64 {
bool TranslatorVisitor::BRK([[maybe_unused]] Imm<16> imm16) {
ir.ExceptionRaised(Exception::Breakpoint);
ir.SetTerm(IR::Term::CheckHalt{IR::Term::ReturnToDispatch{}});
return false;
}
bool TranslatorVisitor::SVC(Imm<16> imm16) { bool TranslatorVisitor::SVC(Imm<16> imm16) {
ir.PushRSB(ir.current_location->AdvancePC(4)); ir.PushRSB(ir.current_location->AdvancePC(4));
ir.SetPC(ir.Imm64(ir.current_location->PC() + 4)); ir.SetPC(ir.Imm64(ir.current_location->PC() + 4));