diff options
author | bunnei <bunneidev@gmail.com> | 2015-03-24 04:55:21 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2015-04-10 01:05:21 +0200 |
commit | 7b9f428b23e1761e7b6c177d2e8eb9219ac6b7f6 (patch) | |
tree | 597dff81a4b2935daaa7890c932b00cea4d6ae53 /src/core/hle/svc.cpp | |
parent | SVC: Reschedule on svcCreateThread. (diff) | |
download | yuzu-7b9f428b23e1761e7b6c177d2e8eb9219ac6b7f6.tar yuzu-7b9f428b23e1761e7b6c177d2e8eb9219ac6b7f6.tar.gz yuzu-7b9f428b23e1761e7b6c177d2e8eb9219ac6b7f6.tar.bz2 yuzu-7b9f428b23e1761e7b6c177d2e8eb9219ac6b7f6.tar.lz yuzu-7b9f428b23e1761e7b6c177d2e8eb9219ac6b7f6.tar.xz yuzu-7b9f428b23e1761e7b6c177d2e8eb9219ac6b7f6.tar.zst yuzu-7b9f428b23e1761e7b6c177d2e8eb9219ac6b7f6.zip |
Diffstat (limited to 'src/core/hle/svc.cpp')
-rw-r--r-- | src/core/hle/svc.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index e89e97238..82e187466 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp @@ -312,7 +312,7 @@ static ResultCode GetResourceLimitCurrentValues(s64* values, Handle resource_lim } /// Creates a new thread -static ResultCode CreateThread(u32* out_handle, u32 priority, u32 entry_point, u32 arg, u32 stack_top, u32 processor_id) { +static ResultCode CreateThread(Handle* out_handle, s32 priority, u32 entry_point, u32 arg, u32 stack_top, s32 processor_id) { using Kernel::Thread; std::string name; @@ -323,6 +323,21 @@ static ResultCode CreateThread(u32* out_handle, u32 priority, u32 entry_point, u 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); + } + + if (processor_id > THREADPROCESSORID_MAX) { + return ResultCode(ErrorDescription::OutOfRange, ErrorModule::Kernel, + ErrorSummary::InvalidArgument, ErrorLevel::Permanent); + } + CASCADE_RESULT(SharedPtr<Thread> thread, Kernel::Thread::Create( name, entry_point, priority, arg, processor_id, stack_top)); CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(thread))); @@ -331,11 +346,6 @@ static ResultCode CreateThread(u32* out_handle, u32 priority, u32 entry_point, u "threadpriority=0x%08X, processorid=0x%08X : created handle=0x%08X", entry_point, name.c_str(), arg, stack_top, priority, processor_id, *out_handle); - if (THREADPROCESSORID_1 == processor_id) { - LOG_WARNING(Kernel_SVC, - "thread designated for system CPU core (UNIMPLEMENTED) will be run with app core scheduling"); - } - HLE::Reschedule(__func__); return RESULT_SUCCESS; |