From 3ab2094b767b1c4ceb74647db32e0807c7f166d0 Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Sun, 28 Aug 2016 18:35:57 +0200 Subject: [PATCH] Buildfix attempt --- Common/MemoryUtil.cpp | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/Common/MemoryUtil.cpp b/Common/MemoryUtil.cpp index 3ddb5a1231..b53b45d811 100644 --- a/Common/MemoryUtil.cpp +++ b/Common/MemoryUtil.cpp @@ -31,21 +31,21 @@ #include #endif -#if defined(_M_X64) #ifndef _WIN32 #include #endif static int hint_location; #ifdef __APPLE__ -#define MEM_PAGE_MASK (4096-1) +#define MEM_PAGE_SIZE (PAGE_SIZE) #elif defined(_WIN32) static SYSTEM_INFO sys_info; -#define MEM_PAGE_MASK (uintptr_t)(sys_info.dwPageSize - 1) +#define MEM_PAGE_SIZE (uintptr_t)(sys_info.dwPageSize) #else -#define MEM_PAGE_MASK (getpagesize() - 1) +#define MEM_PAGE_SIZE (getpagesize()) #endif + +#define MEM_PAGE_MASK ((MEM_PAGE_SIZE)-1) #define round_page(x) ((((uintptr_t)(x)) + MEM_PAGE_MASK) & ~(MEM_PAGE_MASK)) -#endif #ifdef __SYMBIAN32__ #include @@ -326,14 +326,8 @@ void ProtectMemoryPages(const void* ptr, size_t size, uint32_t memProtFlags) { int GetMemoryProtectPageSize() { #ifdef _WIN32 - // This is 4096 on all Windows platforms we care about. 8k on Itanium but meh. - return 4096; - // For reference, here's how to check: - // if (sys_info.dwPageSize == 0) - // GetSystemInfo(&sys_info); - // return sys_info.dwPageSize; - -#else - return PAGE_SIZE; + if (sys_info.dwPageSize == 0) + GetSystemInfo(&sys_info); #endif + return MEM_PAGE_SIZE; } \ No newline at end of file