Slightly cleanup of mmap(2) flags:

Move MAP_32BIT to MemoryUtil.h.
MAP_VARIABLE is simply the absence of MAP_FIXED.
Replace MAP_ANONYMOUS with the more traditional MAP_ANON - Linux is compatible.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5900 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Soren Jorvang 2010-07-18 05:17:09 +00:00
parent caeabf8bea
commit 2c419382c9
1 changed files with 3 additions and 6 deletions

View File

@ -16,12 +16,12 @@
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "Common.h" #include "Common.h"
#include "MemoryUtil.h"
#include "MemArena.h" #include "MemArena.h"
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#else #else
#include <sys/mman.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
@ -29,10 +29,6 @@
#include <cstring> #include <cstring>
#endif #endif
#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
#define MAP_ANONYMOUS MAP_ANON
#endif
#ifndef _WIN32 #ifndef _WIN32
static const char* ram_temp_file = "/tmp/gc_mem.tmp"; static const char* ram_temp_file = "/tmp/gc_mem.tmp";
#endif #endif
@ -123,7 +119,8 @@ u8* MemArena::Find4GBBase()
} }
return base; return base;
#else #else
void* base = mmap(0, 0x31000000, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_SHARED, 0, 0); void* base = mmap(0, 0x31000000, PROT_READ | PROT_WRITE,
MAP_ANON | MAP_SHARED, 0, 0);
if (base == MAP_FAILED) { if (base == MAP_FAILED) {
PanicAlert("Failed to map 1 GB of memory space: %s", strerror(errno)); PanicAlert("Failed to map 1 GB of memory space: %s", strerror(errno));
return 0; return 0;