|
|
@ -14,7 +14,7 @@ |
|
|
|
|
|
|
|
|
namespace Dynarmic { |
|
|
namespace Dynarmic { |
|
|
|
|
|
|
|
|
ExclusiveMonitor::ExclusiveMonitor(size_t processor_count) |
|
|
|
|
|
|
|
|
ExclusiveMonitor::ExclusiveMonitor(std::size_t processor_count) |
|
|
: exclusive_addresses(processor_count, INVALID_EXCLUSIVE_ADDRESS), exclusive_values(processor_count) {} |
|
|
: exclusive_addresses(processor_count, INVALID_EXCLUSIVE_ADDRESS), exclusive_values(processor_count) {} |
|
|
|
|
|
|
|
|
size_t ExclusiveMonitor::GetProcessorCount() const { |
|
|
size_t ExclusiveMonitor::GetProcessorCount() const { |
|
|
@ -29,20 +29,16 @@ void ExclusiveMonitor::Unlock() { |
|
|
lock.Unlock(); |
|
|
lock.Unlock(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
bool ExclusiveMonitor::CheckAndClear(size_t processor_id, VAddr address) { |
|
|
|
|
|
|
|
|
bool ExclusiveMonitor::CheckAndClear(std::size_t processor_id, VAddr address) { |
|
|
const VAddr masked_address = address & RESERVATION_GRANULE_MASK; |
|
|
const VAddr masked_address = address & RESERVATION_GRANULE_MASK; |
|
|
|
|
|
|
|
|
Lock(); |
|
|
Lock(); |
|
|
if (exclusive_addresses[processor_id] != masked_address) { |
|
|
if (exclusive_addresses[processor_id] != masked_address) { |
|
|
Unlock(); |
|
|
Unlock(); |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
for (VAddr& other_address : exclusive_addresses) { |
|
|
|
|
|
if (other_address == masked_address) { |
|
|
|
|
|
|
|
|
for (VAddr& other_address : exclusive_addresses) |
|
|
|
|
|
if (other_address == masked_address) |
|
|
other_address = INVALID_EXCLUSIVE_ADDRESS; |
|
|
other_address = INVALID_EXCLUSIVE_ADDRESS; |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|