summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/thread.cpp
diff options
context:
space:
mode:
authorGravatar archshift2015-01-20 17:16:47 -0800
committerGravatar archshift2015-02-10 18:30:31 -0800
commitef24e72b2618806f64345544fa46c84f3f494890 (patch)
treefca138e8377c4d66bd1fe026a3d2fef54a7f090c /src/core/hle/kernel/thread.cpp
parentGSP: Fixed typo in SignalInterrupt (diff)
downloadyuzu-ef24e72b2618806f64345544fa46c84f3f494890.tar.gz
yuzu-ef24e72b2618806f64345544fa46c84f3f494890.tar.xz
yuzu-ef24e72b2618806f64345544fa46c84f3f494890.zip
Asserts: break/crash program, fit to style guide; log.h->assert.h
Involves making asserts use printf instead of the log functions (log functions are asynchronous and, as such, the log won't be printed in time) As such, the log type argument was removed (printf obviously can't use it, and it's made obsolete by the file and line printing) Also removed some GEKKO cruft.
Diffstat (limited to 'src/core/hle/kernel/thread.cpp')
-rw-r--r--src/core/hle/kernel/thread.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index 7f629c20e..f8c834a8d 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -29,7 +29,7 @@ bool Thread::ShouldWait() {
29} 29}
30 30
31void Thread::Acquire() { 31void Thread::Acquire() {
32 _assert_msg_(Kernel, !ShouldWait(), "object unavailable!"); 32 ASSERT_MSG(!ShouldWait(), "object unavailable!");
33} 33}
34 34
35// Lists all thread ids that aren't deleted/etc. 35// Lists all thread ids that aren't deleted/etc.
@@ -144,7 +144,7 @@ void ArbitrateAllThreads(u32 address) {
144 * @param new_thread The thread to switch to 144 * @param new_thread The thread to switch to
145 */ 145 */
146static void SwitchContext(Thread* new_thread) { 146static void SwitchContext(Thread* new_thread) {
147 _dbg_assert_msg_(Kernel, new_thread->status == THREADSTATUS_READY, "Thread must be ready to become running."); 147 DEBUG_ASSERT_MSG(new_thread->status == THREADSTATUS_READY, "Thread must be ready to become running.");
148 148
149 Thread* previous_thread = GetCurrentThread(); 149 Thread* previous_thread = GetCurrentThread();
150 150
@@ -304,14 +304,12 @@ void Thread::ResumeFromWait() {
304 break; 304 break;
305 case THREADSTATUS_RUNNING: 305 case THREADSTATUS_RUNNING:
306 case THREADSTATUS_READY: 306 case THREADSTATUS_READY:
307 LOG_ERROR(Kernel, "Thread with object id %u has already resumed.", GetObjectId()); 307 DEBUG_ASSERT_MSG(false, "Thread with object id %u has already resumed.", GetObjectId());
308 _dbg_assert_(Kernel, false);
309 return; 308 return;
310 case THREADSTATUS_DEAD: 309 case THREADSTATUS_DEAD:
311 // This should never happen, as threads must complete before being stopped. 310 // This should never happen, as threads must complete before being stopped.
312 LOG_CRITICAL(Kernel, "Thread with object id %u cannot be resumed because it's DEAD.", 311 DEBUG_ASSERT_MSG(false, "Thread with object id %u cannot be resumed because it's DEAD.",
313 GetObjectId()); 312 GetObjectId());
314 _dbg_assert_(Kernel, false);
315 return; 313 return;
316 } 314 }
317 315
@@ -387,7 +385,7 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point,
387// TODO(peachum): Remove this. Range checking should be done, and an appropriate error should be returned. 385// TODO(peachum): Remove this. Range checking should be done, and an appropriate error should be returned.
388static void ClampPriority(const Thread* thread, s32* priority) { 386static void ClampPriority(const Thread* thread, s32* priority) {
389 if (*priority < THREADPRIO_HIGHEST || *priority > THREADPRIO_LOWEST) { 387 if (*priority < THREADPRIO_HIGHEST || *priority > THREADPRIO_LOWEST) {
390 _dbg_assert_msg_(Kernel, false, "Application passed an out of range priority. An error should be returned."); 388 DEBUG_ASSERT_MSG(false, "Application passed an out of range priority. An error should be returned.");
391 389
392 s32 new_priority = CLAMP(*priority, THREADPRIO_HIGHEST, THREADPRIO_LOWEST); 390 s32 new_priority = CLAMP(*priority, THREADPRIO_HIGHEST, THREADPRIO_LOWEST);
393 LOG_WARNING(Kernel_SVC, "(name=%s): invalid priority=%d, clamping to %d", 391 LOG_WARNING(Kernel_SVC, "(name=%s): invalid priority=%d, clamping to %d",
@@ -425,7 +423,7 @@ SharedPtr<Thread> SetupIdleThread() {
425} 423}
426 424
427SharedPtr<Thread> SetupMainThread(u32 stack_size, u32 entry_point, s32 priority) { 425SharedPtr<Thread> SetupMainThread(u32 stack_size, u32 entry_point, s32 priority) {
428 _dbg_assert_(Kernel, !GetCurrentThread()); 426 DEBUG_ASSERT(!GetCurrentThread());
429 427
430 // Initialize new "main" thread 428 // Initialize new "main" thread
431 auto thread_res = Thread::Create("main", entry_point, priority, 0, 429 auto thread_res = Thread::Create("main", entry_point, priority, 0,