diff options
author | Subv <subv2112@gmail.com> | 2017-01-11 19:20:14 +0100 |
---|---|---|
committer | Subv <subv2112@gmail.com> | 2017-01-11 22:38:05 +0100 |
commit | 1ddff1451140ef58058237a3198d363b96dc238e (patch) | |
tree | 4c8d364f61477d80de05f56917d77b566975de1e /src/core/hle/svc.cpp | |
parent | Thread: Added priority range checking to svcSetThreadPriority and removed priority clamping code from Thread::SetPriority. (diff) | |
download | yuzu-1ddff1451140ef58058237a3198d363b96dc238e.tar yuzu-1ddff1451140ef58058237a3198d363b96dc238e.tar.gz yuzu-1ddff1451140ef58058237a3198d363b96dc238e.tar.bz2 yuzu-1ddff1451140ef58058237a3198d363b96dc238e.tar.lz yuzu-1ddff1451140ef58058237a3198d363b96dc238e.tar.xz yuzu-1ddff1451140ef58058237a3198d363b96dc238e.tar.zst yuzu-1ddff1451140ef58058237a3198d363b96dc238e.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/svc.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index 8cb6a1c94..96db39ad9 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp @@ -532,16 +532,18 @@ static ResultCode CreateThread(Kernel::Handle* out_handle, s32 priority, u32 ent name = Common::StringFromFormat("unknown-%08x", entry_point); } - // TODO(bunnei): Implement resource limits to return an error code instead of the below assert. - // The error code should be: Description::NotAuthorized, Module::OS, Summary::WrongArgument, - // Level::Permanent - ASSERT_MSG(priority >= THREADPRIO_USERLAND_MAX, "Unexpected thread priority!"); - if (priority > THREADPRIO_LOWEST) { return ResultCode(ErrorDescription::OutOfRange, ErrorModule::OS, ErrorSummary::InvalidArgument, ErrorLevel::Usage); } + using Kernel::ResourceLimit; + Kernel::SharedPtr<ResourceLimit>& resource_limit = Kernel::g_current_process->resource_limit; + if (resource_limit->GetMaxResourceValue(Kernel::ResourceTypes::PRIORITY) > priority) { + return ResultCode(ErrorDescription::NotAuthorized, ErrorModule::OS, + ErrorSummary::WrongArgument, ErrorLevel::Permanent); + } + switch (processor_id) { case THREADPROCESSORID_ALL: case THREADPROCESSORID_DEFAULT: |