diff options
author | bunnei <bunneidev@gmail.com> | 2022-02-26 10:41:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-26 10:41:08 +0100 |
commit | 20e9501b0d0d18b6b215f2f3ed092a3646267bd1 (patch) | |
tree | cd90b946482d00c5431c13b165f28d803cf54f59 /src/core/hle/service | |
parent | Merge pull request #7953 from ameerj/radv-rdna2-crash (diff) | |
parent | hle: kernel: KSystemControl: Use 6GB memory layout when "use_extended_memory_layout" setting is enabled. (diff) | |
download | yuzu-20e9501b0d0d18b6b215f2f3ed092a3646267bd1.tar yuzu-20e9501b0d0d18b6b215f2f3ed092a3646267bd1.tar.gz yuzu-20e9501b0d0d18b6b215f2f3ed092a3646267bd1.tar.bz2 yuzu-20e9501b0d0d18b6b215f2f3ed092a3646267bd1.tar.lz yuzu-20e9501b0d0d18b6b215f2f3ed092a3646267bd1.tar.xz yuzu-20e9501b0d0d18b6b215f2f3ed092a3646267bd1.tar.zst yuzu-20e9501b0d0d18b6b215f2f3ed092a3646267bd1.zip |
Diffstat (limited to 'src/core/hle/service')
-rw-r--r-- | src/core/hle/service/kernel_helpers.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/core/hle/service/kernel_helpers.cpp b/src/core/hle/service/kernel_helpers.cpp index 62f4cdfb2..b8c2c6e51 100644 --- a/src/core/hle/service/kernel_helpers.cpp +++ b/src/core/hle/service/kernel_helpers.cpp @@ -3,7 +3,9 @@ // Refer to the license.txt file included. #include "core/core.h" +#include "core/core_timing.h" #include "core/hle/kernel/k_event.h" +#include "core/hle/kernel/k_memory_manager.h" #include "core/hle/kernel/k_process.h" #include "core/hle/kernel/k_readable_event.h" #include "core/hle/kernel/k_resource_limit.h" @@ -15,10 +17,21 @@ namespace Service::KernelHelpers { ServiceContext::ServiceContext(Core::System& system_, std::string name_) : kernel(system_.Kernel()) { + + // Create a resource limit for the process. + const auto physical_memory_size = + kernel.MemoryManager().GetSize(Kernel::KMemoryManager::Pool::System); + auto* resource_limit = Kernel::CreateResourceLimitForProcess(system_, physical_memory_size); + + // Create the process. process = Kernel::KProcess::Create(kernel); ASSERT(Kernel::KProcess::Initialize(process, system_, std::move(name_), - Kernel::KProcess::ProcessType::Userland) + Kernel::KProcess::ProcessType::KernelInternal, + resource_limit) .IsSuccess()); + + // Close reference to our resource limit, as the process opens one. + resource_limit->Close(); } ServiceContext::~ServiceContext() { @@ -43,7 +56,7 @@ Kernel::KEvent* ServiceContext::CreateEvent(std::string&& name) { } // Initialize the event. - event->Initialize(std::move(name)); + event->Initialize(std::move(name), process); // Commit the thread reservation. event_reservation.Commit(); |