gsdx x64 linux: only mmap in lower 2GB code segment

Allow to use rip addressing
This commit is contained in:
Gregory Hainaut 2016-11-19 23:03:31 +01:00
parent 2252ba1bb7
commit 0fd5346860
1 changed files with 8 additions and 5 deletions

View File

@ -94,14 +94,17 @@ void* vmalloc(size_t size, bool code)
size = (size + mask) & ~mask; size = (size + mask) & ~mask;
int flags = PROT_READ | PROT_WRITE; int prot = PROT_READ | PROT_WRITE;
int flags = MAP_PRIVATE | MAP_ANONYMOUS;
if(code) if(code) {
{ prot |= PROT_EXEC;
flags |= PROT_EXEC; #ifdef _M_AMD64
flags |= MAP_32BIT;
#endif
} }
return mmap(NULL, size, flags, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); return mmap(NULL, size, prot, flags, -1, 0);
} }
void vmfree(void* ptr, size_t size) void vmfree(void* ptr, size_t size)