kernel/vm_manager: Rename HeapAllocate to SetHeapSize

Makes it more obvious that this function is intending to stand in for
the actual supervisor call itself, and not acting as a general heap
allocation function.

Also the following change will merge the freeing behavior of HeapFree
into this function, so leaving it as HeapAllocate would be misleading.
This commit is contained in:
Lioncash 2019-03-24 16:28:04 -04:00
parent abdb81ccaf
commit 99a163478b
3 changed files with 3 additions and 4 deletions

View file

@ -175,8 +175,7 @@ static ResultCode SetHeapSize(VAddr* heap_addr, u64 heap_size) {
} }
auto& vm_manager = Core::System::GetInstance().Kernel().CurrentProcess()->VMManager(); auto& vm_manager = Core::System::GetInstance().Kernel().CurrentProcess()->VMManager();
const auto alloc_result = vm_manager.HeapAllocate(heap_size); const auto alloc_result = vm_manager.SetHeapSize(heap_size);
if (alloc_result.Failed()) { if (alloc_result.Failed()) {
return alloc_result.Code(); return alloc_result.Code();
} }

View file

@ -256,7 +256,7 @@ ResultCode VMManager::ReprotectRange(VAddr target, u64 size, VMAPermission new_p
return RESULT_SUCCESS; return RESULT_SUCCESS;
} }
ResultVal<VAddr> VMManager::HeapAllocate(u64 size) { ResultVal<VAddr> VMManager::SetHeapSize(u64 size) {
if (size > GetHeapRegionSize()) { if (size > GetHeapRegionSize()) {
return ERR_OUT_OF_MEMORY; return ERR_OUT_OF_MEMORY;
} }

View file

@ -380,7 +380,7 @@ public:
/// Changes the permissions of a range of addresses, splitting VMAs as necessary. /// Changes the permissions of a range of addresses, splitting VMAs as necessary.
ResultCode ReprotectRange(VAddr target, u64 size, VMAPermission new_perms); ResultCode ReprotectRange(VAddr target, u64 size, VMAPermission new_perms);
ResultVal<VAddr> HeapAllocate(u64 size); ResultVal<VAddr> SetHeapSize(u64 size);
ResultCode HeapFree(VAddr target, u64 size); ResultCode HeapFree(VAddr target, u64 size);
ResultCode MirrorMemory(VAddr dst_addr, VAddr src_addr, u64 size, MemoryState state); ResultCode MirrorMemory(VAddr dst_addr, VAddr src_addr, u64 size, MemoryState state);