summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/thread.cpp
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2017-01-11 18:08:10 +0100
committerSubv <subv2112@gmail.com>2017-01-11 22:38:04 +0100
commitf2f2572fed075d2dca5ae7abcea451ac5eb382ec (patch)
tree1a7f133a595f7362a79e3f06d1e0bcb8a4668706 /src/core/hle/kernel/thread.cpp
parentY2R: Use the proper error code when GetStandardCoefficient receives an invalid value. (diff)
downloadyuzu-f2f2572fed075d2dca5ae7abcea451ac5eb382ec.tar
yuzu-f2f2572fed075d2dca5ae7abcea451ac5eb382ec.tar.gz
yuzu-f2f2572fed075d2dca5ae7abcea451ac5eb382ec.tar.bz2
yuzu-f2f2572fed075d2dca5ae7abcea451ac5eb382ec.tar.lz
yuzu-f2f2572fed075d2dca5ae7abcea451ac5eb382ec.tar.xz
yuzu-f2f2572fed075d2dca5ae7abcea451ac5eb382ec.tar.zst
yuzu-f2f2572fed075d2dca5ae7abcea451ac5eb382ec.zip
Diffstat (limited to '')
-rw-r--r--src/core/hle/kernel/thread.cpp20
1 files changed, 2 insertions, 18 deletions
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index 8c6fbcd04..5ba9abf29 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -444,25 +444,9 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point,
return MakeResult<SharedPtr<Thread>>(std::move(thread));
}
-// TODO(peachum): Remove this. Range checking should be done, and an appropriate error should be
-// returned.
-static void ClampPriority(const Thread* thread, s32* priority) {
- if (*priority < THREADPRIO_HIGHEST || *priority > THREADPRIO_LOWEST) {
- DEBUG_ASSERT_MSG(
- false, "Application passed an out of range priority. An error should be returned.");
-
- s32 new_priority = MathUtil::Clamp<s32>(*priority, THREADPRIO_HIGHEST, THREADPRIO_LOWEST);
- LOG_WARNING(Kernel_SVC, "(name=%s): invalid priority=%d, clamping to %d",
- thread->name.c_str(), *priority, new_priority);
- // TODO(bunnei): Clamping to a valid priority is not necessarily correct behavior... Confirm
- // validity of this
- *priority = new_priority;
- }
-}
-
void Thread::SetPriority(s32 priority) {
- ClampPriority(this, &priority);
-
+ ASSERT_MSG(priority <= THREADPRIO_LOWEST && priority >= THREADPRIO_HIGHEST,
+ "Invalid priority value.");
// If thread was ready, adjust queues
if (status == THREADSTATUS_READY)
ready_queue.move(this, current_priority, priority);