diff options
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 | |||
| 312 | } | 312 | } |
| 313 | 313 | ||
| 314 | /// Creates a new thread | 314 | /// Creates a new thread |
| 315 | static ResultCode CreateThread(u32* out_handle, u32 priority, u32 entry_point, u32 arg, u32 stack_top, u32 processor_id) { | 315 | static ResultCode CreateThread(Handle* out_handle, s32 priority, u32 entry_point, u32 arg, u32 stack_top, s32 processor_id) { |
| 316 | using Kernel::Thread; | 316 | using Kernel::Thread; |
| 317 | 317 | ||
| 318 | std::string name; | 318 | std::string name; |
| @@ -323,6 +323,21 @@ static ResultCode CreateThread(u32* out_handle, u32 priority, u32 entry_point, u | |||
| 323 | name = Common::StringFromFormat("unknown-%08x", entry_point); | 323 | name = Common::StringFromFormat("unknown-%08x", entry_point); |
| 324 | } | 324 | } |
| 325 | 325 | ||
| 326 | // TODO(bunnei): Implement resource limits to return an error code instead of the below assert. | ||
| 327 | // The error code should be: Description::NotAuthorized, Module::OS, Summary::WrongArgument, | ||
| 328 | // Level::Permanent | ||
| 329 | ASSERT_MSG(priority >= THREADPRIO_USERLAND_MAX, "Unexpected thread priority!"); | ||
| 330 | |||
| 331 | if (priority > THREADPRIO_LOWEST) { | ||
| 332 | return ResultCode(ErrorDescription::OutOfRange, ErrorModule::OS, | ||
| 333 | ErrorSummary::InvalidArgument, ErrorLevel::Usage); | ||
| 334 | } | ||
| 335 | |||
| 336 | if (processor_id > THREADPROCESSORID_MAX) { | ||
| 337 | return ResultCode(ErrorDescription::OutOfRange, ErrorModule::Kernel, | ||
| 338 | ErrorSummary::InvalidArgument, ErrorLevel::Permanent); | ||
| 339 | } | ||
| 340 | |||
| 326 | CASCADE_RESULT(SharedPtr<Thread> thread, Kernel::Thread::Create( | 341 | CASCADE_RESULT(SharedPtr<Thread> thread, Kernel::Thread::Create( |
| 327 | name, entry_point, priority, arg, processor_id, stack_top)); | 342 | name, entry_point, priority, arg, processor_id, stack_top)); |
| 328 | CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(thread))); | 343 | 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 | |||
| 331 | "threadpriority=0x%08X, processorid=0x%08X : created handle=0x%08X", entry_point, | 346 | "threadpriority=0x%08X, processorid=0x%08X : created handle=0x%08X", entry_point, |
| 332 | name.c_str(), arg, stack_top, priority, processor_id, *out_handle); | 347 | name.c_str(), arg, stack_top, priority, processor_id, *out_handle); |
| 333 | 348 | ||
| 334 | if (THREADPROCESSORID_1 == processor_id) { | ||
| 335 | LOG_WARNING(Kernel_SVC, | ||
| 336 | "thread designated for system CPU core (UNIMPLEMENTED) will be run with app core scheduling"); | ||
| 337 | } | ||
| 338 | |||
| 339 | HLE::Reschedule(__func__); | 349 | HLE::Reschedule(__func__); |
| 340 | 350 | ||
| 341 | return RESULT_SUCCESS; | 351 | return RESULT_SUCCESS; |