mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-03 23:56:21 +00:00
address_space: Fix unmap of region surrounded by placeholders
This commit is contained in:
parent
f2b6d41ac6
commit
c9773c5c0a
1 changed files with 4 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include <boost/icl/separate_interval_set.hpp>
|
#include <map>
|
||||||
#include "common/alignment.h"
|
#include "common/alignment.h"
|
||||||
#include "common/arch.h"
|
#include "common/arch.h"
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
|
@ -277,13 +277,14 @@ struct AddressSpace::Impl {
|
||||||
}
|
}
|
||||||
|
|
||||||
it_prev->second.size = total_size;
|
it_prev->second.size = total_size;
|
||||||
it = regions.erase(it);
|
regions.erase(it);
|
||||||
|
it = it_prev;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if a placeholder exists right after us.
|
// Check if a placeholder exists right after us.
|
||||||
auto it_next = std::next(it);
|
auto it_next = std::next(it);
|
||||||
if (it_next != regions.end() && !it_next->second.is_mapped) {
|
if (it_next != regions.end() && !it_next->second.is_mapped) {
|
||||||
const size_t total_size = size + it_next->second.size;
|
const size_t total_size = it->second.size + it_next->second.size;
|
||||||
if (!VirtualFreeEx(process, LPVOID(it->first), total_size, MEM_RELEASE | MEM_COALESCE_PLACEHOLDERS)) {
|
if (!VirtualFreeEx(process, LPVOID(it->first), total_size, MEM_RELEASE | MEM_COALESCE_PLACEHOLDERS)) {
|
||||||
UNREACHABLE_MSG("Region coalescing failed: {}", Common::GetLastErrorMsg());
|
UNREACHABLE_MSG("Region coalescing failed: {}", Common::GetLastErrorMsg());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue