mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-26 14:51:49 +01:00
Read address
atomically in WaitForAddress
We didn't read the values for arbitration atomically in all cases as we should have, this consolidates the reading of the value and uses the value across all cases.
This commit is contained in:
parent
e8a1bd1aad
commit
d0c56235f4
@ -288,14 +288,14 @@ namespace skyline::kernel::type {
|
||||
{
|
||||
std::scoped_lock lock{syncWaiterMutex};
|
||||
|
||||
u32 userValue{__atomic_load_n(address, __ATOMIC_SEQ_CST)};
|
||||
switch (type) {
|
||||
case ArbitrationType::WaitIfLessThan:
|
||||
if (*address >= value) [[unlikely]]
|
||||
if (userValue >= value) [[unlikely]]
|
||||
return result::InvalidState;
|
||||
break;
|
||||
|
||||
case ArbitrationType::DecrementAndWaitIfLessThan: {
|
||||
u32 userValue{__atomic_load_n(address, __ATOMIC_SEQ_CST)};
|
||||
do {
|
||||
if (value <= userValue) [[unlikely]] // We want to explicitly decrement **after** the check
|
||||
return result::InvalidState;
|
||||
@ -304,7 +304,7 @@ namespace skyline::kernel::type {
|
||||
}
|
||||
|
||||
case ArbitrationType::WaitIfEqual:
|
||||
if (*address != value) [[unlikely]]
|
||||
if (userValue != value) [[unlikely]]
|
||||
return result::InvalidState;
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user