mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-12 11:00:42 +02:00
Merge pull request #4546 from OFFTKP/shmdt
Make shmdt reset the unmapped pages in the 32-bit allocator
This commit is contained in:
1 file changed
+13
-1
@@ -514,8 +514,20 @@ uint64_t MemAllocator32Bit::Shmdt(const void* shmaddr) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
int shmid = it->second;
|
||||
struct shmid_ds buf {};
|
||||
if (shmctl(shmid, IPC_STAT, &buf) == 0) {
|
||||
size_t PagesLength = FEXCore::AlignUp(buf.shm_segsz, FEXCore::Utils::FEX_PAGE_SIZE) >> FEXCore::Utils::FEX_PAGE_SHIFT;
|
||||
SetFreePages(AddrPage, PagesLength);
|
||||
} else {
|
||||
LOGMAN_MSG_A_FMT("Failed to get shm size during shmdt");
|
||||
}
|
||||
|
||||
uint64_t Result = ::shmdt(shmaddr);
|
||||
PageToShm.erase(it);
|
||||
|
||||
if (Result == 0) {
|
||||
PageToShm.erase(it);
|
||||
}
|
||||
|
||||
SYSCALL_ERRNO();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user