diff options
| author | Yang Liu <liuyang22@iscas.ac.cn> | 2023-10-26 15:48:28 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-26 09:48:28 +0200 |
| commit | d9a4fed2f81a5880d732ee99e846ed284f190366 (patch) | |
| tree | adcb593d33cb49293a8e7790892947348fcfa23c /src | |
| parent | 2a4fe80399c86cb1af05181109766e72b7292e65 (diff) | |
| download | box64-d9a4fed2f81a5880d732ee99e846ed284f190366.tar.gz box64-d9a4fed2f81a5880d732ee99e846ed284f190366.zip | |
[WRAPPER] Fixed my_mmap64 on MAP_FIXED handling, helps wine 8.18 (#1039)
Diffstat (limited to 'src')
| -rw-r--r-- | src/wrapped/wrappedlibc.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/wrapped/wrappedlibc.c b/src/wrapped/wrappedlibc.c index e35145c5..b63e55b7 100644 --- a/src/wrapped/wrappedlibc.c +++ b/src/wrapped/wrappedlibc.c @@ -2566,7 +2566,8 @@ EXPORT void* my_mmap64(x64emu_t* emu, void *addr, unsigned long length, int prot munmap(ret, length); loadProtectionFromMap(); // reload map, because something went wrong previously addr = find31bitBlockNearHint(old_addr, length); // is this the best way? - ret = mmap64(addr, length, prot, flags, fd, offset); + uint32_t new_flags = addr ? flags|MAP_FIXED : flags; + ret = mmap64(addr, length, prot, new_flags, fd, offset); printf_log(LOG_DEBUG, " tried again with %p, got %p\n", addr, ret); } else if((ret!=(void*)-1) && !(flags&MAP_FIXED) && (box64_wine) && (old_addr) && (addr!=ret) && (((uintptr_t)ret>0x7fffffffffffLL) || ((uintptr_t)ret&~0xffff))) { @@ -2574,7 +2575,8 @@ EXPORT void* my_mmap64(x64emu_t* emu, void *addr, unsigned long length, int prot munmap(ret, length); loadProtectionFromMap(); // reload map, because something went wrong previously addr = find47bitBlockNearHint(old_addr, length); // is this the best way? - ret = mmap64(addr, length, prot, flags, fd, offset); + uint32_t new_flags = addr ? flags|MAP_FIXED : flags; + ret = mmap64(addr, length, prot, new_flags, fd, offset); printf_log(LOG_DEBUG, " tried again with %p, got %p\n", addr, ret); } #endif |