summaryrefslogtreecommitdiff
path: root/Source/Core/Common
diff options
context:
space:
mode:
authorNeoBrainX <NeoBrainX@googlemail.com>2011-09-06 14:45:05 +0200
committerNeoBrainX <NeoBrainX@googlemail.com>2011-09-06 14:45:05 +0200
commitee1dc962bfd01a6ce7908496897cf46073155412 (patch)
tree4532d41ede49f780c62ec3989059bb7bbbbc0258 /Source/Core/Common
parent06e640532aa093902e81f09aa18de1b084fcc5ce (diff)
Fix Windows build.
Diffstat (limited to 'Source/Core/Common')
-rw-r--r--Source/Core/Common/Src/MemoryUtil.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/Source/Core/Common/Src/MemoryUtil.cpp b/Source/Core/Common/Src/MemoryUtil.cpp
index 65c70e0c5e..2d64a434f1 100644
--- a/Source/Core/Common/Src/MemoryUtil.cpp
+++ b/Source/Core/Common/Src/MemoryUtil.cpp
@@ -27,7 +27,7 @@
#include <stdio.h>
#endif
-#if !defined(MAP_32BIT)
+#if !defined(_WIN32) && defined(__x86_64__) && !defined(MAP_32BIT)
#include <unistd.h>
#define PAGE_MASK (getpagesize() - 1)
#define round_page(x) ((((unsigned long)(x)) + PAGE_MASK) & ~(PAGE_MASK))
@@ -38,15 +38,14 @@
void* AllocateExecutableMemory(size_t size, bool low)
{
+#if defined(_WIN32)
+ void* ptr = VirtualAlloc(0, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
+#else
static char *map_hint = 0;
#if defined(__x86_64__) && !defined(MAP_32BIT)
if (low && (!map_hint))
map_hint = (char*)round_page(512*1024*1024); /* 0.5 GB rounded up to the next page */
#endif
-
-#if defined(_WIN32)
- void* ptr = VirtualAlloc(0, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
-#else
void* ptr = mmap(map_hint, size, PROT_READ | PROT_WRITE | PROT_EXEC,
MAP_ANON | MAP_PRIVATE
#if defined(__x86_64__)
@@ -72,7 +71,7 @@ void* AllocateExecutableMemory(size_t size, bool low)
#endif
PanicAlert("Failed to allocate executable memory");
}
-#if defined(__x86_64__) && !defined(MAP_32BIT)
+#if !defined(_WIN32) && defined(__x86_64__) && !defined(MAP_32BIT)
else
{
if (low)