diff options
Diffstat (limited to 'src/common/memory_util.cpp')
| -rw-r--r-- | src/common/memory_util.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/common/memory_util.cpp b/src/common/memory_util.cpp index 5d89209ed..09462ccee 100644 --- a/src/common/memory_util.cpp +++ b/src/common/memory_util.cpp | |||
| @@ -16,7 +16,7 @@ | |||
| 16 | #include <sys/mman.h> | 16 | #include <sys/mman.h> |
| 17 | #endif | 17 | #endif |
| 18 | 18 | ||
| 19 | #if !defined(_WIN32) && defined(ARCHITECTURE_X64) && !defined(MAP_32BIT) | 19 | #if !defined(_WIN32) && defined(ARCHITECTURE_x86_64) && !defined(MAP_32BIT) |
| 20 | #include <unistd.h> | 20 | #include <unistd.h> |
| 21 | #define PAGE_MASK (getpagesize() - 1) | 21 | #define PAGE_MASK (getpagesize() - 1) |
| 22 | #define round_page(x) ((((unsigned long)(x)) + PAGE_MASK) & ~(PAGE_MASK)) | 22 | #define round_page(x) ((((unsigned long)(x)) + PAGE_MASK) & ~(PAGE_MASK)) |
| @@ -30,7 +30,7 @@ void* AllocateExecutableMemory(size_t size, bool low) { | |||
| 30 | void* ptr = VirtualAlloc(nullptr, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE); | 30 | void* ptr = VirtualAlloc(nullptr, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE); |
| 31 | #else | 31 | #else |
| 32 | static char* map_hint = nullptr; | 32 | static char* map_hint = nullptr; |
| 33 | #if defined(ARCHITECTURE_X64) && !defined(MAP_32BIT) | 33 | #if defined(ARCHITECTURE_x86_64) && !defined(MAP_32BIT) |
| 34 | // This OS has no flag to enforce allocation below the 4 GB boundary, | 34 | // This OS has no flag to enforce allocation below the 4 GB boundary, |
| 35 | // but if we hint that we want a low address it is very likely we will | 35 | // but if we hint that we want a low address it is very likely we will |
| 36 | // get one. | 36 | // get one. |
| @@ -42,7 +42,7 @@ void* AllocateExecutableMemory(size_t size, bool low) { | |||
| 42 | #endif | 42 | #endif |
| 43 | void* ptr = mmap(map_hint, size, PROT_READ | PROT_WRITE | PROT_EXEC, | 43 | void* ptr = mmap(map_hint, size, PROT_READ | PROT_WRITE | PROT_EXEC, |
| 44 | MAP_ANON | MAP_PRIVATE | 44 | MAP_ANON | MAP_PRIVATE |
| 45 | #if defined(ARCHITECTURE_X64) && defined(MAP_32BIT) | 45 | #if defined(ARCHITECTURE_x86_64) && defined(MAP_32BIT) |
| 46 | | (low ? MAP_32BIT : 0) | 46 | | (low ? MAP_32BIT : 0) |
| 47 | #endif | 47 | #endif |
| 48 | , | 48 | , |
| @@ -57,7 +57,7 @@ void* AllocateExecutableMemory(size_t size, bool low) { | |||
| 57 | #endif | 57 | #endif |
| 58 | LOG_ERROR(Common_Memory, "Failed to allocate executable memory"); | 58 | LOG_ERROR(Common_Memory, "Failed to allocate executable memory"); |
| 59 | } | 59 | } |
| 60 | #if !defined(_WIN32) && defined(ARCHITECTURE_X64) && !defined(MAP_32BIT) | 60 | #if !defined(_WIN32) && defined(ARCHITECTURE_x86_64) && !defined(MAP_32BIT) |
| 61 | else { | 61 | else { |
| 62 | if (low) { | 62 | if (low) { |
| 63 | map_hint += size; | 63 | map_hint += size; |