summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/common/common_funcs.h7
-rw-r--r--src/common/hash.cpp2
-rw-r--r--src/common/mem_arena.cpp9
-rw-r--r--src/common/memory_util.cpp2
-rw-r--r--src/common/platform.h8
5 files changed, 11 insertions, 17 deletions
diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h
index 4f9e514c9..91b74c6bc 100644
--- a/src/common/common_funcs.h
+++ b/src/common/common_funcs.h
@@ -34,13 +34,6 @@
34 #define MEMORY_ALIGNED64(x) __declspec(align(64)) x 34 #define MEMORY_ALIGNED64(x) __declspec(align(64)) x
35 #define MEMORY_ALIGNED128(x) __declspec(align(128)) x 35 #define MEMORY_ALIGNED128(x) __declspec(align(128)) x
36#else 36#else
37 // Windows compatibility
38 #ifdef _LP64
39 #define _M_X64 1
40 #else
41 #define _M_IX86 1
42 #endif
43
44 #define __forceinline inline __attribute__((always_inline)) 37 #define __forceinline inline __attribute__((always_inline))
45 #define MEMORY_ALIGNED16(x) __attribute__((aligned(16))) x 38 #define MEMORY_ALIGNED16(x) __attribute__((aligned(16))) x
46 #define MEMORY_ALIGNED32(x) __attribute__((aligned(32))) x 39 #define MEMORY_ALIGNED32(x) __attribute__((aligned(32))) x
diff --git a/src/common/hash.cpp b/src/common/hash.cpp
index b0b3613f6..e2364d700 100644
--- a/src/common/hash.cpp
+++ b/src/common/hash.cpp
@@ -103,7 +103,7 @@ u32 HashEctor(const u8* ptr, int length)
103} 103}
104 104
105 105
106#ifdef _M_X64 106#if EMU_ARCH_BITS == 64
107 107
108//----------------------------------------------------------------------------- 108//-----------------------------------------------------------------------------
109// Block read - if your platform needs to do endian-swapping or can only 109// Block read - if your platform needs to do endian-swapping or can only
diff --git a/src/common/mem_arena.cpp b/src/common/mem_arena.cpp
index f233d4a3a..689fdb92b 100644
--- a/src/common/mem_arena.cpp
+++ b/src/common/mem_arena.cpp
@@ -20,6 +20,7 @@
20#include "common/logging/log.h" 20#include "common/logging/log.h"
21#include "common/mem_arena.h" 21#include "common/mem_arena.h"
22#include "common/memory_util.h" 22#include "common/memory_util.h"
23#include "common/platform.h"
23#include "common/string_util.h" 24#include "common/string_util.h"
24 25
25#ifndef _WIN32 26#ifndef _WIN32
@@ -198,7 +199,7 @@ void MemArena::ReleaseView(void* view, size_t size)
198 199
199u8* MemArena::Find4GBBase() 200u8* MemArena::Find4GBBase()
200{ 201{
201#ifdef _M_X64 202#if EMU_ARCH_BITS == 64
202#ifdef _WIN32 203#ifdef _WIN32
203 // 64 bit 204 // 64 bit
204 u8* base = (u8*)VirtualAlloc(0, 0xE1000000, MEM_RESERVE, PAGE_READWRITE); 205 u8* base = (u8*)VirtualAlloc(0, 0xE1000000, MEM_RESERVE, PAGE_READWRITE);
@@ -269,7 +270,7 @@ static bool Memory_TryBase(u8 *base, const MemoryView *views, int num_views, u32
269 if (!*view.out_ptr_low) 270 if (!*view.out_ptr_low)
270 goto bail; 271 goto bail;
271 } 272 }
272#ifdef _M_X64 273#if EMU_ARCH_BITS == 64
273 *view.out_ptr = (u8*)arena->CreateView( 274 *view.out_ptr = (u8*)arena->CreateView(
274 position, view.size, base + view.virtual_address); 275 position, view.size, base + view.virtual_address);
275#else 276#else
@@ -305,7 +306,7 @@ bail:
305 } 306 }
306 if (*views[j].out_ptr) 307 if (*views[j].out_ptr)
307 { 308 {
308#ifdef _M_X64 309#if EMU_ARCH_BITS == 64
309 arena->ReleaseView(*views[j].out_ptr, views[j].size); 310 arena->ReleaseView(*views[j].out_ptr, views[j].size);
310#else 311#else
311 if (!(views[j].flags & MV_MIRROR_PREVIOUS)) 312 if (!(views[j].flags & MV_MIRROR_PREVIOUS))
@@ -336,7 +337,7 @@ u8 *MemoryMap_Setup(const MemoryView *views, int num_views, u32 flags, MemArena
336 arena->GrabLowMemSpace(total_mem); 337 arena->GrabLowMemSpace(total_mem);
337 338
338 // Now, create views in high memory where there's plenty of space. 339 // Now, create views in high memory where there's plenty of space.
339#ifdef _M_X64 340#if EMU_ARCH_BITS == 64
340 u8 *base = MemArena::Find4GBBase(); 341 u8 *base = MemArena::Find4GBBase();
341 // This really shouldn't fail - in 64-bit, there will always be enough 342 // This really shouldn't fail - in 64-bit, there will always be enough
342 // address space. 343 // address space.
diff --git a/src/common/memory_util.cpp b/src/common/memory_util.cpp
index 2087a1184..20b791a10 100644
--- a/src/common/memory_util.cpp
+++ b/src/common/memory_util.cpp
@@ -71,7 +71,7 @@ void* AllocateExecutableMemory(size_t size, bool low)
71 } 71 }
72#endif 72#endif
73 73
74#if defined(_M_X64) 74#if EMU_ARCH_BITS == 64
75 if ((u64)ptr >= 0x80000000 && low == true) 75 if ((u64)ptr >= 0x80000000 && low == true)
76 LOG_ERROR(Common_Memory, "Executable memory ended up above 2GB!"); 76 LOG_ERROR(Common_Memory, "Executable memory ended up above 2GB!");
77#endif 77#endif
diff --git a/src/common/platform.h b/src/common/platform.h
index 1516dc88a..df780ac6f 100644
--- a/src/common/platform.h
+++ b/src/common/platform.h
@@ -57,10 +57,10 @@
57 57
58#endif 58#endif
59 59
60#if defined(__x86_64__) || defined(_M_X64) || defined(__alpha__) || defined(__ia64__) 60#if defined(__x86_64__) || defined(_M_X64) || defined(__aarch64__)
61#define EMU_ARCHITECTURE_X64 61 #define EMU_ARCH_BITS 64
62#else 62#elif defined(__i386) || defined(_M_IX86) || defined(__arm__) || defined(_M_ARM)
63#define EMU_ARCHITECTURE_X86 63 #define EMU_ARCH_BITS 32
64#endif 64#endif
65 65
66//////////////////////////////////////////////////////////////////////////////////////////////////// 66////////////////////////////////////////////////////////////////////////////////////////////////////