Skip to content
Snippets Groups Projects
Commit 774eea83 authored by Yuri Kunde Schlesner's avatar Yuri Kunde Schlesner
Browse files

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.
parent c96f2249
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment