diff options
Diffstat (limited to 'Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp')
-rw-r--r-- | Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp b/Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp index 7a46c74e78..07ca7dade8 100644 --- a/Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp +++ b/Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp @@ -873,10 +873,11 @@ u32 Emulator::virt$mmap(u32 params_addr) Optional<Range> result; if (params.flags & MAP_RANDOMIZED) { result = m_range_allocator.allocate_randomized(requested_size, params.alignment); - } else if (params.flags & MAP_FIXED) { + } else if (params.flags & MAP_FIXED || params.flags & MAP_FIXED_NOREPLACE) { if (params.addr) { // If MAP_FIXED is specified, existing mappings that intersect the requested range are removed. - virt$munmap(params.addr, requested_size); + if (params.flags & MAP_FIXED) + virt$munmap(params.addr, requested_size); result = m_range_allocator.allocate_specific(VirtualAddress { params.addr }, requested_size); } else { // mmap(nullptr, …, MAP_FIXED) is technically okay, but tends to be a bug. |