mirror of
https://github.com/yuzu-mirror/yuzu
synced 2024-11-24 08:53:02 +00:00
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.
This commit is contained in:
parent
c96f22490a
commit
774eea8374
1 changed files with 8 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue