summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner2015-05-10 19:49:46 -0300
committerGravatar Yuri Kunde Schlesner2015-05-10 20:05:29 -0300
commit774eea83741286338e249e1bf188f53b53243411 (patch)
tree57f077f8c88afc74bb1dac5573db511d823af1a5 /src
parentKernel: Capture SharedMemory attributes at creation, not when mapping (diff)
downloadyuzu-774eea83741286338e249e1bf188f53b53243411.tar.gz
yuzu-774eea83741286338e249e1bf188f53b53243411.tar.xz
yuzu-774eea83741286338e249e1bf188f53b53243411.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/kernel/shared_memory.cpp8
1 files changed, 8 insertions, 0 deletions
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 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <cstring>
6
5#include "common/logging/log.h" 7#include "common/logging/log.h"
6 8
7#include "core/mem_map.h" 9#include "core/mem_map.h"
@@ -38,6 +40,12 @@ ResultCode SharedMemory::Map(VAddr address, MemoryPermission permissions,
38 40
39 // TODO: Test permissions 41 // TODO: Test permissions
40 42
43 // HACK: Since there's no way to write to the memory block without mapping it onto the game
44 // process yet, at least initialize memory the first time it's mapped.
45 if (address != this->base_address) {
46 std::memset(Memory::GetPointer(address), 0, size);
47 }
48
41 this->base_address = address; 49 this->base_address = address;
42 50
43 return RESULT_SUCCESS; 51 return RESULT_SUCCESS;