From 8ee5742ebfad3ce4d184d3dc78a7e1197b470f3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Wed, 19 Jun 2024 11:25:32 +0200 Subject: [PATCH] Add support for 16kb page size on Android (untested!) --- CMakeLists.txt | 3 +++ Common/MemoryUtil.cpp | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b9299dd54a0..68101d43d302 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2874,6 +2874,9 @@ if(TargetBin) else() add_executable(${TargetBin} ${NativeAppSource}) endif() + if(ANDROID AND ARM64) + target_link_options(${TargetBin} PRIVATE "-Wl,-z,max-page-size=16384") + endif() target_link_libraries(${TargetBin} ${LinkCommon} Common) endif() diff --git a/Common/MemoryUtil.cpp b/Common/MemoryUtil.cpp index 297290844ab1..be2a14ddbe08 100644 --- a/Common/MemoryUtil.cpp +++ b/Common/MemoryUtil.cpp @@ -352,7 +352,12 @@ int GetMemoryProtectPageSize() { if (sys_info.dwPageSize == 0) GetSystemInfo(&sys_info); return sys_info.dwPageSize; +#else + static int pageSize = 0; + if (!pageSize) { + pageSize = sysconf(_SC_PAGE_SIZE); + } + return pageSize; #endif - return MEM_PAGE_SIZE; } #endif // !PPSSPP_PLATFORM(SWITCH)