Index: kernel/generic/src/proc/scheduler.c
===================================================================
--- kernel/generic/src/proc/scheduler.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/proc/scheduler.c	(revision 9c2c7d2247cc1ad0410cd61ab534af9a246d328b)
@@ -39,4 +39,5 @@
  */
 
+#include <assert.h>
 #include <proc/scheduler.h>
 #include <proc/thread.h>
@@ -64,5 +65,4 @@
 #include <print.h>
 #include <log.h>
-#include <debug.h>
 #include <stacktrace.h>
 
@@ -200,5 +200,5 @@
 static thread_t *find_best_thread(void)
 {
-	ASSERT(CPU != NULL);
+	assert(CPU != NULL);
 	
 loop:
@@ -225,5 +225,5 @@
 	}
 
-	ASSERT(!CPU->idle);
+	assert(!CPU->idle);
 	
 	unsigned int i;
@@ -322,5 +322,5 @@
 	volatile ipl_t ipl;
 	
-	ASSERT(CPU != NULL);
+	assert(CPU != NULL);
 	
 	ipl = interrupts_disable();
@@ -403,7 +403,7 @@
 	as_t *old_as = AS;
 	
-	ASSERT((!THREAD) || (irq_spinlock_locked(&THREAD->lock)));
-	ASSERT(CPU != NULL);
-	ASSERT(interrupts_disabled());
+	assert((!THREAD) || (irq_spinlock_locked(&THREAD->lock)));
+	assert(CPU != NULL);
+	assert(interrupts_disabled());
 	
 	/*
Index: kernel/generic/src/proc/task.c
===================================================================
--- kernel/generic/src/proc/task.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/proc/task.c	(revision 9c2c7d2247cc1ad0410cd61ab534af9a246d328b)
@@ -36,4 +36,5 @@
  */
 
+#include <assert.h>
 #include <proc/thread.h>
 #include <proc/task.h>
