Merge pull request #446 from Sonicadvance1/Memoryutil-fix

Make MemoryUtil.cpp use the correct x86_64 define.
This commit is contained in:
Pierre Bourdon 2014-06-02 07:36:20 +02:00
commit 1ef7dd68ef
1 changed files with 5 additions and 5 deletions

View File

@ -17,7 +17,7 @@
#include <sys/mman.h> #include <sys/mman.h>
#endif #endif
#if !defined(_WIN32) && defined(__x86_64__) && !defined(MAP_32BIT) #if !defined(_WIN32) && defined(_M_X86_64) && !defined(MAP_32BIT)
#include <unistd.h> #include <unistd.h>
#define PAGE_MASK (getpagesize() - 1) #define PAGE_MASK (getpagesize() - 1)
#define round_page(x) ((((unsigned long)(x)) + PAGE_MASK) & ~(PAGE_MASK)) #define round_page(x) ((((unsigned long)(x)) + PAGE_MASK) & ~(PAGE_MASK))
@ -32,7 +32,7 @@ void* AllocateExecutableMemory(size_t size, bool low)
void* ptr = VirtualAlloc(0, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE); void* ptr = VirtualAlloc(0, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
#else #else
static char *map_hint = nullptr; static char *map_hint = nullptr;
#if defined(__x86_64__) && !defined(MAP_32BIT) #if defined(_M_X86_64) && !defined(MAP_32BIT)
// This OS has no flag to enforce allocation below the 4 GB boundary, // This OS has no flag to enforce allocation below the 4 GB boundary,
// but if we hint that we want a low address it is very likely we will // but if we hint that we want a low address it is very likely we will
// get one. // get one.
@ -44,7 +44,7 @@ void* AllocateExecutableMemory(size_t size, bool low)
#endif #endif
void* ptr = mmap(map_hint, size, PROT_READ | PROT_WRITE | PROT_EXEC, void* ptr = mmap(map_hint, size, PROT_READ | PROT_WRITE | PROT_EXEC,
MAP_ANON | MAP_PRIVATE MAP_ANON | MAP_PRIVATE
#if defined(__x86_64__) && defined(MAP_32BIT) #if defined(_M_X86_64) && defined(MAP_32BIT)
| (low ? MAP_32BIT : 0) | (low ? MAP_32BIT : 0)
#endif #endif
, -1, 0); , -1, 0);
@ -63,7 +63,7 @@ void* AllocateExecutableMemory(size_t size, bool low)
#endif #endif
PanicAlert("Failed to allocate executable memory"); PanicAlert("Failed to allocate executable memory");
} }
#if !defined(_WIN32) && defined(__x86_64__) && !defined(MAP_32BIT) #if !defined(_WIN32) && defined(_M_X86_64) && !defined(MAP_32BIT)
else else
{ {
if (low) if (low)
@ -75,7 +75,7 @@ void* AllocateExecutableMemory(size_t size, bool low)
} }
#endif #endif
#if _ARCH_64 #if _M_X86_64
if ((u64)ptr >= 0x80000000 && low == true) if ((u64)ptr >= 0x80000000 && low == true)
PanicAlert("Executable memory ended up above 2GB!"); PanicAlert("Executable memory ended up above 2GB!");
#endif #endif