mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-06 01:12:33 +00:00
Fix bug with unmapping before reserve
This commit is contained in:
parent
09b683bc50
commit
7e7027880b
@ -171,10 +171,11 @@ int MemoryManager::PoolReserve(void** out_addr, VAddr virtual_addr, size_t size,
|
|||||||
|
|
||||||
// Fixed mapping means the virtual address must exactly match the provided one.
|
// Fixed mapping means the virtual address must exactly match the provided one.
|
||||||
if (True(flags & MemoryMapFlags::Fixed)) {
|
if (True(flags & MemoryMapFlags::Fixed)) {
|
||||||
const auto& vma = FindVMA(mapped_addr)->second;
|
auto& vma = FindVMA(mapped_addr)->second;
|
||||||
// If the VMA is mapped, unmap the region first.
|
// If the VMA is mapped, unmap the region first.
|
||||||
if (vma.IsMapped()) {
|
if (vma.IsMapped()) {
|
||||||
UnmapMemoryImpl(mapped_addr, size);
|
UnmapMemoryImpl(mapped_addr, size);
|
||||||
|
vma = FindVMA(mapped_addr)->second;
|
||||||
}
|
}
|
||||||
const size_t remaining_size = vma.base + vma.size - mapped_addr;
|
const size_t remaining_size = vma.base + vma.size - mapped_addr;
|
||||||
ASSERT_MSG(vma.type == VMAType::Free && remaining_size >= size);
|
ASSERT_MSG(vma.type == VMAType::Free && remaining_size >= size);
|
||||||
@ -208,10 +209,11 @@ int MemoryManager::Reserve(void** out_addr, VAddr virtual_addr, size_t size, Mem
|
|||||||
|
|
||||||
// Fixed mapping means the virtual address must exactly match the provided one.
|
// Fixed mapping means the virtual address must exactly match the provided one.
|
||||||
if (True(flags & MemoryMapFlags::Fixed)) {
|
if (True(flags & MemoryMapFlags::Fixed)) {
|
||||||
const auto& vma = FindVMA(mapped_addr)->second;
|
auto& vma = FindVMA(mapped_addr)->second;
|
||||||
// If the VMA is mapped, unmap the region first.
|
// If the VMA is mapped, unmap the region first.
|
||||||
if (vma.IsMapped()) {
|
if (vma.IsMapped()) {
|
||||||
UnmapMemoryImpl(mapped_addr, size);
|
UnmapMemoryImpl(mapped_addr, size);
|
||||||
|
vma = FindVMA(mapped_addr)->second;
|
||||||
}
|
}
|
||||||
const size_t remaining_size = vma.base + vma.size - mapped_addr;
|
const size_t remaining_size = vma.base + vma.size - mapped_addr;
|
||||||
ASSERT_MSG(vma.type == VMAType::Free && remaining_size >= size);
|
ASSERT_MSG(vma.type == VMAType::Free && remaining_size >= size);
|
||||||
|
Loading…
Reference in New Issue
Block a user