@@ -419,6 +420,6 @@
 task_t *task_find_by_id(task_id_t id)
 {
-	ASSERT(interrupts_disabled());
-	ASSERT(irq_spinlock_locked(&tasks_lock));
+	assert(interrupts_disabled());
+	assert(irq_spinlock_locked(&tasks_lock));
 
 	avltree_node_t *node =
@@ -443,6 +444,6 @@
 void task_get_accounting(task_t *task, uint64_t *ucycles, uint64_t *kcycles)
 {
-	ASSERT(interrupts_disabled());
-	ASSERT(irq_spinlock_locked(&task->lock));
+	assert(interrupts_disabled());
+	assert(irq_spinlock_locked(&task->lock));
 
 	/* Accumulated values of task */
Index: kernel/generic/src/proc/the.c
===================================================================
--- kernel/generic/src/proc/the.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/proc/the.c	(revision 9c2c7d2247cc1ad0410cd61ab534af9a246d328b)
@@ -43,5 +43,5 @@
 
 #include <arch.h>
-#include <debug.h>
+#include <assert.h>
 
 /** Initialize THE structure
@@ -60,5 +60,5 @@
 	the->as = NULL;
 	the->magic = MAGIC;
-#ifdef RCU_PREEMPT_A	
+#ifdef RCU_PREEMPT_A
 	the->rcu_nesting = 0;
 #endif
@@ -75,5 +75,5 @@
 NO_TRACE void the_copy(the_t *src, the_t *dst)
 {
-	ASSERT(src->magic == MAGIC);
+	assert(src->magic == MAGIC);
 	*dst = *src;
 }
Index: kernel/generic/src/proc/thread.c
===================================================================
--- kernel/generic/src/proc/thread.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/proc/thread.c	(revision 9c2c7d2247cc1ad0410cd61ab534af9a246d328b)
@@ -36,4 +36,5 @@
  */
 
+#include <assert.h>
 #include <proc/scheduler.h>
 #include <proc/thread.h>
@@ -64,5 +65,4 @@
 #include <print.h>
 #include <mm/slab.h>
-#include <debug.h>
 #include <main/uinit.h>
 #include <syscall/copy.h>
@@ -268,5 +268,5 @@
 static void before_thread_is_ready(thread_t *thread)
 {
-	ASSERT(irq_spinlock_locked(&thread->lock));
+	assert(irq_spinlock_locked(&thread->lock));
 	workq_before_thread_is_ready(thread);
 }
@@ -283,5 +283,5 @@
 	irq_spinlock_lock(&thread->lock, true);
 	
-	ASSERT(thread->state != Ready);
+	assert(thread->state != Ready);
 
 	before_thread_is_ready(thread);
@@ -293,5 +293,5 @@
 	if (thread->wired || thread->nomigrate || thread->fpu_context_engaged) {
 		/* Cannot ready to another CPU */
-		ASSERT(thread->cpu != NULL);
+		assert(thread->cpu != NULL);
 		cpu = thread->cpu;
 	} else if (thread->stolen) {
@@ -300,5 +300,5 @@
 	} else if (thread->cpu) {
 		/* Prefer the CPU on which the thread ran last */
-		ASSERT(thread->cpu != NULL);
+		assert(thread->cpu != NULL);
 		cpu = thread->cpu;
 	} else {
@@ -431,8 +431,8 @@
 void thread_destroy(thread_t *thread, bool irq_res)
 {
-	ASSERT(irq_spinlock_locked(&thread->lock));
-	ASSERT((thread->state == Exiting) || (thread->state == Lingering));
-	ASSERT(thread->task);
-	ASSERT(thread->cpu);
+	assert(irq_spinlock_locked(&thread->lock));
+	assert((thread->state == Exiting) || (thread->state == Lingering));
+	assert(thread->task);
+	assert(thread->cpu);
 	
 	irq_spinlock_lock(&thread->cpu->lock, false);
@@ -561,5 +561,5 @@
 void thread_interrupt(thread_t *thread)
 {
-	ASSERT(thread != NULL);
+	assert(thread != NULL);
 	
 	irq_spinlock_lock(&thread->lock, true);
@@ -582,5 +582,5 @@
 bool thread_interrupted(thread_t *thread)
 {
-	ASSERT(thread != NULL);
+	assert(thread != NULL);
 	
 	bool interrupted;
@@ -596,5 +596,5 @@
 void thread_migration_disable(void)
 {
-	ASSERT(THREAD);
+	assert(THREAD);
 	
 	THREAD->nomigrate++;
@@ -604,6 +604,6 @@
 void thread_migration_enable(void)
 {
-	ASSERT(THREAD);
-	ASSERT(THREAD->nomigrate > 0);
+	assert(THREAD);
+	assert(THREAD->nomigrate > 0);
 	
 	if (THREAD->nomigrate > 0)
@@ -650,5 +650,5 @@
 	
 	irq_spinlock_lock(&thread->lock, true);
-	ASSERT(!thread->detached);
+	assert(!thread->detached);
 	irq_spinlock_unlock(&thread->lock, true);
 	
@@ -671,5 +671,5 @@
 	 */
 	irq_spinlock_lock(&thread->lock, true);
-	ASSERT(!thread->detached);
+	assert(!thread->detached);
 	
 	if (thread->state == Lingering) {
@@ -809,6 +809,6 @@
 bool thread_exists(thread_t *thread)
 {
-	ASSERT(interrupts_disabled());
-	ASSERT(irq_spinlock_locked(&threads_lock));
+	assert(interrupts_disabled());
+	assert(irq_spinlock_locked(&threads_lock));
 
 	avltree_node_t *node =
@@ -830,6 +830,6 @@
 	uint64_t time = get_cycle();
 
-	ASSERT(interrupts_disabled());
-	ASSERT(irq_spinlock_locked(&THREAD->lock));
+	assert(interrupts_disabled());
+	assert(irq_spinlock_locked(&THREAD->lock));
 	
 	if (user)
@@ -867,6 +867,6 @@
 thread_t *thread_find_by_id(thread_id_t thread_id)
 {
-	ASSERT(interrupts_disabled());
-	ASSERT(irq_spinlock_locked(&threads_lock));
+	assert(interrupts_disabled());
+	assert(irq_spinlock_locked(&threads_lock));
 	
 	thread_iterator_t iterator;
