Skip to content

Commit

Permalink
Merge pull request #446 from Sonicadvance1/Memoryutil-fix
Browse files Browse the repository at this point in the history
Make MemoryUtil.cpp use the correct x86_64 define.
  • Loading branch information
delroth committed Jun 2, 2014
2 parents 31eedb2 + 87e6714 commit 1ef7dd6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Source/Core/Common/MemoryUtil.cpp
Expand Up @@ -17,7 +17,7 @@
#include <sys/mman.h>
#endif

#if !defined(_WIN32) && defined(__x86_64__) && !defined(MAP_32BIT)
#if !defined(_WIN32) && defined(_M_X86_64) && !defined(MAP_32BIT)
#include <unistd.h>
#define PAGE_MASK (getpagesize() - 1)
#define round_page(x) ((((unsigned long)(x)) + PAGE_MASK) & ~(PAGE_MASK))
Expand All @@ -32,7 +32,7 @@ void* AllocateExecutableMemory(size_t size, bool low)
void* ptr = VirtualAlloc(0, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
#else
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,
// but if we hint that we want a low address it is very likely we will
// get one.
Expand All @@ -44,7 +44,7 @@ void* AllocateExecutableMemory(size_t size, bool low)
#endif
void* ptr = mmap(map_hint, size, PROT_READ | PROT_WRITE | PROT_EXEC,
MAP_ANON | MAP_PRIVATE
#if defined(__x86_64__) && defined(MAP_32BIT)
#if defined(_M_X86_64) && defined(MAP_32BIT)
| (low ? MAP_32BIT : 0)
#endif
, -1, 0);
Expand All @@ -63,7 +63,7 @@ void* AllocateExecutableMemory(size_t size, bool low)
#endif
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
{
if (low)
Expand All @@ -75,7 +75,7 @@ void* AllocateExecutableMemory(size_t size, bool low)
}
#endif

#if _ARCH_64
#if _M_X86_64
if ((u64)ptr >= 0x80000000 && low == true)
PanicAlert("Executable memory ended up above 2GB!");
#endif
Expand Down

0 comments on commit 1ef7dd6

Please sign in to comment.