mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-28 00:35:34 +00:00
Fixes a check for what mmap returns.
On error mmap returns MAP_FAILED(-1) not null. FreeBSD was checking the return correctly, Linux was not. This was noticed by triad attempting to run Dolphin under valgrind and not getting a memory space under the 2GB limit(Because -1 wraps around on unsigned obviously)
This commit is contained in:
parent
f507827399
commit
33450c80c3
@ -54,13 +54,13 @@ void* AllocateExecutableMemory(size_t size, bool low)
|
|||||||
// printf("Mapped executable memory at %p (size %ld)\n", ptr,
|
// printf("Mapped executable memory at %p (size %ld)\n", ptr,
|
||||||
// (unsigned long)size);
|
// (unsigned long)size);
|
||||||
|
|
||||||
#if defined(__FreeBSD__)
|
#ifdef _WIN32
|
||||||
|
if (ptr == nullptr)
|
||||||
|
{
|
||||||
|
#else
|
||||||
if (ptr == MAP_FAILED)
|
if (ptr == MAP_FAILED)
|
||||||
{
|
{
|
||||||
ptr = nullptr;
|
ptr = nullptr;
|
||||||
#else
|
|
||||||
if (ptr == nullptr)
|
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
PanicAlert("Failed to allocate executable memory");
|
PanicAlert("Failed to allocate executable memory");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user