summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
authorarchshift <admin@archshift.com>2015-01-20 17:16:47 -0800
committerarchshift <admin@archshift.com>2015-02-10 18:30:31 -0800
commitef24e72b2618806f64345544fa46c84f3f494890 (patch)
treefca138e8377c4d66bd1fe026a3d2fef54a7f090c /src/core/hle/kernel
parent168eb27aee7992b8abf9f505b8c246a25fc8dca5 (diff)
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() {
}
void Event::Acquire() {
- _assert_msg_(Kernel, !ShouldWait(), "object unavailable!");
+ ASSERT_MSG(!ShouldWait(), "object unavailable!");
// Release the event if it's not sticky...
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() {
for (auto thread : waiting_threads_copy)
thread->ReleaseWaitObject(this);
- _assert_msg_(Kernel, waiting_threads.empty(), "failed to awaken all waiting threads!");
+ ASSERT_MSG(waiting_threads.empty(), "failed to awaken all waiting threads!");
}
HandleTable::HandleTable() {
@@ -61,7 +61,7 @@ HandleTable::HandleTable() {
}
ResultVal<Handle> HandleTable::Create(SharedPtr<Object> obj) {
- _dbg_assert_(Kernel, obj != nullptr);
+ DEBUG_ASSERT(obj != nullptr);
u16 slot = next_free_slot;
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() {
}
void Mutex::Acquire(SharedPtr<Thread> thread) {
- _assert_msg_(Kernel, !ShouldWait(), "object unavailable!");
+ ASSERT_MSG(!ShouldWait(), "object unavailable!");
// Actually "acquire" the mutex only if we don't already have it...
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() {
}
void Semaphore::Acquire() {
- _assert_msg_(Kernel, !ShouldWait(), "object unavailable!");
+ ASSERT_MSG(!ShouldWait(), "object unavailable!");
--available_count;
}
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:
}
void Acquire() override {
- _assert_msg_(Kernel, !ShouldWait(), "object unavailable!");
+ ASSERT_MSG(!ShouldWait(), "object unavailable!");
}
};
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() {
}
void Thread::Acquire() {
- _assert_msg_(Kernel, !ShouldWait(), "object unavailable!");
+ ASSERT_MSG(!ShouldWait(), "object unavailable!");
}
// Lists all thread ids that aren't deleted/etc.
@@ -144,7 +144,7 @@ void ArbitrateAllThreads(u32 address) {
* @param new_thread The thread to switch to
*/
static void SwitchContext(Thread* new_thread) {
- _dbg_assert_msg_(Kernel, new_thread->status == THREADSTATUS_READY, "Thread must be ready to become running.");
+ DEBUG_ASSERT_MSG(new_thread->status == THREADSTATUS_READY, "Thread must be ready to become running.");
Thread* previous_thread = GetCurrentThread();
@@ -304,14 +304,12 @@ void Thread::ResumeFromWait() {
break;
case THREADSTATUS_RUNNING:
case THREADSTATUS_READY:
- LOG_ERROR(Kernel, "Thread with object id %u has already resumed.", GetObjectId());
- _dbg_assert_(Kernel, false);
+ DEBUG_ASSERT_MSG(false, "Thread with object id %u has already resumed.", GetObjectId());
return;
case THREADSTATUS_DEAD:
// This should never happen, as threads must complete before being stopped.
- LOG_CRITICAL(Kernel, "Thread with object id %u cannot be resumed because it's DEAD.",
+ DEBUG_ASSERT_MSG(false, "Thread with object id %u cannot be resumed because it's DEAD.",
GetObjectId());
- _dbg_assert_(Kernel, false);
return;
}
@@ -387,7 +385,7 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point,
// 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) {
- _dbg_assert_msg_(Kernel, false, "Application passed an out of range priority. An error should be returned.");
+ DEBUG_ASSERT_MSG(false, "Application passed an out of range priority. An error should be returned.");
s32 new_priority = CLAMP(*priority, THREADPRIO_HIGHEST, THREADPRIO_LOWEST);
LOG_WARNING(Kernel_SVC, "(name=%s): invalid priority=%d, clamping to %d",
@@ -425,7 +423,7 @@ SharedPtr<Thread> SetupIdleThread() {
}
SharedPtr<Thread> SetupMainThread(u32 stack_size, u32 entry_point, s32 priority) {
- _dbg_assert_(Kernel, !GetCurrentThread());
+ DEBUG_ASSERT(!GetCurrentThread());
// Initialize new "main" thread
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() {
}
void Timer::Acquire() {
- _assert_msg_(Kernel, !ShouldWait(), "object unavailable!");
+ ASSERT_MSG( !ShouldWait(), "object unavailable!");
}
void Timer::Set(s64 initial, s64 interval) {