32-bit Linux fix: check result of mmap(): if it fails, it returns MAP_FAILED, which is not equal to 0. Also print error message associated with errno.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@554 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
f70819197a
commit
1f66120671
|
@ -25,6 +25,8 @@
|
|||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <cerrno>
|
||||
#include <cstring>
|
||||
#endif
|
||||
|
||||
#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
|
||||
|
@ -131,6 +133,10 @@ u8* MemArena::Find4GBBase()
|
|||
return base;
|
||||
#else
|
||||
void* base = mmap(0, 0x31000000, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_SHARED, 0, 0);
|
||||
if (base == MAP_FAILED) {
|
||||
PanicAlert("Failed to map 1 GB of memory space: %s", strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
munmap(base, 0x31000000);
|
||||
return static_cast<u8*>(base);
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue