summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/process.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/kernel/process.cpp')
-rw-r--r--src/core/hle/kernel/process.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp
index 0b39f2955..ff9d9248b 100644
--- a/src/core/hle/kernel/process.cpp
+++ b/src/core/hle/kernel/process.cpp
@@ -137,10 +137,9 @@ std::shared_ptr<ResourceLimit> Process::GetResourceLimit() const {
137} 137}
138 138
139u64 Process::GetTotalPhysicalMemoryAvailable() const { 139u64 Process::GetTotalPhysicalMemoryAvailable() const {
140 const u64 capacity{ 140 const u64 capacity{resource_limit->GetCurrentResourceValue(ResourceType::PhysicalMemory) +
141 static_cast<u64>(resource_limit->GetCurrentResourceValue(ResourceType::PhysicalMemory)) + 141 page_table->GetTotalHeapSize() + GetSystemResourceSize() + image_size +
142 page_table->GetTotalHeapSize() + GetSystemResourceSize() + image_size + 142 main_thread_stack_size};
143 main_thread_stack_size};
144 143
145 if (capacity < memory_usage_capacity) { 144 if (capacity < memory_usage_capacity) {
146 return capacity; 145 return capacity;
@@ -280,12 +279,12 @@ ResultCode Process::LoadFromMetadata(const FileSys::ProgramMetadata& metadata,
280 // Set initial resource limits 279 // Set initial resource limits
281 resource_limit->SetLimitValue( 280 resource_limit->SetLimitValue(
282 ResourceType::PhysicalMemory, 281 ResourceType::PhysicalMemory,
283 static_cast<s64>(kernel.MemoryManager().GetSize(Memory::MemoryManager::Pool::Application))); 282 kernel.MemoryManager().GetSize(Memory::MemoryManager::Pool::Application));
284 resource_limit->SetLimitValue(ResourceType::Threads, 608); 283 resource_limit->SetLimitValue(ResourceType::Threads, 608);
285 resource_limit->SetLimitValue(ResourceType::Events, 700); 284 resource_limit->SetLimitValue(ResourceType::Events, 700);
286 resource_limit->SetLimitValue(ResourceType::TransferMemory, 128); 285 resource_limit->SetLimitValue(ResourceType::TransferMemory, 128);
287 resource_limit->SetLimitValue(ResourceType::Sessions, 894); 286 resource_limit->SetLimitValue(ResourceType::Sessions, 894);
288 ASSERT(resource_limit->Reserve(ResourceType::PhysicalMemory, static_cast<s64>(code_size))); 287 ASSERT(resource_limit->Reserve(ResourceType::PhysicalMemory, code_size));
289 288
290 // Create TLS region 289 // Create TLS region
291 tls_region_address = CreateTLSRegion(); 290 tls_region_address = CreateTLSRegion();
@@ -301,9 +300,9 @@ void Process::Run(s32 main_thread_priority, u64 stack_size) {
301 300
302 ChangeStatus(ProcessStatus::Running); 301 ChangeStatus(ProcessStatus::Running);
303 302
304 SetupMainThread(system, *this, static_cast<u32>(main_thread_priority), main_thread_stack_top); 303 SetupMainThread(system, *this, main_thread_priority, main_thread_stack_top);
305 resource_limit->Reserve(ResourceType::Threads, 1); 304 resource_limit->Reserve(ResourceType::Threads, 1);
306 resource_limit->Reserve(ResourceType::PhysicalMemory, static_cast<s64>(main_thread_stack_size)); 305 resource_limit->Reserve(ResourceType::PhysicalMemory, main_thread_stack_size);
307} 306}
308 307
309void Process::PrepareForTermination() { 308void Process::PrepareForTermination() {
@@ -364,7 +363,7 @@ VAddr Process::CreateTLSRegion() {
364 ->AllocateAndMapMemory(1, Memory::PageSize, true, start, size / Memory::PageSize, 363 ->AllocateAndMapMemory(1, Memory::PageSize, true, start, size / Memory::PageSize,
365 Memory::MemoryState::ThreadLocal, 364 Memory::MemoryState::ThreadLocal,
366 Memory::MemoryPermission::ReadAndWrite, tls_map_addr) 365 Memory::MemoryPermission::ReadAndWrite, tls_map_addr)
367 .ValueOr(0U)}; 366 .ValueOr(0)};
368 367
369 ASSERT(tls_page_addr); 368 ASSERT(tls_page_addr);
370 369