[Kernel/Threading] Fix some kernel threading issues

- broken atomic exchange on linux
- spinlock release memory buffer
- race in thread suspension
- removed misleading volatile qualifiers
This commit is contained in:
Herman S.
2025-09-27 16:26:22 +09:00
parent c4bd0c3f33
commit 4f1394bbaa
4 changed files with 34 additions and 9 deletions

View File

@@ -1167,8 +1167,8 @@ DECLARE_XBOXKRNL_EXPORT3(KfAcquireSpinLock, kThreading, kImplemented, kBlocking,
void xeKeKfReleaseSpinLock(PPCContext* ctx, X_KSPINLOCK* lock,
uint32_t old_irql, bool change_irql) {
assert_true(lock->prcb_of_owner == static_cast<uint32_t>(ctx->r[13]));
// Unlock.
lock->prcb_of_owner.value = 0;
// Unlock with release semantics to ensure all prior writes are visible.
xe::atomic_store_release(0u, &lock->prcb_of_owner.value);
if (change_irql) {
// Unlock.