system: Raise exception for YIELD, WFE, WFI, SEV, SEVL
This commit is contained in:
parent
c832cec96d
commit
fd075d8d68
4 changed files with 23 additions and 12 deletions
|
@ -28,6 +28,16 @@ enum class Exception {
|
||||||
/// This behaviour is up to the user of this library to define.
|
/// This behaviour is up to the user of this library to define.
|
||||||
/// Note: Constraints on unpredictable behaviour are specified in the ARMv8 ARM.
|
/// Note: Constraints on unpredictable behaviour are specified in the ARMv8 ARM.
|
||||||
UnpredictableInstruction,
|
UnpredictableInstruction,
|
||||||
|
/// A WFI instruction was executed. You may now enter a low-power state.
|
||||||
|
WaitForInterrupt,
|
||||||
|
/// A WFE instruction was executed. You may now enter a low-power state if the event register is clear.
|
||||||
|
WaitForEvent,
|
||||||
|
/// A SEV instruction was executed. The event register of all PEs should be set.
|
||||||
|
SendEvent,
|
||||||
|
/// A SEV instruction was executed. The event register of the current PE should be set.
|
||||||
|
SendEventLocal,
|
||||||
|
/// A YIELD instruction was executed.
|
||||||
|
Yield,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class DataCacheOperation {
|
enum class DataCacheOperation {
|
||||||
|
|
|
@ -16,9 +16,7 @@ bool TranslatorVisitor::InterpretThisInstruction() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TranslatorVisitor::UnpredictableInstruction() {
|
bool TranslatorVisitor::UnpredictableInstruction() {
|
||||||
ir.ExceptionRaised(Exception::UnpredictableInstruction);
|
return RaiseException(Exception::UnpredictableInstruction);
|
||||||
ir.SetTerm(IR::Term::CheckHalt{IR::Term::ReturnToDispatch{}});
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TranslatorVisitor::DecodeError() {
|
bool TranslatorVisitor::DecodeError() {
|
||||||
|
@ -27,13 +25,15 @@ bool TranslatorVisitor::DecodeError() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TranslatorVisitor::ReservedValue() {
|
bool TranslatorVisitor::ReservedValue() {
|
||||||
ir.ExceptionRaised(Exception::ReservedValue);
|
return RaiseException(Exception::ReservedValue);
|
||||||
ir.SetTerm(IR::Term::CheckHalt{IR::Term::ReturnToDispatch{}});
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TranslatorVisitor::UnallocatedEncoding() {
|
bool TranslatorVisitor::UnallocatedEncoding() {
|
||||||
ir.ExceptionRaised(Exception::UnallocatedEncoding);
|
return RaiseException(Exception::UnallocatedEncoding);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TranslatorVisitor::RaiseException(Exception exception) {
|
||||||
|
ir.ExceptionRaised(exception);
|
||||||
ir.SetTerm(IR::Term::CheckHalt{IR::Term::ReturnToDispatch{}});
|
ir.SetTerm(IR::Term::CheckHalt{IR::Term::ReturnToDispatch{}});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ struct TranslatorVisitor final {
|
||||||
bool DecodeError();
|
bool DecodeError();
|
||||||
bool ReservedValue();
|
bool ReservedValue();
|
||||||
bool UnallocatedEncoding();
|
bool UnallocatedEncoding();
|
||||||
|
bool RaiseException(Exception exception);
|
||||||
|
|
||||||
struct BitMasks {
|
struct BitMasks {
|
||||||
u64 wmask, tmask;
|
u64 wmask, tmask;
|
||||||
|
|
|
@ -17,23 +17,23 @@ bool TranslatorVisitor::NOP() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TranslatorVisitor::YIELD() {
|
bool TranslatorVisitor::YIELD() {
|
||||||
return true;
|
return RaiseException(Exception::Yield);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TranslatorVisitor::WFE() {
|
bool TranslatorVisitor::WFE() {
|
||||||
return true;
|
return RaiseException(Exception::WaitForEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TranslatorVisitor::WFI() {
|
bool TranslatorVisitor::WFI() {
|
||||||
return true;
|
return RaiseException(Exception::WaitForInterrupt);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TranslatorVisitor::SEV() {
|
bool TranslatorVisitor::SEV() {
|
||||||
return true;
|
return RaiseException(Exception::SendEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TranslatorVisitor::SEVL() {
|
bool TranslatorVisitor::SEVL() {
|
||||||
return true;
|
return RaiseException(Exception::SendEventLocal);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TranslatorVisitor::CLREX(Imm<4> /*CRm*/) {
|
bool TranslatorVisitor::CLREX(Imm<4> /*CRm*/) {
|
||||||
|
|
Loading…
Reference in a new issue