From 774eea83741286338e249e1bf188f53b53243411 Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Sun, 10 May 2015 19:49:46 -0300 Subject: Kernel: Zero-fill shared memory blocks when mapping This works around crashes related to GSP/HID/etc. shared memory blocks having garbage values. The proper fix requires proper management of mapped memory blocks in the process. --- src/core/hle/kernel/shared_memory.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/core/hle') diff --git a/src/core/hle/kernel/shared_memory.cpp b/src/core/hle/kernel/shared_memory.cpp index 178589cbb..0c59f4876 100644 --- a/src/core/hle/kernel/shared_memory.cpp +++ b/src/core/hle/kernel/shared_memory.cpp @@ -2,6 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include + #include "common/logging/log.h" #include "core/mem_map.h" @@ -38,6 +40,12 @@ ResultCode SharedMemory::Map(VAddr address, MemoryPermission permissions, // TODO: Test permissions + // HACK: Since there's no way to write to the memory block without mapping it onto the game + // process yet, at least initialize memory the first time it's mapped. + if (address != this->base_address) { + std::memset(Memory::GetPointer(address), 0, size); + } + this->base_address = address; return RESULT_SUCCESS; -- cgit v1.2.3