summaryrefslogtreecommitdiff
path: root/src/common/memory_util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/memory_util.cpp')
-rw-r--r--src/common/memory_util.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/common/memory_util.cpp b/src/common/memory_util.cpp
index 4d1ec8fb9..5d89209ed 100644
--- a/src/common/memory_util.cpp
+++ b/src/common/memory_util.cpp
@@ -55,7 +55,7 @@ void* AllocateExecutableMemory(size_t size, bool low) {
55 if (ptr == MAP_FAILED) { 55 if (ptr == MAP_FAILED) {
56 ptr = nullptr; 56 ptr = nullptr;
57#endif 57#endif
58 NGLOG_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_X64) && !defined(MAP_32BIT)
61 else { 61 else {
@@ -68,7 +68,7 @@ void* AllocateExecutableMemory(size_t size, bool low) {
68 68
69#if EMU_ARCH_BITS == 64 69#if EMU_ARCH_BITS == 64
70 if ((u64)ptr >= 0x80000000 && low == true) 70 if ((u64)ptr >= 0x80000000 && low == true)
71 NGLOG_ERROR(Common_Memory, "Executable memory ended up above 2GB!"); 71 LOG_ERROR(Common_Memory, "Executable memory ended up above 2GB!");
72#endif 72#endif
73 73
74 return ptr; 74 return ptr;
@@ -85,7 +85,7 @@ void* AllocateMemoryPages(size_t size) {
85#endif 85#endif
86 86
87 if (ptr == nullptr) 87 if (ptr == nullptr)
88 NGLOG_ERROR(Common_Memory, "Failed to allocate raw memory"); 88 LOG_ERROR(Common_Memory, "Failed to allocate raw memory");
89 89
90 return ptr; 90 return ptr;
91} 91}
@@ -99,12 +99,12 @@ void* AllocateAlignedMemory(size_t size, size_t alignment) {
99 ptr = memalign(alignment, size); 99 ptr = memalign(alignment, size);
100#else 100#else
101 if (posix_memalign(&ptr, alignment, size) != 0) 101 if (posix_memalign(&ptr, alignment, size) != 0)
102 NGLOG_ERROR(Common_Memory, "Failed to allocate aligned memory"); 102 LOG_ERROR(Common_Memory, "Failed to allocate aligned memory");
103#endif 103#endif
104#endif 104#endif
105 105
106 if (ptr == nullptr) 106 if (ptr == nullptr)
107 NGLOG_ERROR(Common_Memory, "Failed to allocate aligned memory"); 107 LOG_ERROR(Common_Memory, "Failed to allocate aligned memory");
108 108
109 return ptr; 109 return ptr;
110} 110}
@@ -113,7 +113,7 @@ void FreeMemoryPages(void* ptr, size_t size) {
113 if (ptr) { 113 if (ptr) {
114#ifdef _WIN32 114#ifdef _WIN32
115 if (!VirtualFree(ptr, 0, MEM_RELEASE)) 115 if (!VirtualFree(ptr, 0, MEM_RELEASE))
116 NGLOG_ERROR(Common_Memory, "FreeMemoryPages failed!\n{}", GetLastErrorMsg()); 116 LOG_ERROR(Common_Memory, "FreeMemoryPages failed!\n{}", GetLastErrorMsg());
117#else 117#else
118 munmap(ptr, size); 118 munmap(ptr, size);
119#endif 119#endif
@@ -134,7 +134,7 @@ void WriteProtectMemory(void* ptr, size_t size, bool allowExecute) {
134#ifdef _WIN32 134#ifdef _WIN32
135 DWORD oldValue; 135 DWORD oldValue;
136 if (!VirtualProtect(ptr, size, allowExecute ? PAGE_EXECUTE_READ : PAGE_READONLY, &oldValue)) 136 if (!VirtualProtect(ptr, size, allowExecute ? PAGE_EXECUTE_READ : PAGE_READONLY, &oldValue))
137 NGLOG_ERROR(Common_Memory, "WriteProtectMemory failed!\n{}", GetLastErrorMsg()); 137 LOG_ERROR(Common_Memory, "WriteProtectMemory failed!\n{}", GetLastErrorMsg());
138#else 138#else
139 mprotect(ptr, size, allowExecute ? (PROT_READ | PROT_EXEC) : PROT_READ); 139 mprotect(ptr, size, allowExecute ? (PROT_READ | PROT_EXEC) : PROT_READ);
140#endif 140#endif
@@ -145,7 +145,7 @@ void UnWriteProtectMemory(void* ptr, size_t size, bool allowExecute) {
145 DWORD oldValue; 145 DWORD oldValue;
146 if (!VirtualProtect(ptr, size, allowExecute ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE, 146 if (!VirtualProtect(ptr, size, allowExecute ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE,
147 &oldValue)) 147 &oldValue))
148 NGLOG_ERROR(Common_Memory, "UnWriteProtectMemory failed!\n{}", GetLastErrorMsg()); 148 LOG_ERROR(Common_Memory, "UnWriteProtectMemory failed!\n{}", GetLastErrorMsg());
149#else 149#else
150 mprotect(ptr, size, 150 mprotect(ptr, size,
151 allowExecute ? (PROT_READ | PROT_WRITE | PROT_EXEC) : PROT_WRITE | PROT_READ); 151 allowExecute ? (PROT_READ | PROT_WRITE | PROT_EXEC) : PROT_WRITE | PROT_READ);