2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

process: Unmap previously allocated heap.

This commit is contained in:
bunnei 2018-03-16 18:24:29 -04:00
parent 403f8e79ea
commit e9a857ce82

View file

@ -183,6 +183,8 @@ ResultVal<VAddr> Process::HeapAllocate(VAddr target, u64 size, VMAPermission per
// Initialize heap // Initialize heap
heap_memory = std::make_shared<std::vector<u8>>(); heap_memory = std::make_shared<std::vector<u8>>();
heap_start = heap_end = target; heap_start = heap_end = target;
} else {
vm_manager.UnmapRange(heap_start, heap_end - heap_start);
} }
// If necessary, expand backing vector to cover new heap extents. // If necessary, expand backing vector to cover new heap extents.
@ -202,7 +204,7 @@ ResultVal<VAddr> Process::HeapAllocate(VAddr target, u64 size, VMAPermission per
size, MemoryState::Heap)); size, MemoryState::Heap));
vm_manager.Reprotect(vma, perms); vm_manager.Reprotect(vma, perms);
heap_used += size; heap_used = size;
memory_region->used += size; memory_region->used += size;
return MakeResult<VAddr>(heap_end - size); return MakeResult<VAddr>(heap_end - size);