mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-12-22 20:31:14 +00:00
kern: KConditionVariable::SignalToAddress now emits dmb before userspace write
This commit is contained in:
parent
035cebef9d
commit
008eb974d4
1 changed files with 19 additions and 18 deletions
|
@ -78,7 +78,7 @@ namespace ams::kern {
|
||||||
|
|
||||||
/* Remove waiter thread. */
|
/* Remove waiter thread. */
|
||||||
s32 num_waiters;
|
s32 num_waiters;
|
||||||
KThread *next_owner_thread = owner_thread->RemoveWaiterByKey(std::addressof(num_waiters), addr);
|
KThread * const next_owner_thread = owner_thread->RemoveWaiterByKey(std::addressof(num_waiters), addr);
|
||||||
|
|
||||||
/* Determine the next tag. */
|
/* Determine the next tag. */
|
||||||
u32 next_value = 0;
|
u32 next_value = 0;
|
||||||
|
@ -87,6 +87,10 @@ namespace ams::kern {
|
||||||
if (num_waiters > 1) {
|
if (num_waiters > 1) {
|
||||||
next_value |= ams::svc::HandleWaitMask;
|
next_value |= ams::svc::HandleWaitMask;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Synchronize memory before proceeding. */
|
||||||
|
cpu::DataMemoryBarrierInnerShareable();
|
||||||
|
|
||||||
/* Write the value to userspace. */
|
/* Write the value to userspace. */
|
||||||
Result result;
|
Result result;
|
||||||
|
@ -96,15 +100,12 @@ namespace ams::kern {
|
||||||
result = svc::ResultInvalidCurrentMemory();
|
result = svc::ResultInvalidCurrentMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Signal the next owner thread. */
|
/* If necessary, signal the next owner thread. */
|
||||||
|
if (next_owner_thread != nullptr) {
|
||||||
next_owner_thread->EndWait(result);
|
next_owner_thread->EndWait(result);
|
||||||
R_RETURN(result);
|
|
||||||
} else {
|
|
||||||
/* Just write the value to userspace. */
|
|
||||||
R_UNLESS(WriteToUser(addr, std::addressof(next_value)), svc::ResultInvalidCurrentMemory());
|
|
||||||
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
R_RETURN(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue