Skip to content

Commit

Permalink
Improved map with fd tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
ptitSeb committed Jan 29, 2025
1 parent ed7147e commit 96bca6e
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/wrapped/wrappedlibc.c
Original file line number Diff line number Diff line change
Expand Up @@ -3006,16 +3006,17 @@ EXPORT void* my_mmap64(x64emu_t* emu, void *addr, size_t length, int prot, int f
if((BOX64ENV(log)>=LOG_DEBUG || BOX64ENV(dynarec_log)>=LOG_DEBUG)) {printf_log(LOG_NONE, "Note: Marking the region (%p-%p prot=%x) as NEVERCLEAN because fd have O_RDWR attribute\n", ret, ret+length, prot);}
prot |= PROT_NEVERCLEAN;
}
if(emu) {
DetectUnityPlayer(fd);
// the last_mmap will allow mmap created by wine, even those that have hole, to be fully tracked as one single mmap
if((ret>=last_mmap_addr) && ret+length<(last_mmap_addr+last_mmap_len))
RecordEnvMappings((uintptr_t)last_mmap_addr, last_mmap_len, fd);
else
RecordEnvMappings((uintptr_t)ret, length, fd);
}
}
if(fd>0) {
DetectUnityPlayer(fd);
// the last_mmap will allow mmap created by wine, even those that have hole, to be fully tracked as one single mmap
if((ret>=last_mmap_addr) && ret+length<(last_mmap_addr+last_mmap_len))
RecordEnvMappings((uintptr_t)last_mmap_addr, last_mmap_len, fd);
else
RecordEnvMappings((uintptr_t)ret, length, fd);
}
if((fd==-1) && (flags==(MAP_PRIVATE|MAP_ANON))) {
// hack to capture full size of the mmap done by wine
if(emu && (fd==-1) && (flags==(MAP_PRIVATE|MAP_ANON))) {
last_mmap_addr = ret;
last_mmap_len = length;
} else {
Expand Down

0 comments on commit 96bca6e

Please sign in to comment.