mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-12-09 05:08:43 +00:00
Memory: Align size and address in posix_munmap (#3418)
* Properly align address and size in munmap Based on observations of FreeBSD source code, fixes a Windows-related memory issue in War Thunder (CUSA00224) * Format len and phys_addr in mmap This should make logs slightly easier to understand, since we format these parameters in other memory calls. * Update memory.cpp
This commit is contained in:
@@ -570,9 +570,10 @@ s32 PS4_SYSV_ABI sceKernelMemoryPoolBatch(const OrbisKernelMemoryPoolBatchEntry*
|
||||
}
|
||||
|
||||
void* PS4_SYSV_ABI posix_mmap(void* addr, u64 len, s32 prot, s32 flags, s32 fd, s64 phys_addr) {
|
||||
LOG_INFO(Kernel_Vmm,
|
||||
"called addr = {}, len = {}, prot = {}, flags = {}, fd = {}, phys_addr = {}",
|
||||
fmt::ptr(addr), len, prot, flags, fd, phys_addr);
|
||||
LOG_INFO(
|
||||
Kernel_Vmm,
|
||||
"called addr = {}, len = {:#x}, prot = {:#x}, flags = {:#x}, fd = {}, phys_addr = {:#x}",
|
||||
fmt::ptr(addr), len, prot, flags, fd, phys_addr);
|
||||
|
||||
void* addr_out;
|
||||
auto* memory = Core::Memory::Instance();
|
||||
|
||||
@@ -573,6 +573,8 @@ u64 MemoryManager::UnmapBytesFromEntry(VAddr virtual_addr, VirtualMemoryArea vma
|
||||
|
||||
s32 MemoryManager::UnmapMemoryImpl(VAddr virtual_addr, u64 size) {
|
||||
u64 unmapped_bytes = 0;
|
||||
virtual_addr = Common::AlignDown(virtual_addr, 16_KB);
|
||||
size = Common::AlignUp(size, 16_KB);
|
||||
do {
|
||||
auto it = FindVMA(virtual_addr + unmapped_bytes);
|
||||
auto& vma_base = it->second;
|
||||
|
||||
Reference in New Issue
Block a user