From 7624e9482c8749c45fbae8daf9c85dca438dd2c4 Mon Sep 17 00:00:00 2001 From: squidbus <175574877+squidbus@users.noreply.github.com> Date: Wed, 12 Feb 2025 09:04:58 -0800 Subject: [PATCH] memory: Log for sceKernelMapNamedDirectMemory in more cases. (#2404) --- src/core/libraries/kernel/memory.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/core/libraries/kernel/memory.cpp b/src/core/libraries/kernel/memory.cpp index 551fd8e3e..82c5115f1 100644 --- a/src/core/libraries/kernel/memory.cpp +++ b/src/core/libraries/kernel/memory.cpp @@ -163,6 +163,11 @@ s32 PS4_SYSV_ABI sceKernelReserveVirtualRange(void** addr, u64 len, int flags, u int PS4_SYSV_ABI sceKernelMapNamedDirectMemory(void** addr, u64 len, int prot, int flags, s64 directMemoryStart, u64 alignment, const char* name) { + LOG_INFO(Kernel_Vmm, + "in_addr = {}, len = {:#x}, prot = {:#x}, flags = {:#x}, " + "directMemoryStart = {:#x}, alignment = {:#x}, name = '{}'", + fmt::ptr(*addr), len, prot, flags, directMemoryStart, alignment, name); + if (len == 0 || !Common::Is16KBAligned(len)) { LOG_ERROR(Kernel_Vmm, "Map size is either zero or not 16KB aligned!"); return ORBIS_KERNEL_ERROR_EINVAL; @@ -181,17 +186,14 @@ int PS4_SYSV_ABI sceKernelMapNamedDirectMemory(void** addr, u64 len, int prot, i const VAddr in_addr = reinterpret_cast(*addr); const auto mem_prot = static_cast(prot); const auto map_flags = static_cast(flags); - SCOPE_EXIT { - LOG_INFO(Kernel_Vmm, - "in_addr = {:#x}, out_addr = {}, len = {:#x}, prot = {:#x}, flags = {:#x}, " - "directMemoryStart = {:#x}, " - "alignment = {:#x}", - in_addr, fmt::ptr(*addr), len, prot, flags, directMemoryStart, alignment); - }; auto* memory = Core::Memory::Instance(); - return memory->MapMemory(addr, in_addr, len, mem_prot, map_flags, Core::VMAType::Direct, "", - false, directMemoryStart, alignment); + const auto ret = + memory->MapMemory(addr, in_addr, len, mem_prot, map_flags, Core::VMAType::Direct, "", false, + directMemoryStart, alignment); + + LOG_INFO(Kernel_Vmm, "out_addr = {}", fmt::ptr(*addr)); + return ret; } int PS4_SYSV_ABI sceKernelMapDirectMemory(void** addr, u64 len, int prot, int flags,