Make MemoryUtil.cpp use the correct x86_64 define.

MemoryUtil.cpp was incorrectly using the old __x86_64__ define when it should be using _M_X86_64.
It was also using _ARCH_64 when it shouldn't have which was causing an errant PanicAlert to come up in my development.
This commit is contained in:
Ryan Houdek 2014-06-01 23:45:44 -05:00
parent 31eedb2f79
commit 87e671404a

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