diff --git a/Source/Core/Common/Src/Common.h b/Source/Core/Common/Src/Common.h index 139248dfa6..bd0534987c 100644 --- a/Source/Core/Common/Src/Common.h +++ b/Source/Core/Common/Src/Common.h @@ -114,10 +114,6 @@ extern const char *netplay_dolphin_ver; #include "Config.h" // SCons autoconfiguration defines #endif -#ifndef __linux__ -#define MAP_32BIT 0 // MAP_32BIT is a Linux-specific mmap(2) flag -#endif - // Windows compatibility #ifndef _WIN32 #include diff --git a/Source/Core/Common/Src/MemoryUtil.cpp b/Source/Core/Common/Src/MemoryUtil.cpp index 60689c1aa9..68b9f6f0fe 100644 --- a/Source/Core/Common/Src/MemoryUtil.cpp +++ b/Source/Core/Common/Src/MemoryUtil.cpp @@ -22,21 +22,11 @@ #ifdef _WIN32 #include #include -#elif __GNUC__ -#include +#else #include #include #endif -#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON) -#define MAP_ANONYMOUS MAP_ANON -#endif - -// MacOSX does not support MAP_VARIABLE -#ifndef MAP_VARIABLE -#define MAP_VARIABLE 0 -#endif - // This is purposely not a full wrapper for virtualalloc/mmap, but it // provides exactly the primitive operations that Dolphin needs. @@ -55,7 +45,7 @@ void* AllocateExecutableMemory(size_t size, bool low) #else void* retval = mmap(0, size, PROT_READ | PROT_WRITE | PROT_EXEC, - MAP_ANONYMOUS | MAP_PRIVATE + MAP_ANON | MAP_PRIVATE #ifdef __x86_64__ | (low ? MAP_32BIT : 0) #endif @@ -86,7 +76,7 @@ void* AllocateMemoryPages(size_t size) #else void* retval = mmap(0, size, PROT_READ | PROT_WRITE, - MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); // | MAP_FIXED + MAP_ANON | MAP_PRIVATE, -1, 0); // | MAP_FIXED // printf("Mapped memory at %p (size %i)\n", retval, size); if (!retval) diff --git a/Source/Core/Common/Src/MemoryUtil.h b/Source/Core/Common/Src/MemoryUtil.h index 9db4e0a991..5262898b35 100644 --- a/Source/Core/Common/Src/MemoryUtil.h +++ b/Source/Core/Common/Src/MemoryUtil.h @@ -18,8 +18,16 @@ #ifndef _MEMORYUTIL_H #define _MEMORYUTIL_H +#ifndef _WIN32 +#include +#endif #include +// Linux-specific mmap(2) flag +#ifndef MAP_32BIT +#define MAP_32BIT 0 +#endif + void* AllocateExecutableMemory(size_t size, bool low = true); void* AllocateMemoryPages(size_t size); void FreeMemoryPages(void* ptr, size_t size);