From 25b136ac176ab643e91ce124121722ca67769e45 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Mon, 17 May 2021 21:55:03 +0200 Subject: [PATCH] =?UTF-8?q?VideoCommon:=20Fix=20a=20-Wclass-memaccess=20in?= =?UTF-8?q?=20gcc=C2=A011?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/Core/VideoCommon/CommandProcessor.cpp | 31 ++++++++++++++++---- Source/Core/VideoCommon/CommandProcessor.h | 1 + 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/Source/Core/VideoCommon/CommandProcessor.cpp b/Source/Core/VideoCommon/CommandProcessor.cpp index 95c157d4e0..bca9f3b21d 100644 --- a/Source/Core/VideoCommon/CommandProcessor.cpp +++ b/Source/Core/VideoCommon/CommandProcessor.cpp @@ -48,6 +48,30 @@ static void UpdateInterrupts_Wrapper(u64 userdata, s64 cyclesLate) UpdateInterrupts(userdata); } +void SCPFifoStruct::Init() +{ + CPBase = 0; + CPEnd = 0; + CPHiWatermark = 0; + CPLoWatermark = 0; + CPReadWriteDistance = 0; + CPWritePointer = 0; + CPReadPointer = 0; + CPBreakpoint = 0; + SafeCPReadPointer = 0; + + bFF_GPLinkEnable = 0; + bFF_GPReadEnable = 0; + bFF_BPEnable = 0; + bFF_BPInt = 0; + + bFF_Breakpoint.store(0, std::memory_order_relaxed); + bFF_HiWatermark.store(0, std::memory_order_relaxed); + bFF_HiWatermarkInt.store(0, std::memory_order_relaxed); + bFF_LoWatermark.store(0, std::memory_order_relaxed); + bFF_LoWatermarkInt.store(0, std::memory_order_relaxed); +} + void SCPFifoStruct::DoState(PointerWrap& p) { p.Do(CPBase); @@ -117,12 +141,7 @@ void Init() m_tokenReg = 0; - memset(&fifo, 0, sizeof(fifo)); - fifo.bFF_Breakpoint.store(0, std::memory_order_relaxed); - fifo.bFF_HiWatermark.store(0, std::memory_order_relaxed); - fifo.bFF_HiWatermarkInt.store(0, std::memory_order_relaxed); - fifo.bFF_LoWatermark.store(0, std::memory_order_relaxed); - fifo.bFF_LoWatermarkInt.store(0, std::memory_order_relaxed); + fifo.Init(); s_interrupt_set.Clear(); s_interrupt_waiting.Clear(); diff --git a/Source/Core/VideoCommon/CommandProcessor.h b/Source/Core/VideoCommon/CommandProcessor.h index 66ef981cac..4ca73c71d2 100644 --- a/Source/Core/VideoCommon/CommandProcessor.h +++ b/Source/Core/VideoCommon/CommandProcessor.h @@ -40,6 +40,7 @@ struct SCPFifoStruct std::atomic bFF_LoWatermark; std::atomic bFF_HiWatermark; + void Init(); void DoState(PointerWrap& p); };