From 52ba725fa5aa7759a08cff48c677a14de737c7cc Mon Sep 17 00:00:00 2001 From: Yang Liu Date: Fri, 22 Nov 2024 19:06:55 +0800 Subject: [PATCH] Reworked on mmap address alignments for a performance regression (#2057) --- src/wrapped/wrappedlibc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/wrapped/wrappedlibc.c b/src/wrapped/wrappedlibc.c index 20ba4e24..b30eea61 100644 --- a/src/wrapped/wrappedlibc.c +++ b/src/wrapped/wrappedlibc.c @@ -2994,10 +2994,9 @@ EXPORT void* my_mmap64(x64emu_t* emu, void *addr, size_t length, int prot, int f new_flags&=~MAP_32BIT; // remove MAP_32BIT if((flags&MAP_32BIT) && !(flags&MAP_FIXED)) { // MAP_32BIT only exist on x86_64! - if(!(flags&MAP_FIXED) && (!old_addr || !isBlockFree(old_addr, length))) - addr = find31bitBlockNearHint(old_addr, length, 0); + addr = find31bitBlockNearHint(old_addr, length, 0); } else if (box64_wine || 1) { // other mmap should be restricted to 47bits - if(!(flags&MAP_FIXED) && (!addr || !isBlockFree(addr, length))) + if (!(flags&MAP_FIXED) && !addr) addr = find47bitBlock(length); } #endif