diff options
Diffstat (limited to 'src/core/hle/kernel')
| -rw-r--r-- | src/core/hle/kernel/memory/memory_manager.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/kernel/process.cpp | 6 | ||||
| -rw-r--r-- | src/core/hle/kernel/readable_event.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/resource_limit.cpp | 6 |
4 files changed, 8 insertions, 10 deletions
diff --git a/src/core/hle/kernel/memory/memory_manager.cpp b/src/core/hle/kernel/memory/memory_manager.cpp index 6b432e1b2..616148190 100644 --- a/src/core/hle/kernel/memory/memory_manager.cpp +++ b/src/core/hle/kernel/memory/memory_manager.cpp | |||
| @@ -104,7 +104,7 @@ ResultCode MemoryManager::Allocate(PageLinkedList& page_list, std::size_t num_pa | |||
| 104 | // Ensure that we don't leave anything un-freed | 104 | // Ensure that we don't leave anything un-freed |
| 105 | auto group_guard = detail::ScopeExit([&] { | 105 | auto group_guard = detail::ScopeExit([&] { |
| 106 | for (const auto& it : page_list.Nodes()) { | 106 | for (const auto& it : page_list.Nodes()) { |
| 107 | const auto min_num_pages{std::min( | 107 | const auto min_num_pages{std::min<size_t>( |
| 108 | it.GetNumPages(), (chosen_manager.GetEndAddress() - it.GetAddress()) / PageSize)}; | 108 | it.GetNumPages(), (chosen_manager.GetEndAddress() - it.GetAddress()) / PageSize)}; |
| 109 | chosen_manager.Free(it.GetAddress(), min_num_pages); | 109 | chosen_manager.Free(it.GetAddress(), min_num_pages); |
| 110 | } | 110 | } |
| @@ -165,7 +165,7 @@ ResultCode MemoryManager::Free(PageLinkedList& page_list, std::size_t num_pages, | |||
| 165 | 165 | ||
| 166 | // Free all of the pages | 166 | // Free all of the pages |
| 167 | for (const auto& it : page_list.Nodes()) { | 167 | for (const auto& it : page_list.Nodes()) { |
| 168 | const auto min_num_pages{std::min( | 168 | const auto min_num_pages{std::min<size_t>( |
| 169 | it.GetNumPages(), (chosen_manager.GetEndAddress() - it.GetAddress()) / PageSize)}; | 169 | it.GetNumPages(), (chosen_manager.GetEndAddress() - it.GetAddress()) / PageSize)}; |
| 170 | chosen_manager.Free(it.GetAddress(), min_num_pages); | 170 | chosen_manager.Free(it.GetAddress(), min_num_pages); |
| 171 | } | 171 | } |
diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp index 36724569f..c4c5199b1 100644 --- a/src/core/hle/kernel/process.cpp +++ b/src/core/hle/kernel/process.cpp | |||
| @@ -132,7 +132,8 @@ std::shared_ptr<ResourceLimit> Process::GetResourceLimit() const { | |||
| 132 | 132 | ||
| 133 | u64 Process::GetTotalPhysicalMemoryAvailable() const { | 133 | u64 Process::GetTotalPhysicalMemoryAvailable() const { |
| 134 | const u64 capacity{resource_limit->GetCurrentResourceValue(ResourceType::PhysicalMemory) + | 134 | const u64 capacity{resource_limit->GetCurrentResourceValue(ResourceType::PhysicalMemory) + |
| 135 | page_table->GetTotalHeapSize() + image_size + main_thread_stack_size}; | 135 | page_table->GetTotalHeapSize() + GetSystemResourceSize() + image_size + |
| 136 | main_thread_stack_size}; | ||
| 136 | 137 | ||
| 137 | if (capacity < memory_usage_capacity) { | 138 | if (capacity < memory_usage_capacity) { |
| 138 | return capacity; | 139 | return capacity; |
| @@ -146,7 +147,8 @@ u64 Process::GetTotalPhysicalMemoryAvailableWithoutSystemResource() const { | |||
| 146 | } | 147 | } |
| 147 | 148 | ||
| 148 | u64 Process::GetTotalPhysicalMemoryUsed() const { | 149 | u64 Process::GetTotalPhysicalMemoryUsed() const { |
| 149 | return image_size + main_thread_stack_size + page_table->GetTotalHeapSize(); | 150 | return image_size + main_thread_stack_size + page_table->GetTotalHeapSize() + |
| 151 | GetSystemResourceSize(); | ||
| 150 | } | 152 | } |
| 151 | 153 | ||
| 152 | u64 Process::GetTotalPhysicalMemoryUsedWithoutSystemResource() const { | 154 | u64 Process::GetTotalPhysicalMemoryUsedWithoutSystemResource() const { |
diff --git a/src/core/hle/kernel/readable_event.cpp b/src/core/hle/kernel/readable_event.cpp index 00860fcbd..ef5e19e63 100644 --- a/src/core/hle/kernel/readable_event.cpp +++ b/src/core/hle/kernel/readable_event.cpp | |||
| @@ -38,7 +38,7 @@ void ReadableEvent::Clear() { | |||
| 38 | 38 | ||
| 39 | ResultCode ReadableEvent::Reset() { | 39 | ResultCode ReadableEvent::Reset() { |
| 40 | if (!is_signaled) { | 40 | if (!is_signaled) { |
| 41 | LOG_ERROR(Kernel, "Handle is not signaled! object_id={}, object_type={}, object_name={}", | 41 | LOG_TRACE(Kernel, "Handle is not signaled! object_id={}, object_type={}, object_name={}", |
| 42 | GetObjectId(), GetTypeName(), GetName()); | 42 | GetObjectId(), GetTypeName(), GetName()); |
| 43 | return ERR_INVALID_STATE; | 43 | return ERR_INVALID_STATE; |
| 44 | } | 44 | } |
diff --git a/src/core/hle/kernel/resource_limit.cpp b/src/core/hle/kernel/resource_limit.cpp index d9beaa3a4..212e442f4 100644 --- a/src/core/hle/kernel/resource_limit.cpp +++ b/src/core/hle/kernel/resource_limit.cpp | |||
| @@ -24,13 +24,9 @@ bool ResourceLimit::Reserve(ResourceType resource, s64 amount, u64 timeout) { | |||
| 24 | const std::size_t index{ResourceTypeToIndex(resource)}; | 24 | const std::size_t index{ResourceTypeToIndex(resource)}; |
| 25 | 25 | ||
| 26 | s64 new_value = current[index] + amount; | 26 | s64 new_value = current[index] + amount; |
| 27 | while (new_value > limit[index] && available[index] + amount <= limit[index]) { | 27 | if (new_value > limit[index] && available[index] + amount <= limit[index]) { |
| 28 | // TODO(bunnei): This is wrong for multicore, we should wait the calling thread for timeout | 28 | // TODO(bunnei): This is wrong for multicore, we should wait the calling thread for timeout |
| 29 | new_value = current[index] + amount; | 29 | new_value = current[index] + amount; |
| 30 | |||
| 31 | if (timeout >= 0) { | ||
| 32 | break; | ||
| 33 | } | ||
| 34 | } | 30 | } |
| 35 | 31 | ||
| 36 | if (new_value <= limit[index]) { | 32 | if (new_value <= limit[index]) { |