From e3f0c9323039bd1148a8e36a31b468a871971fbb Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 28 Jul 2020 04:32:39 -0400 Subject: common/atomic_ops: Don't cast away volatile from pointers Preserves the volatility of the pointers being casted. --- src/core/memory.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/core') diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 2c5588933..86d17c6cb 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -704,7 +704,7 @@ struct Memory::Impl { u8* page_pointer = current_page_table->pointers[vaddr >> PAGE_BITS]; if (page_pointer != nullptr) { // NOTE: Avoid adding any extra logic to this fast-path block - T volatile* pointer = reinterpret_cast(&page_pointer[vaddr]); + auto* pointer = reinterpret_cast(&page_pointer[vaddr]); return Common::AtomicCompareAndSwap(pointer, data, expected); } @@ -720,9 +720,8 @@ struct Memory::Impl { case Common::PageType::RasterizerCachedMemory: { u8* host_ptr{GetPointerFromRasterizerCachedMemory(vaddr)}; system.GPU().InvalidateRegion(vaddr, sizeof(T)); - T volatile* pointer = reinterpret_cast(&host_ptr); + auto* pointer = reinterpret_cast(&host_ptr); return Common::AtomicCompareAndSwap(pointer, data, expected); - break; } default: UNREACHABLE(); @@ -734,7 +733,7 @@ struct Memory::Impl { u8* const page_pointer = current_page_table->pointers[vaddr >> PAGE_BITS]; if (page_pointer != nullptr) { // NOTE: Avoid adding any extra logic to this fast-path block - u64 volatile* pointer = reinterpret_cast(&page_pointer[vaddr]); + auto* pointer = reinterpret_cast(&page_pointer[vaddr]); return Common::AtomicCompareAndSwap(pointer, data, expected); } @@ -750,9 +749,8 @@ struct Memory::Impl { case Common::PageType::RasterizerCachedMemory: { u8* host_ptr{GetPointerFromRasterizerCachedMemory(vaddr)}; system.GPU().InvalidateRegion(vaddr, sizeof(u128)); - u64 volatile* pointer = reinterpret_cast(&host_ptr); + auto* pointer = reinterpret_cast(&host_ptr); return Common::AtomicCompareAndSwap(pointer, data, expected); - break; } default: UNREACHABLE(); -- cgit v1.2.3