VERY experimental Nintendo Switch 2 emulator
C++
Kernel: Zero-fill shared memory blocks when mapping
Yuri Kunde Schlesner774eea837412
diff --git a/src/core/hle/kernel/shared_memory.cpp b/src/core/hle/kernel/shared_memory.cppindex 178589cbb1..0c59f48767 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 <cstring>+#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;