diff options
Diffstat (limited to 'src/common/memory_util.cpp')
| -rw-r--r-- | src/common/memory_util.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/common/memory_util.cpp b/src/common/memory_util.cpp index 8f982da89..7e69d31cb 100644 --- a/src/common/memory_util.cpp +++ b/src/common/memory_util.cpp | |||
| @@ -56,7 +56,7 @@ void* AllocateExecutableMemory(size_t size, bool low) | |||
| 56 | { | 56 | { |
| 57 | ptr = nullptr; | 57 | ptr = nullptr; |
| 58 | #endif | 58 | #endif |
| 59 | PanicAlert("Failed to allocate executable memory"); | 59 | LOG_ERROR(Common_Memory, "Failed to allocate executable memory"); |
| 60 | } | 60 | } |
| 61 | #if !defined(_WIN32) && defined(__x86_64__) && !defined(MAP_32BIT) | 61 | #if !defined(_WIN32) && defined(__x86_64__) && !defined(MAP_32BIT) |
| 62 | else | 62 | else |
| @@ -72,7 +72,7 @@ void* AllocateExecutableMemory(size_t size, bool low) | |||
| 72 | 72 | ||
| 73 | #if defined(_M_X64) | 73 | #if defined(_M_X64) |
| 74 | if ((u64)ptr >= 0x80000000 && low == true) | 74 | if ((u64)ptr >= 0x80000000 && low == true) |
| 75 | PanicAlert("Executable memory ended up above 2GB!"); | 75 | LOG_ERROR(Common_Memory, "Executable memory ended up above 2GB!"); |
| 76 | #endif | 76 | #endif |
| 77 | 77 | ||
| 78 | return ptr; | 78 | return ptr; |
| @@ -94,7 +94,7 @@ void* AllocateMemoryPages(size_t size) | |||
| 94 | // (unsigned long)size); | 94 | // (unsigned long)size); |
| 95 | 95 | ||
| 96 | if (ptr == nullptr) | 96 | if (ptr == nullptr) |
| 97 | PanicAlert("Failed to allocate raw memory"); | 97 | LOG_ERROR(Common_Memory, "Failed to allocate raw memory"); |
| 98 | 98 | ||
| 99 | return ptr; | 99 | return ptr; |
| 100 | } | 100 | } |
| @@ -117,7 +117,7 @@ void* AllocateAlignedMemory(size_t size,size_t alignment) | |||
| 117 | // (unsigned long)size); | 117 | // (unsigned long)size); |
| 118 | 118 | ||
| 119 | if (ptr == nullptr) | 119 | if (ptr == nullptr) |
| 120 | PanicAlert("Failed to allocate aligned memory"); | 120 | LOG_ERROR(Common_Memory, "Failed to allocate aligned memory"); |
| 121 | 121 | ||
| 122 | return ptr; | 122 | return ptr; |
| 123 | } | 123 | } |
| @@ -129,7 +129,7 @@ void FreeMemoryPages(void* ptr, size_t size) | |||
| 129 | #ifdef _WIN32 | 129 | #ifdef _WIN32 |
| 130 | 130 | ||
| 131 | if (!VirtualFree(ptr, 0, MEM_RELEASE)) | 131 | if (!VirtualFree(ptr, 0, MEM_RELEASE)) |
| 132 | PanicAlert("FreeMemoryPages failed!\n%s", GetLastErrorMsg()); | 132 | LOG_ERROR(Common_Memory, "FreeMemoryPages failed!\n%s", GetLastErrorMsg()); |
| 133 | ptr = nullptr; // Is this our responsibility? | 133 | ptr = nullptr; // Is this our responsibility? |
| 134 | 134 | ||
| 135 | #else | 135 | #else |
| @@ -155,7 +155,7 @@ void WriteProtectMemory(void* ptr, size_t size, bool allowExecute) | |||
| 155 | #ifdef _WIN32 | 155 | #ifdef _WIN32 |
| 156 | DWORD oldValue; | 156 | DWORD oldValue; |
| 157 | if (!VirtualProtect(ptr, size, allowExecute ? PAGE_EXECUTE_READ : PAGE_READONLY, &oldValue)) | 157 | if (!VirtualProtect(ptr, size, allowExecute ? PAGE_EXECUTE_READ : PAGE_READONLY, &oldValue)) |
| 158 | PanicAlert("WriteProtectMemory failed!\n%s", GetLastErrorMsg()); | 158 | LOG_ERROR(Common_Memory, "WriteProtectMemory failed!\n%s", GetLastErrorMsg()); |
| 159 | #else | 159 | #else |
| 160 | mprotect(ptr, size, allowExecute ? (PROT_READ | PROT_EXEC) : PROT_READ); | 160 | mprotect(ptr, size, allowExecute ? (PROT_READ | PROT_EXEC) : PROT_READ); |
| 161 | #endif | 161 | #endif |
| @@ -166,7 +166,7 @@ void UnWriteProtectMemory(void* ptr, size_t size, bool allowExecute) | |||
| 166 | #ifdef _WIN32 | 166 | #ifdef _WIN32 |
| 167 | DWORD oldValue; | 167 | DWORD oldValue; |
| 168 | if (!VirtualProtect(ptr, size, allowExecute ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE, &oldValue)) | 168 | if (!VirtualProtect(ptr, size, allowExecute ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE, &oldValue)) |
| 169 | PanicAlert("UnWriteProtectMemory failed!\n%s", GetLastErrorMsg()); | 169 | LOG_ERROR(Common_Memory, "UnWriteProtectMemory failed!\n%s", GetLastErrorMsg()); |
| 170 | #else | 170 | #else |
| 171 | mprotect(ptr, size, allowExecute ? (PROT_READ | PROT_WRITE | PROT_EXEC) : PROT_WRITE | PROT_READ); | 171 | mprotect(ptr, size, allowExecute ? (PROT_READ | PROT_WRITE | PROT_EXEC) : PROT_WRITE | PROT_READ); |
| 172 | #endif | 172 | #endif |