DMA: Clear state on shutdown

Fix a rare crash where the GPU starting after a second boot accesses
uninitalized DMA fields.
This commit is contained in:
Connor McLaughlin 2021-01-03 14:42:41 +10:00
parent 2ec26e54b7
commit c9ef3ec1a3
2 changed files with 9 additions and 1 deletions

View file

@ -36,10 +36,17 @@ void DMA::Initialize()
void DMA::Shutdown() void DMA::Shutdown()
{ {
ClearState();
m_unhalt_event.reset(); m_unhalt_event.reset();
} }
void DMA::Reset() void DMA::Reset()
{
ClearState();
m_unhalt_event->Deactivate();
}
void DMA::ClearState()
{ {
for (u32 i = 0; i < NUM_CHANNELS; i++) for (u32 i = 0; i < NUM_CHANNELS; i++)
{ {
@ -54,7 +61,6 @@ void DMA::Reset()
m_DICR.bits = 0; m_DICR.bits = 0;
m_halt_ticks_remaining = 0; m_halt_ticks_remaining = 0;
m_unhalt_event->Deactivate();
} }
bool DMA::DoState(StateWrapper& sw) bool DMA::DoState(StateWrapper& sw)

View file

@ -60,6 +60,8 @@ private:
Reserved = 3 Reserved = 3
}; };
void ClearState();
// is everything enabled for a channel to operate? // is everything enabled for a channel to operate?
bool CanTransferChannel(Channel channel) const; bool CanTransferChannel(Channel channel) const;
bool IsTransferHalted() const; bool IsTransferHalted() const;