diff --git a/include/dynarmic/A32/config.h b/include/dynarmic/A32/config.h index aa8f40d2..36f53be5 100644 --- a/include/dynarmic/A32/config.h +++ b/include/dynarmic/A32/config.h @@ -24,6 +24,8 @@ enum class Exception { /// An unpredictable instruction is to be executed. Implementation-defined behaviour should now happen. /// This behaviour is up to the user of this library to define. UnpredictableInstruction, + /// A BKPT instruction was executed. + Breakpoint, }; /// These function pointers may be inserted into compiled code. diff --git a/src/frontend/A32/translate/translate_arm/exception_generating.cpp b/src/frontend/A32/translate/translate_arm/exception_generating.cpp index cbdae36c..1fe76290 100644 --- a/src/frontend/A32/translate/translate_arm/exception_generating.cpp +++ b/src/frontend/A32/translate/translate_arm/exception_generating.cpp @@ -6,10 +6,18 @@ #include "translate_arm.h" +#include "dynarmic/A32/config.h" + namespace Dynarmic::A32 { -bool ArmTranslatorVisitor::arm_BKPT(Cond /*cond*/, Imm12 /*imm12*/, Imm4 /*imm4*/) { - return InterpretThisInstruction(); +bool ArmTranslatorVisitor::arm_BKPT(Cond cond, Imm12 /*imm12*/, Imm4 /*imm4*/) { + if (cond != Cond::AL) { + return UnpredictableInstruction(); + } + + ir.ExceptionRaised(Exception::Breakpoint); + ir.SetTerm(IR::Term::CheckHalt{IR::Term::ReturnToDispatch{}}); + return false; } bool ArmTranslatorVisitor::arm_SVC(Cond cond, Imm24 imm24) {