diff options
| -rw-r--r-- | src/core/hle/kernel/k_resource_limit.cpp | 19 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_resource_limit.h | 3 |
2 files changed, 22 insertions, 0 deletions
diff --git a/src/core/hle/kernel/k_resource_limit.cpp b/src/core/hle/kernel/k_resource_limit.cpp index 0c4bba66b..a84977c68 100644 --- a/src/core/hle/kernel/k_resource_limit.cpp +++ b/src/core/hle/kernel/k_resource_limit.cpp | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "common/assert.h" | 5 | #include "common/assert.h" |
| 6 | #include "core/core.h" | ||
| 6 | #include "core/core_timing.h" | 7 | #include "core/core_timing.h" |
| 7 | #include "core/hle/kernel/k_resource_limit.h" | 8 | #include "core/hle/kernel/k_resource_limit.h" |
| 8 | #include "core/hle/kernel/svc_results.h" | 9 | #include "core/hle/kernel/svc_results.h" |
| @@ -151,4 +152,22 @@ void KResourceLimit::Release(LimitableResource which, s64 value, s64 hint) { | |||
| 151 | } | 152 | } |
| 152 | } | 153 | } |
| 153 | 154 | ||
| 155 | KResourceLimit* CreateResourceLimitForProcess(Core::System& system, s64 physical_memory_size) { | ||
| 156 | auto* resource_limit = KResourceLimit::Create(system.Kernel()); | ||
| 157 | resource_limit->Initialize(&system.CoreTiming()); | ||
| 158 | |||
| 159 | // Initialize default resource limit values. | ||
| 160 | // TODO(bunnei): These values are the system defaults, the limits for service processes are | ||
| 161 | // lower. These should use the correct limit values. | ||
| 162 | |||
| 163 | ASSERT(resource_limit->SetLimitValue(LimitableResource::PhysicalMemory, physical_memory_size) | ||
| 164 | .IsSuccess()); | ||
| 165 | ASSERT(resource_limit->SetLimitValue(LimitableResource::Threads, 800).IsSuccess()); | ||
| 166 | ASSERT(resource_limit->SetLimitValue(LimitableResource::Events, 900).IsSuccess()); | ||
| 167 | ASSERT(resource_limit->SetLimitValue(LimitableResource::TransferMemory, 200).IsSuccess()); | ||
| 168 | ASSERT(resource_limit->SetLimitValue(LimitableResource::Sessions, 1133).IsSuccess()); | ||
| 169 | |||
| 170 | return resource_limit; | ||
| 171 | } | ||
| 172 | |||
| 154 | } // namespace Kernel | 173 | } // namespace Kernel |
diff --git a/src/core/hle/kernel/k_resource_limit.h b/src/core/hle/kernel/k_resource_limit.h index fab6005ff..d23d16aa4 100644 --- a/src/core/hle/kernel/k_resource_limit.h +++ b/src/core/hle/kernel/k_resource_limit.h | |||
| @@ -67,4 +67,7 @@ private: | |||
| 67 | KLightConditionVariable cond_var; | 67 | KLightConditionVariable cond_var; |
| 68 | const Core::Timing::CoreTiming* core_timing{}; | 68 | const Core::Timing::CoreTiming* core_timing{}; |
| 69 | }; | 69 | }; |
| 70 | |||
| 71 | KResourceLimit* CreateResourceLimitForProcess(Core::System& system, s64 physical_memory_size); | ||
| 72 | |||
| 70 | } // namespace Kernel | 73 | } // namespace Kernel |