interface: allow clear of previously-signaled halt
This commit is contained in:
parent
ff47d0de72
commit
02c8b434c7
5 changed files with 36 additions and 2 deletions
|
@ -101,6 +101,10 @@ struct Jit::Impl {
|
||||||
Atomic::Or(&jit_state.halt_reason, static_cast<u32>(hr));
|
Atomic::Or(&jit_state.halt_reason, static_cast<u32>(hr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClearHalt(HaltReason hr) {
|
||||||
|
Atomic::And(&jit_state.halt_reason, ~static_cast<u32>(hr));
|
||||||
|
}
|
||||||
|
|
||||||
void ClearExclusiveState() {
|
void ClearExclusiveState() {
|
||||||
jit_state.exclusive_state = 0;
|
jit_state.exclusive_state = 0;
|
||||||
}
|
}
|
||||||
|
@ -232,6 +236,10 @@ void Jit::HaltExecution(HaltReason hr) {
|
||||||
impl->HaltExecution(hr);
|
impl->HaltExecution(hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Jit::ClearHalt(HaltReason hr) {
|
||||||
|
impl->ClearHalt(hr);
|
||||||
|
}
|
||||||
|
|
||||||
void Jit::ClearExclusiveState() {
|
void Jit::ClearExclusiveState() {
|
||||||
impl->ClearExclusiveState();
|
impl->ClearExclusiveState();
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,6 +134,10 @@ public:
|
||||||
Atomic::Or(&jit_state.halt_reason, static_cast<u32>(hr));
|
Atomic::Or(&jit_state.halt_reason, static_cast<u32>(hr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClearHalt(HaltReason hr) {
|
||||||
|
Atomic::And(&jit_state.halt_reason, ~static_cast<u32>(hr));
|
||||||
|
}
|
||||||
|
|
||||||
u64 GetSP() const {
|
u64 GetSP() const {
|
||||||
return jit_state.sp;
|
return jit_state.sp;
|
||||||
}
|
}
|
||||||
|
@ -351,6 +355,10 @@ void Jit::HaltExecution(HaltReason hr) {
|
||||||
impl->HaltExecution(hr);
|
impl->HaltExecution(hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Jit::ClearHalt(HaltReason hr) {
|
||||||
|
impl->ClearHalt(hr);
|
||||||
|
}
|
||||||
|
|
||||||
u64 Jit::GetSP() const {
|
u64 Jit::GetSP() const {
|
||||||
return impl->GetSP();
|
return impl->GetSP();
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,4 +17,12 @@ inline void Or(volatile u32* ptr, u32 value) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void And(volatile u32* ptr, u32 value) {
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
_InterlockedAnd(reinterpret_cast<volatile long*>(ptr), value);
|
||||||
|
#else
|
||||||
|
__atomic_and_fetch(ptr, value, __ATOMIC_SEQ_CST);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Dynarmic::Atomic
|
} // namespace Dynarmic::Atomic
|
||||||
|
|
|
@ -57,10 +57,15 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stops execution in Jit::Run.
|
* Stops execution in Jit::Run.
|
||||||
* Can only be called from a callback.
|
|
||||||
*/
|
*/
|
||||||
void HaltExecution(HaltReason hr = HaltReason::UserDefined1);
|
void HaltExecution(HaltReason hr = HaltReason::UserDefined1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears a halt reason from flags.
|
||||||
|
* Warning: Only use this if you're sure this won't introduce races.
|
||||||
|
*/
|
||||||
|
void ClearHalt(HaltReason hr = HaltReason::UserDefined1);
|
||||||
|
|
||||||
/// View and modify registers.
|
/// View and modify registers.
|
||||||
std::array<std::uint32_t, 16>& Regs();
|
std::array<std::uint32_t, 16>& Regs();
|
||||||
const std::array<std::uint32_t, 16>& Regs() const;
|
const std::array<std::uint32_t, 16>& Regs() const;
|
||||||
|
|
|
@ -58,10 +58,15 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stops execution in Jit::Run.
|
* Stops execution in Jit::Run.
|
||||||
* Can only be called from a callback.
|
|
||||||
*/
|
*/
|
||||||
void HaltExecution(HaltReason hr = HaltReason::UserDefined1);
|
void HaltExecution(HaltReason hr = HaltReason::UserDefined1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears a halt reason from flags.
|
||||||
|
* Warning: Only use this if you're sure this won't introduce races.
|
||||||
|
*/
|
||||||
|
void ClearHalt(HaltReason hr = HaltReason::UserDefined1);
|
||||||
|
|
||||||
/// Read Stack Pointer
|
/// Read Stack Pointer
|
||||||
std::uint64_t GetSP() const;
|
std::uint64_t GetSP() const;
|
||||||
/// Modify Stack Pointer
|
/// Modify Stack Pointer
|
||||||
|
|
Loading…
Reference in a new issue