summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel
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
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')
-rw-r--r--src/core/hle/kernel/event.cpp2
-rw-r--r--src/core/hle/kernel/kernel.cpp4
-rw-r--r--src/core/hle/kernel/mutex.cpp2
-rw-r--r--src/core/hle/kernel/semaphore.cpp2
-rw-r--r--src/core/hle/kernel/session.h2
-rw-r--r--src/core/hle/kernel/thread.cpp14
-rw-r--r--src/core/hle/kernel/timer.cpp2
7 files changed, 13 insertions, 15 deletions
diff --git a/src/core/hle/kernel/event.cpp b/src/core/hle/kernel/event.cpp
index 898e1c98f..420906ec0 100644
--- a/src/core/hle/kernel/event.cpp
+++ b/src/core/hle/kernel/event.cpp
@@ -32,7 +32,7 @@ bool Event::ShouldWait() {
32} 32}
33 33
34void Event::Acquire() { 34void Event::Acquire() {
35 _assert_msg_(Kernel, !ShouldWait(), "object unavailable!"); 35 ASSERT_MSG(!ShouldWait(), "object unavailable!");
36 36
37 // Release the event if it's not sticky... 37 // Release the event if it's not sticky...
38 if (reset_type != RESETTYPE_STICKY) 38 if (reset_type != RESETTYPE_STICKY)
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index a2ffbcdb7..eb61d8ef3 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -52,7 +52,7 @@ void WaitObject::WakeupAllWaitingThreads() {
52 for (auto thread : waiting_threads_copy) 52 for (auto thread : waiting_threads_copy)
53 thread->ReleaseWaitObject(this); 53 thread->ReleaseWaitObject(this);
54 54
55 _assert_msg_(Kernel, waiting_threads.empty(), "failed to awaken all waiting threads!"); 55 ASSERT_MSG(waiting_threads.empty(), "failed to awaken all waiting threads!");
56} 56}
57 57
58HandleTable::HandleTable() { 58HandleTable::HandleTable() {
@@ -61,7 +61,7 @@ HandleTable::HandleTable() {
61} 61}
62 62
63ResultVal<Handle> HandleTable::Create(SharedPtr<Object> obj) { 63ResultVal<Handle> HandleTable::Create(SharedPtr<Object> obj) {
64 _dbg_assert_(Kernel, obj != nullptr); 64 DEBUG_ASSERT(obj != nullptr);
65 65
66 u16 slot = next_free_slot; 66 u16 slot = next_free_slot;
67 if (slot >= generations.size()) { 67 if (slot >= generations.size()) {
diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp
index a811db392..be2c49706 100644
--- a/src/core/hle/kernel/mutex.cpp
+++ b/src/core/hle/kernel/mutex.cpp
@@ -64,7 +64,7 @@ void Mutex::Acquire() {
64} 64}
65 65
66void Mutex::Acquire(SharedPtr<Thread> thread) { 66void Mutex::Acquire(SharedPtr<Thread> thread) {
67 _assert_msg_(Kernel, !ShouldWait(), "object unavailable!"); 67 ASSERT_MSG(!ShouldWait(), "object unavailable!");
68 68
69 // Actually "acquire" the mutex only if we don't already have it... 69 // Actually "acquire" the mutex only if we don't already have it...
70 if (lock_count == 0) { 70 if (lock_count == 0) {
diff --git a/src/core/hle/kernel/semaphore.cpp b/src/core/hle/kernel/semaphore.cpp
index c8cf8b9a2..6aecc24aa 100644
--- a/src/core/hle/kernel/semaphore.cpp
+++ b/src/core/hle/kernel/semaphore.cpp
@@ -36,7 +36,7 @@ bool Semaphore::ShouldWait() {
36} 36}
37 37
38void Semaphore::Acquire() { 38void Semaphore::Acquire() {
39 _assert_msg_(Kernel, !ShouldWait(), "object unavailable!"); 39 ASSERT_MSG(!ShouldWait(), "object unavailable!");
40 --available_count; 40 --available_count;
41} 41}
42 42
diff --git a/src/core/hle/kernel/session.h b/src/core/hle/kernel/session.h
index 7cc9332c9..9e9288e0f 100644
--- a/src/core/hle/kernel/session.h
+++ b/src/core/hle/kernel/session.h
@@ -66,7 +66,7 @@ public:
66 } 66 }
67 67
68 void Acquire() override { 68 void Acquire() override {
69 _assert_msg_(Kernel, !ShouldWait(), "object unavailable!"); 69 ASSERT_MSG(!ShouldWait(), "object unavailable!");
70 } 70 }
71}; 71};
72 72
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,
diff --git a/src/core/hle/kernel/timer.cpp b/src/core/hle/kernel/timer.cpp
index 4352fc99c..aa0afb796 100644
--- a/src/core/hle/kernel/timer.cpp
+++ b/src/core/hle/kernel/timer.cpp
@@ -38,7 +38,7 @@ bool Timer::ShouldWait() {
38} 38}
39 39
40void Timer::Acquire() { 40void Timer::Acquire() {
41 _assert_msg_(Kernel, !ShouldWait(), "object unavailable!"); 41 ASSERT_MSG( !ShouldWait(), "object unavailable!");
42} 42}
43 43
44void Timer::Set(s64 initial, s64 interval) { 44void Timer::Set(s64 initial, s64 interval) {