aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/k_process.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-12-28 00:18:41 -0800
committerbunnei <bunneidev@gmail.com>2021-12-28 01:25:20 -0800
commit091463a429c39969750e03a1b9cba04d7bd5a732 (patch)
tree496f636795bebc33a3fef016604f6c78c317915e /src/core/hle/kernel/k_process.cpp
parent9a0648ff0ad38195d7211b8c65d82b93fe123949 (diff)
core: hle: kernel: Updated implementation of svcSetHeapSize.
- Updates our svcSetHeapSize with latest HOS, furthermore allowing heap size to properly be extended/shrunk. - Validated with tests https://github.com/Atmosphere-NX/Atmosphere/blob/master/tests/TestSvc/source/test_set_heap_size.cpp.
Diffstat (limited to 'src/core/hle/kernel/k_process.cpp')
-rw-r--r--src/core/hle/kernel/k_process.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/core/hle/kernel/k_process.cpp b/src/core/hle/kernel/k_process.cpp
index aee313995..73f8bc4fe 100644
--- a/src/core/hle/kernel/k_process.cpp
+++ b/src/core/hle/kernel/k_process.cpp
@@ -172,7 +172,7 @@ void KProcess::DecrementThreadCount() {
u64 KProcess::GetTotalPhysicalMemoryAvailable() const {
const u64 capacity{resource_limit->GetFreeValue(LimitableResource::PhysicalMemory) +
- page_table->GetTotalHeapSize() + GetSystemResourceSize() + image_size +
+ page_table->GetNormalMemorySize() + GetSystemResourceSize() + image_size +
main_thread_stack_size};
if (const auto pool_size = kernel.MemoryManager().GetSize(KMemoryManager::Pool::Application);
capacity != pool_size) {
@@ -189,7 +189,7 @@ u64 KProcess::GetTotalPhysicalMemoryAvailableWithoutSystemResource() const {
}
u64 KProcess::GetTotalPhysicalMemoryUsed() const {
- return image_size + main_thread_stack_size + page_table->GetTotalHeapSize() +
+ return image_size + main_thread_stack_size + page_table->GetNormalMemorySize() +
GetSystemResourceSize();
}
@@ -410,8 +410,8 @@ void KProcess::Run(s32 main_thread_priority, u64 stack_size) {
resource_limit->Reserve(LimitableResource::Threads, 1);
resource_limit->Reserve(LimitableResource::PhysicalMemory, main_thread_stack_size);
- const std::size_t heap_capacity{memory_usage_capacity - main_thread_stack_size - image_size};
- ASSERT(!page_table->SetHeapCapacity(heap_capacity).IsError());
+ const std::size_t heap_capacity{memory_usage_capacity - (main_thread_stack_size + image_size)};
+ ASSERT(!page_table->SetMaxHeapSize(heap_capacity).IsError());
ChangeStatus(ProcessStatus::Running);