From 4d7ce7268256a16fff27d0c391762a957d365637 Mon Sep 17 00:00:00 2001 From: Rickard Westerlund Date: Fri, 22 Aug 2025 10:20:38 +0200 Subject: [PATCH] Compile fix for libnx 4.9.0. Update mmap with the new virtmem API. --- switch/mman.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/switch/mman.h b/switch/mman.h index 6a5166e0e..acac4e764 100644 --- a/switch/mman.h +++ b/switch/mman.h @@ -29,7 +29,9 @@ static inline void *mmap(void *addr, size_t len, int prot, int flags, int fd, of (void)offset; size_t size = (len + 0xFFF) &~ 0xFFF; - ptr_rw = virtmemReserve(size); + virtmemLock(); + ptr_rw = virtmemFindCodeMemory(size, 0); + virtmemUnlock(); if (R_SUCCEEDED(svcMapProcessMemory(ptr_rw, envGetOwnProcessHandle(), (u64)addr, size))) { return ptr_rw;