Index: kernel/generic/src/adt/avl.c
===================================================================
--- kernel/generic/src/adt/avl.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/adt/avl.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -51,5 +51,5 @@
 
 #include <adt/avl.h>
-#include <debug.h>
+#include <assert.h>
 
 #define LEFT 	0
@@ -165,6 +165,6 @@
 	avltree_key_t key;
 
-	ASSERT(t);
-	ASSERT(newnode);
+	assert(t);
+	assert(newnode);
 
 	/*
@@ -259,5 +259,5 @@
 			 * LR rotation.
 			 */
-			ASSERT(par->balance == 1);
+			assert(par->balance == 1);
 			
 			REBALANCE_INSERT_LR();
@@ -274,5 +274,5 @@
 			 * RL rotation.
 			 */
-			ASSERT(par->balance == -1);
+			assert(par->balance == -1);
 		
 			REBALANCE_INSERT_RL();
@@ -322,5 +322,5 @@
 				*dir = LEFT;
 		} else {
-			ASSERT(u->par->rgt == v);
+			assert(u->par->rgt == v);
 			if (!ro)
 				u->par->rgt = w;
@@ -373,6 +373,6 @@
 	int dir;
 
-	ASSERT(t);
-	ASSERT(node);
+	assert(t);
+	assert(node);
 	
 	if (node->lft == NULL) {
Index: kernel/generic/src/adt/bitmap.c
===================================================================
--- kernel/generic/src/adt/bitmap.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/adt/bitmap.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -40,8 +40,8 @@
 
 #include <adt/bitmap.h>
+#include <align.h>
+#include <assert.h>
+#include <macros.h>
 #include <typedefs.h>
-#include <align.h>
-#include <debug.h>
-#include <macros.h>
 
 #define ALL_ONES    0xff
@@ -112,5 +112,5 @@
 void bitmap_set_range(bitmap_t *bitmap, size_t start, size_t count)
 {
-	ASSERT(start + count <= bitmap->elements);
+	assert(start + count <= bitmap->elements);
 	
 	if (count == 0)
@@ -166,5 +166,5 @@
 void bitmap_clear_range(bitmap_t *bitmap, size_t start, size_t count)
 {
-	ASSERT(start + count <= bitmap->elements);
+	assert(start + count <= bitmap->elements);
 	
 	if (count == 0)
@@ -222,6 +222,6 @@
 void bitmap_copy(bitmap_t *dst, bitmap_t *src, size_t count)
 {
-	ASSERT(count <= dst->elements);
-	ASSERT(count <= src->elements);
+	assert(count <= dst->elements);
+	assert(count <= src->elements);
 	
 	size_t i;
Index: kernel/generic/src/adt/btree.c
===================================================================
--- kernel/generic/src/adt/btree.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/adt/btree.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -49,6 +49,6 @@
 #include <adt/btree.h>
 #include <adt/list.h>
+#include <assert.h>
 #include <mm/slab.h>
-#include <debug.h>
 #include <panic.h>
 #include <print.h>
@@ -500,6 +500,6 @@
 	size_t j;
 	
-	ASSERT(median);
-	ASSERT(node->keys == BTREE_MAX_KEYS);
+	assert(median);
+	assert(node->keys == BTREE_MAX_KEYS);
 	
 	/*
@@ -625,5 +625,5 @@
 	btree_node_t *lnode;
 	
-	ASSERT(value);
+	assert(value);
 	
 	lnode = leaf_node;
@@ -725,5 +725,5 @@
 	size_t i;
 	
-	ASSERT(!ROOT_NODE(node));
+	assert(!ROOT_NODE(node));
 	
 	idx = find_key_by_subtree(node->parent, node, false);
@@ -837,5 +837,5 @@
 		
 		idx = find_key_by_subtree(parent, rnode, true);
-		ASSERT((int) idx != -1);
+		assert((int) idx != -1);
 		slab_free(btree_node_slab, rnode);
 		_btree_remove(t, parent->key[idx], parent);
@@ -951,5 +951,5 @@
 btree_node_t *btree_leaf_node_left_neighbour(btree_t *t, btree_node_t *node)
 {
-	ASSERT(LEAF_NODE(node));
+	assert(LEAF_NODE(node));
 	
 	if (node->leaf_link.prev != &t->leaf_list.head)
@@ -970,5 +970,5 @@
 btree_node_t *btree_leaf_node_right_neighbour(btree_t *t, btree_node_t *node)
 {
-	ASSERT(LEAF_NODE(node));
+	assert(LEAF_NODE(node));
 	
 	if (node->leaf_link.next != &t->leaf_list.head)
@@ -1002,9 +1002,9 @@
 		
 		hlp = list_first(&list);
-		ASSERT(hlp != NULL);
+		assert(hlp != NULL);
 		node = list_get_instance(hlp, btree_node_t, bfs_link);
 		list_remove(hlp);
 		
-		ASSERT(node);
+		assert(node);
 		
 		if (node->depth != depth) {
@@ -1032,5 +1032,5 @@
 	printf("Printing list of leaves:\n");
 	list_foreach(t->leaf_list, leaf_link, btree_node_t, node) {
-		ASSERT(node);
+		assert(node);
 		
 		printf("(");
Index: kernel/generic/src/adt/cht.c
===================================================================
--- kernel/generic/src/adt/cht.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/adt/cht.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -290,5 +290,5 @@
 #include <adt/cht.h>
 #include <adt/hash.h>
-#include <debug.h>
+#include <assert.h>
 #include <mm/slab.h>
 #include <arch/barrier.h>
@@ -522,9 +522,9 @@
 	bool can_block, cht_ops_t *op)
 {
-	ASSERT(h);
-	ASSERT(op && op->hash && op->key_hash && op->equal && op->key_equal);
+	assert(h);
+	assert(op && op->hash && op->key_hash && op->equal && op->key_equal);
 	/* Memoized hashes are stored in the rcu_link.func function pointer. */
-	STATIC_ASSERT(sizeof(size_t) == sizeof(rcu_func_t));
-	ASSERT(sentinel.hash == (uintptr_t)sentinel.rcu_link.func);
+	static_assert(sizeof(size_t) == sizeof(rcu_func_t), "");
+	assert(sentinel.hash == (uintptr_t)sentinel.rcu_link.func);
 
 	/* All operations are compulsory. */
@@ -625,5 +625,5 @@
 	
 	/* You must clear the table of items. Otherwise cht_destroy will leak. */
-	ASSERT(atomic_get(&h->item_cnt) == 0);
+	assert(atomic_get(&h->item_cnt) == 0);
 }
 
@@ -685,7 +685,7 @@
 static inline cht_link_t *find_lazy(cht_t *h, void *key)
 {
-	ASSERT(h);
+	assert(h);
 	/* See docs to cht_find() and cht_find_lazy(). */
-	ASSERT(rcu_read_locked());
+	assert(rcu_read_locked());
 	
 	size_t hash = calc_key_hash(h, key);
@@ -731,7 +731,7 @@
 cht_link_t *cht_find_next_lazy(cht_t *h, const cht_link_t *item)
 {
-	ASSERT(h);
-	ASSERT(rcu_read_locked());
-	ASSERT(item);
+	assert(h);
+	assert(rcu_read_locked());
+	assert(item);
 	
 	return find_duplicate(h, item, calc_node_hash(h, item), get_next(item->link));
@@ -755,5 +755,5 @@
 	do {
 		cur = get_next(prev);
-		ASSERT(cur);
+		assert(cur);
 		prev = cur->link;
 	} while (node_hash(h, cur) < search_hash);
@@ -770,5 +770,5 @@
 		
 		cur = get_next(cur->link);
-		ASSERT(cur);
+		assert(cur);
 	} 
 	
@@ -790,6 +790,6 @@
 	marked_ptr_t old_head, size_t old_idx)
 {
-	ASSERT(N_INVALID == get_mark(old_head)); 
-	ASSERT(h->new_b);
+	assert(N_INVALID == get_mark(old_head)); 
+	assert(h->new_b);
 	
 	size_t new_idx = calc_bucket_idx(hash, h->new_b->order);
@@ -903,5 +903,5 @@
 			 * traversing search_head.
 			 */
-			ASSERT(N_JOIN & get_mark(get_next(old_head)->link));
+			assert(N_JOIN & get_mark(get_next(old_head)->link));
 			return search_bucket(h, old_head, key, hash);
 		}
@@ -913,10 +913,10 @@
 		 * sure all cpus see that the new table replaced the old one.
 		 */
-		ASSERT(h->b->order == h->new_b->order);
+		assert(h->b->order == h->new_b->order);
 		/* 
 		 * The resizer must ensure all new bucket heads are visible before
 		 * replacing the old table.
 		 */
-		ASSERT(N_NORMAL == get_mark(new_head));
+		assert(N_NORMAL == get_mark(new_head));
 		return search_bucket(h, new_head, key, hash);
 	}
@@ -961,6 +961,6 @@
 bool cht_insert_unique(cht_t *h, cht_link_t *item, cht_link_t **dup_item)
 {
-	ASSERT(rcu_read_locked());
-	ASSERT(dup_item);
+	assert(rcu_read_locked());
+	assert(dup_item);
 	return insert_impl(h, item, dup_item);
 }
@@ -1060,5 +1060,5 @@
 		return ret == make_link(wnd->cur, jf_mark);
 	} else {
-		ASSERT(walk_mode == WM_LEAVE_JOIN);
+		assert(walk_mode == WM_LEAVE_JOIN);
 
 		item->link = make_link(wnd->cur, N_NORMAL);
@@ -1087,6 +1087,6 @@
 	cht_link_t *cur, cht_link_t **dup_item)
 {
-	ASSERT(cur);
-	ASSERT(cur == &sentinel || hash <= node_hash(h, cur)
+	assert(cur);
+	assert(cur == &sentinel || hash <= node_hash(h, cur)
 		|| node_hash(h, cur) == h->invalid_hash);
 	
@@ -1110,13 +1110,13 @@
 	cht_link_t *start)
 {
-	ASSERT(hash <= node_hash(h, start) || h->invalid_hash == node_hash(h, start));
+	assert(hash <= node_hash(h, start) || h->invalid_hash == node_hash(h, start));
 
 	cht_link_t *cur = start;
 	
 try_again:	
-	ASSERT(cur);
+	assert(cur);
 
 	while (node_hash(h, cur) == hash) {
-		ASSERT(cur != &sentinel);
+		assert(cur != &sentinel);
 		
 		bool deleted = (N_DELETED & get_mark(cur->link));
@@ -1127,5 +1127,5 @@
 		
 		cur = get_next(cur->link);
-		ASSERT(cur);
+		assert(cur);
 	} 
 
@@ -1142,5 +1142,5 @@
 size_t cht_remove_key(cht_t *h, void *key)
 {
-	ASSERT(h);
+	assert(h);
 	
 	size_t hash = calc_key_hash(h, key);
@@ -1163,8 +1163,8 @@
 bool cht_remove_item(cht_t *h, cht_link_t *item)
 {
-	ASSERT(h);
-	ASSERT(item);
+	assert(h);
+	assert(item);
 	/* Otherwise a concurrent cht_remove_key might free the item. */
-	ASSERT(rcu_read_locked());
+	assert(rcu_read_locked());
 
 	/* 
@@ -1262,5 +1262,5 @@
 	bool *deleted_but_gc, bool *resizing)
 {
-	ASSERT(wnd->cur && wnd->cur != &sentinel);
+	assert(wnd->cur && wnd->cur != &sentinel);
 	
 	*deleted_but_gc = false;
@@ -1292,5 +1292,5 @@
 	bool *resizing)
 {
-	ASSERT(cur && cur != &sentinel);
+	assert(cur && cur != &sentinel);
 	
 	/* 
@@ -1310,5 +1310,5 @@
 		}
 	} else {
-		STATIC_ASSERT(N_JOIN == N_JOIN_FOLLOWS);
+		static_assert(N_JOIN == N_JOIN_FOLLOWS, "");
 		
 		/* Keep the N_JOIN/N_JOIN_FOLLOWS mark but strip N_DELETED. */
@@ -1329,6 +1329,6 @@
 	bool *resizing)
 {
-	ASSERT(wnd->cur != &sentinel);
-	ASSERT(wnd->cur && (N_DELETED & get_mark(wnd->cur->link)));
+	assert(wnd->cur != &sentinel);
+	assert(wnd->cur && (N_DELETED & get_mark(wnd->cur->link)));
 	
 	cht_link_t *next = get_next(wnd->cur->link);
@@ -1336,5 +1336,5 @@
 	if (walk_mode == WM_LEAVE_JOIN) {
 		/* Never try to unlink join nodes. */
-		ASSERT(!(N_JOIN & get_mark(wnd->cur->link)));
+		assert(!(N_JOIN & get_mark(wnd->cur->link)));
 
 		mark_t pred_mark = get_mark(*wnd->ppred);
@@ -1348,5 +1348,5 @@
 			return false;
 	} else {
-		ASSERT(walk_mode == WM_MOVE_JOIN_FOLLOWS || walk_mode == WM_NORMAL);
+		assert(walk_mode == WM_MOVE_JOIN_FOLLOWS || walk_mode == WM_NORMAL);
 		/* Move the JF mark if set. Clear DEL mark. */
 		mark_t cur_mark = N_JOIN_FOLLOWS & get_mark(wnd->cur->link);
@@ -1398,5 +1398,5 @@
 	equal_pred_t pred, void *pred_arg, wnd_t *wnd, bool *resizing)
 {
-	ASSERT(wnd->cur);
+	assert(wnd->cur);
 	
 	if (wnd->cur == &sentinel)
@@ -1415,5 +1415,5 @@
 		
 	while (cur_hash <= hash) {
-		ASSERT(wnd->cur && wnd->cur != &sentinel);
+		assert(wnd->cur && wnd->cur != &sentinel);
 		
 		/* GC any deleted nodes on the way. */
@@ -1436,5 +1436,5 @@
 	if (cur_hash == h->invalid_hash) {
 		next_wnd(wnd);
-		ASSERT(wnd->cur);
+		assert(wnd->cur);
 		goto try_again;
 	}
@@ -1469,5 +1469,5 @@
 {
 try_again:
-	ASSERT(wnd->cur);
+	assert(wnd->cur);
 
 	while (node_hash(h, wnd->cur) < hash) {
@@ -1482,5 +1482,5 @@
 		}
 		
-		ASSERT(wnd->cur);
+		assert(wnd->cur);
 	}
 	
@@ -1498,5 +1498,5 @@
 	bool *resizing)
 {
-	ASSERT(N_DELETED & get_mark(wnd->cur->link));
+	assert(N_DELETED & get_mark(wnd->cur->link));
 
 	/* Skip deleted JOIN nodes. */
@@ -1505,5 +1505,5 @@
 	} else {
 		/* Ordinary deleted node or a deleted JOIN_FOLLOWS. */
-		ASSERT(walk_mode != WM_LEAVE_JOIN 
+		assert(walk_mode != WM_LEAVE_JOIN 
 			|| !((N_JOIN | N_JOIN_FOLLOWS) & get_mark(wnd->cur->link)));
 
@@ -1546,6 +1546,6 @@
 	 * it 
 	 */
-	ASSERT(h->b->order > h->new_b->order);
-	ASSERT(wnd->cur);
+	assert(h->b->order > h->new_b->order);
+	assert(wnd->cur);
 	
 	/* Either we did not need the joining link or we have already followed it.*/
@@ -1620,13 +1620,13 @@
 		/* The hash belongs to the moved bucket. */
 		if (move_dest_idx == new_idx) {
-			ASSERT(pmoved_head == pnew_head);
+			assert(pmoved_head == pnew_head);
 			/* 
 			 * move_head() makes the new head of the moved bucket visible. 
 			 * The new head may be marked with a JOIN_FOLLOWS
 			 */
-			ASSERT(!(N_CONST & get_mark(*pmoved_head)));
+			assert(!(N_CONST & get_mark(*pmoved_head)));
 			*walk_mode = WM_MOVE_JOIN_FOLLOWS;
 		} else {
-			ASSERT(pmoved_head != pnew_head);
+			assert(pmoved_head != pnew_head);
 			/* 
 			 * The hash belongs to the bucket that is the result of splitting 
@@ -1643,5 +1643,5 @@
 				 * JOIN_FOLLOWS in this part of split bucket.
 				 */
-				ASSERT(N_NORMAL == get_mark(*pnew_head));
+				assert(N_NORMAL == get_mark(*pnew_head));
 			}
 			
@@ -1675,7 +1675,7 @@
 		
 		/* move_head() or join_buckets() makes it so or makes the mark visible.*/
-		ASSERT(N_INVALID == get_mark(*pold_head));
+		assert(N_INVALID == get_mark(*pold_head));
 		/* move_head() makes it visible. No JOIN_FOLLOWS used when shrinking. */
-		ASSERT(N_NORMAL == get_mark(*pnew_head));
+		assert(N_NORMAL == get_mark(*pnew_head));
 
 		*walk_mode = WM_LEAVE_JOIN;
@@ -1685,5 +1685,5 @@
 		 * readers to notice that the old table had been replaced.
 		 */
-		ASSERT(b == h->new_b);
+		assert(b == h->new_b);
 		*walk_mode = WM_NORMAL;
 	}
@@ -1712,5 +1712,5 @@
 {
 	/* Head move has to in progress already when calling this func. */
-	ASSERT(N_CONST & get_mark(*psrc_head));
+	assert(N_CONST & get_mark(*psrc_head));
 	
 	/* Head already moved. */
@@ -1725,5 +1725,5 @@
 	}
 	
-	ASSERT(!(N_CONST & get_mark(*pdest_head)));
+	assert(!(N_CONST & get_mark(*pdest_head)));
 }
 
@@ -1756,6 +1756,6 @@
 static void complete_head_move(marked_ptr_t *psrc_head, marked_ptr_t *pdest_head)
 {
-	ASSERT(N_JOIN_FOLLOWS != get_mark(*psrc_head));
-	ASSERT(N_CONST & get_mark(*psrc_head));
+	assert(N_JOIN_FOLLOWS != get_mark(*psrc_head));
+	assert(N_CONST & get_mark(*psrc_head));
 	
 	cht_link_t *next = get_next(*psrc_head);
@@ -1763,10 +1763,10 @@
 	DBG(marked_ptr_t ret = )
 		cas_link(pdest_head, &sentinel, N_INVALID, next, N_NORMAL);
-	ASSERT(ret == make_link(&sentinel, N_INVALID) || (N_NORMAL == get_mark(ret)));
+	assert(ret == make_link(&sentinel, N_INVALID) || (N_NORMAL == get_mark(ret)));
 	cas_order_barrier();
 	
 	DBG(ret = ) 
 		cas_link(psrc_head, next, N_CONST, next, N_INVALID);	
-	ASSERT(ret == make_link(next, N_CONST) || (N_INVALID == get_mark(ret)));
+	assert(ret == make_link(next, N_CONST) || (N_INVALID == get_mark(ret)));
 	cas_order_barrier();
 }
@@ -1861,5 +1861,5 @@
 	DBG(marked_ptr_t ret = )
 		cas_link(pdest_head, &sentinel, N_INVALID, wnd.cur, N_NORMAL);
-	ASSERT(ret == make_link(&sentinel, N_INVALID) || (N_NORMAL == get_mark(ret)));
+	assert(ret == make_link(&sentinel, N_INVALID) || (N_NORMAL == get_mark(ret)));
 	cas_order_barrier();
 	
@@ -1905,5 +1905,5 @@
 		
 		/* Must not report that the table is resizing if WM_MOVE_JOIN_FOLLOWS.*/
-		ASSERT(!resizing);
+		assert(!resizing);
 		/* 
 		 * Mark the last node of the first half of the split bucket 
@@ -2042,5 +2042,5 @@
 	DBG(marked_ptr_t ret = )
 		cas_link(psrc_head, join_node, N_CONST, join_node, N_INVALID);
-	ASSERT(ret == make_link(join_node, N_CONST) || (N_INVALID == get_mark(ret)));
+	assert(ret == make_link(join_node, N_CONST) || (N_INVALID == get_mark(ret)));
 	cas_order_barrier();
 	
@@ -2073,9 +2073,9 @@
 			continue;
 
-		ASSERT(!resizing);
+		assert(!resizing);
 		
 		if (wnd.cur != &sentinel) {
 			/* Must be from the new appended bucket. */
-			ASSERT(split_hash <= node_hash(h, wnd.cur) 
+			assert(split_hash <= node_hash(h, wnd.cur) 
 				|| h->invalid_hash == node_hash(h, wnd.cur));
 			return;
@@ -2096,5 +2096,5 @@
 static void free_later(cht_t *h, cht_link_t *item)
 {
-	ASSERT(item != &sentinel);
+	assert(item != &sentinel);
 	
 	/* 
@@ -2156,8 +2156,8 @@
 	
 #ifdef CONFIG_DEBUG
-	ASSERT(h->b);
+	assert(h->b);
 	/* Make resize_reqs visible. */
 	read_barrier();
-	ASSERT(0 < atomic_get(&h->resize_reqs));
+	assert(0 < atomic_get(&h->resize_reqs));
 #endif
 
@@ -2336,5 +2336,5 @@
 		/* Set the invalid joinee head to NULL. */
 		if (old_idx != move_src_idx) {
-			ASSERT(N_INVALID == get_mark(h->b->head[old_idx]));
+			assert(N_INVALID == get_mark(h->b->head[old_idx]));
 			
 			if (&sentinel != get_next(h->b->head[old_idx]))
@@ -2392,6 +2392,6 @@
 	marked_ptr_t *new_head)
 {
-	ASSERT(join_node != &sentinel);
-	ASSERT(join_node && (N_JOIN & get_mark(join_node->link)));
+	assert(join_node != &sentinel);
+	assert(join_node && (N_JOIN & get_mark(join_node->link)));
 	
 	bool done;
@@ -2409,5 +2409,5 @@
 		/* Done if the mark was cleared. Retry if a new node was inserted. */
 		done = (ret == jn_link);
-		ASSERT(ret == jn_link || (get_mark(ret) & N_JOIN));
+		assert(ret == jn_link || (get_mark(ret) & N_JOIN));
 	} while (!done);
 	
@@ -2432,5 +2432,5 @@
 			join_node, &wnd, &resizing);
 		
-		ASSERT(!resizing);
+		assert(!resizing);
 	} while (!done);
 }
@@ -2439,5 +2439,5 @@
 static void cleanup_join_follows(cht_t *h, marked_ptr_t *new_head)
 {
-	ASSERT(new_head);
+	assert(new_head);
 	
 	rcu_read_lock();
@@ -2464,7 +2464,7 @@
 		/* GC any deleted nodes on the way - even deleted JOIN_FOLLOWS. */
 		if (N_DELETED & get_mark(*cur_link)) {
-			ASSERT(cur_link != new_head);
-			ASSERT(wnd.ppred && wnd.cur && wnd.cur != &sentinel);
-			ASSERT(cur_link == &wnd.cur->link);
+			assert(cur_link != new_head);
+			assert(wnd.ppred && wnd.cur && wnd.cur != &sentinel);
+			assert(cur_link == &wnd.cur->link);
 
 			bool dummy;
@@ -2484,5 +2484,5 @@
 					cas_link(cur_link, next, N_JOIN_FOLLOWS, &sentinel, N_NORMAL);
 				
-				ASSERT(next == &sentinel 
+				assert(next == &sentinel 
 					|| ((N_JOIN | N_JOIN_FOLLOWS) & get_mark(ret)));
 
@@ -2505,5 +2505,5 @@
 
 		/* We must encounter a JF node before we reach the end of the bucket. */
-		ASSERT(wnd.cur && wnd.cur != &sentinel);
+		assert(wnd.cur && wnd.cur != &sentinel);
 		cur_link = &wnd.cur->link;
 	}
@@ -2519,5 +2519,5 @@
 static inline size_t calc_split_hash(size_t split_idx, size_t order)
 {
-	ASSERT(1 <= order && order <= 8 * sizeof(size_t));
+	assert(1 <= order && order <= 8 * sizeof(size_t));
 	return split_idx << (8 * sizeof(size_t) - order);
 }
@@ -2526,5 +2526,5 @@
 static inline size_t calc_bucket_idx(size_t hash, size_t order)
 {
-	ASSERT(1 <= order && order <= 8 * sizeof(size_t));
+	assert(1 <= order && order <= 8 * sizeof(size_t));
 	return hash >> (8 * sizeof(size_t) - order);
 }
@@ -2558,5 +2558,5 @@
 static inline size_t node_hash(cht_t *h, const cht_link_t *item)
 {
-	ASSERT(item->hash == h->invalid_hash 
+	assert(item->hash == h->invalid_hash 
 		|| item->hash == sentinel.hash
 		|| item->hash == calc_node_hash(h, item));
@@ -2568,5 +2568,5 @@
 static inline size_t calc_node_hash(cht_t *h, const cht_link_t *item)
 {
-	ASSERT(item != &sentinel);
+	assert(item != &sentinel);
 	/* 
 	 * Clear the lowest order bit in order for sentinel's node hash
@@ -2587,6 +2587,6 @@
 	marked_ptr_t ptr = (marked_ptr_t) next;
 	
-	ASSERT(!(ptr & N_MARK_MASK));
-	ASSERT(!((unsigned)mark & ~N_MARK_MASK));
+	assert(!(ptr & N_MARK_MASK));
+	assert(!((unsigned)mark & ~N_MARK_MASK));
 	
 	return ptr | mark;
@@ -2608,6 +2608,6 @@
 static inline void next_wnd(wnd_t *wnd)
 {
-	ASSERT(wnd);
-	ASSERT(wnd->cur);
+	assert(wnd);
+	assert(wnd->cur);
 
 	wnd->last = wnd->cur;
@@ -2635,5 +2635,5 @@
 	marked_ptr_t new)
 {
-	ASSERT(link != &sentinel.link);
+	assert(link != &sentinel.link);
 	/*
 	 * cas(x) on the same location x on one cpu must be ordered, but do not
Index: kernel/generic/src/adt/hash_table.c
===================================================================
--- kernel/generic/src/adt/hash_table.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/adt/hash_table.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -40,6 +40,6 @@
 #include <adt/hash_table.h>
 #include <adt/list.h>
+#include <assert.h>
 #include <typedefs.h>
-#include <debug.h>
 #include <mm/slab.h>
 #include <mem.h>
@@ -56,9 +56,9 @@
 	size_t i;
 
-	ASSERT(h);
-	ASSERT(op);
-	ASSERT(op->hash);
-	ASSERT(op->compare);
-	ASSERT(max_keys > 0);
+	assert(h);
+	assert(op);
+	assert(op->hash);
+	assert(op->compare);
+	assert(max_keys > 0);
 	
 	h->entry = (list_t *) malloc(m * sizeof(list_t), 0);
@@ -86,12 +86,12 @@
 	size_t chain;
 	
-	ASSERT(item);
-	ASSERT(h);
-	ASSERT(h->op);
-	ASSERT(h->op->hash);
-	ASSERT(h->op->compare);
+	assert(item);
+	assert(h);
+	assert(h->op);
+	assert(h->op->hash);
+	assert(h->op->compare);
 	
 	chain = h->op->hash(key);
-	ASSERT(chain < h->entries);
+	assert(chain < h->entries);
 	
 	list_append(item, &h->entry[chain]);
@@ -109,11 +109,11 @@
 	size_t chain;
 	
-	ASSERT(h);
-	ASSERT(h->op);
-	ASSERT(h->op->hash);
-	ASSERT(h->op->compare);
+	assert(h);
+	assert(h->op);
+	assert(h->op->hash);
+	assert(h->op->compare);
 	
 	chain = h->op->hash(key);
-	ASSERT(chain < h->entries);
+	assert(chain < h->entries);
 	
 	link_t *cur = list_first(&h->entry[chain]);
@@ -143,9 +143,9 @@
 	size_t chain;
 	
-	ASSERT(h);
-	ASSERT(h->op);
-	ASSERT(h->op->hash);
-	ASSERT(h->op->compare);
-	ASSERT(keys <= h->max_keys);
+	assert(h);
+	assert(h->op);
+	assert(h->op->hash);
+	assert(h->op->compare);
+	assert(keys <= h->max_keys);
 	
 	
Index: kernel/generic/src/console/chardev.c
===================================================================
--- kernel/generic/src/console/chardev.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/console/chardev.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -33,4 +33,5 @@
  */
 
+#include <assert.h>
 #include <adt/list.h>
 #include <console/chardev.h>
@@ -66,5 +67,5 @@
 void indev_push_character(indev_t *indev, wchar_t ch)
 {
-	ASSERT(indev);
+	assert(indev);
 	
 	irq_spinlock_lock(&indev->lock, true);
Index: kernel/generic/src/console/cmd.c
===================================================================
--- kernel/generic/src/console/cmd.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/console/cmd.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -41,4 +41,5 @@
  */
 
+#include <assert.h>
 #include <console/cmd.h>
 #include <console/console.h>
@@ -54,5 +55,4 @@
 #include <str.h>
 #include <macros.h>
-#include <debug.h>
 #include <cpu.h>
 #include <mm/tlb.h>
@@ -917,5 +917,5 @@
 int cmd_uptime(cmd_arg_t *argv)
 {
-	ASSERT(uptime);
+	assert(uptime);
 	
 	/* This doesn't have to be very accurate */
Index: kernel/generic/src/console/console.c
===================================================================
--- kernel/generic/src/console/console.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/console/console.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -34,4 +34,5 @@
  */
 
+#include <assert.h>
 #include <console/console.h>
 #include <console/chardev.h>
@@ -189,5 +190,5 @@
 	void *faddr = (void *) KA2PA(kio);
 	
-	ASSERT((uintptr_t) faddr % FRAME_SIZE == 0);
+	assert((uintptr_t) faddr % FRAME_SIZE == 0);
 	
 	kio_parea.pbase = (uintptr_t) faddr;
Index: kernel/generic/src/console/kconsole.c
===================================================================
--- kernel/generic/src/console/kconsole.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/console/kconsole.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -39,4 +39,5 @@
  */
 
+#include <assert.h>
 #include <console/kconsole.h>
 #include <console/console.h>
@@ -633,6 +634,6 @@
     size_t *start, size_t *end)
 {
-	ASSERT(start != NULL);
-	ASSERT(end != NULL);
+	assert(start != NULL);
+	assert(end != NULL);
 	
 	bool found_start = false;
Index: kernel/generic/src/console/prompt.c
===================================================================
--- kernel/generic/src/console/prompt.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/console/prompt.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -37,4 +37,5 @@
  */
 
+#include <assert.h>
 #include <console/prompt.h>
 
@@ -49,6 +50,6 @@
 bool console_prompt_display_all_hints(indev_t *indev, size_t hints)
 {
-	ASSERT(indev);
-	ASSERT(hints > 0);
+	assert(indev);
+	assert(hints > 0);
 	
 	printf("Display all %zu possibilities? (y or n) ", hints);
@@ -81,6 +82,6 @@
 bool console_prompt_more_hints(indev_t *indev, size_t *display_hints)
 {
-	ASSERT(indev);
-	ASSERT(display_hints != NULL);
+	assert(indev);
+	assert(display_hints != NULL);
 	
 	printf("--More--");
Index: kernel/generic/src/cpu/cpu_mask.c
===================================================================
--- kernel/generic/src/cpu/cpu_mask.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/cpu/cpu_mask.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -35,4 +35,5 @@
  * @brief CPU mask manipulation functions.
  */
+#include <assert.h>
 #include <cpu/cpu_mask.h>
 #include <cpu.h>
@@ -52,6 +53,6 @@
 static void cpu_mask_count(cpu_mask_t *cpus, size_t cpu_cnt)
 {
-	ASSERT(NULL != cpus);
-	ASSERT(cpu_cnt <= config.cpu_count);
+	assert(NULL != cpus);
+	assert(cpu_cnt <= config.cpu_count);
 	
 	for (size_t active_word = 0; 
@@ -87,5 +88,5 @@
 void cpu_mask_none(cpu_mask_t *cpus)
 {
-	ASSERT(cpus);
+	assert(cpus);
 	
 	size_t word_cnt = cpu_mask_size() / word_size;
Index: kernel/generic/src/ddi/ddi.c
===================================================================
--- kernel/generic/src/ddi/ddi.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/ddi/ddi.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -40,4 +40,5 @@
  */
 
+#include <assert.h>
 #include <ddi/ddi.h>
 #include <proc/task.h>
@@ -106,5 +107,5 @@
     unsigned int flags, uintptr_t *virt, uintptr_t bound)
 {
-	ASSERT(TASK);
+	assert(TASK);
 	
 	if ((phys % FRAME_SIZE) != 0)
@@ -211,5 +212,5 @@
 NO_TRACE static int physmem_unmap(uintptr_t virt)
 {
-	ASSERT(TASK);
+	assert(TASK);
 
 	return as_area_destroy(TASK->as, virt);
@@ -368,5 +369,5 @@
     unsigned int flags, uintptr_t *phys)
 {
-	ASSERT(TASK);
+	assert(TASK);
 	
 	// TODO: implement locking of non-anonymous mapping
@@ -378,5 +379,5 @@
     uintptr_t *virt, uintptr_t bound)
 {
-	ASSERT(TASK);
+	assert(TASK);
 	
 	size_t frames = SIZE2FRAMES(size);
Index: kernel/generic/src/ddi/device.c
===================================================================
--- kernel/generic/src/ddi/device.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/ddi/device.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -35,4 +35,5 @@
  */
 
+#include <assert.h>
 #include <typedefs.h>
 #include <ddi/device.h>
@@ -49,5 +50,5 @@
 {
 	devno_t devno = (devno_t) atomic_postinc(&last);
-	ASSERT(devno >= 0);
+	assert(devno >= 0);
 	
 	return devno;
Index: kernel/generic/src/interrupt/interrupt.c
===================================================================
--- kernel/generic/src/interrupt/interrupt.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/interrupt/interrupt.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -40,6 +40,6 @@
  */
 
+#include <assert.h>
 #include <interrupt.h>
-#include <debug.h>
 #include <console/kconsole.h>
 #include <console/console.h>
@@ -76,5 +76,5 @@
 {
 #if (IVT_ITEMS > 0)
-	ASSERT(n < IVT_ITEMS);
+	assert(n < IVT_ITEMS);
 #endif
 	
@@ -102,5 +102,5 @@
 {
 #if (IVT_ITEMS > 0)
-	ASSERT(n < IVT_ITEMS);
+	assert(n < IVT_ITEMS);
 #endif
 	
Index: kernel/generic/src/ipc/event.c
===================================================================
--- kernel/generic/src/ipc/event.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/ipc/event.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -35,4 +35,5 @@
  */
 
+#include <assert.h>
 #include <ipc/event.h>
 #include <mm/slab.h>
@@ -59,5 +60,5 @@
 static event_t *evno2event(int evno, task_t *task)
 {
-	ASSERT(evno < EVENT_TASK_END);
+	assert(evno < EVENT_TASK_END);
 	
 	event_t *event;
@@ -123,5 +124,5 @@
 void event_set_unmask_callback(event_type_t evno, event_callback_t callback)
 {
-	ASSERT(evno < EVENT_END);
+	assert(evno < EVENT_END);
 	
 	_event_set_unmask_callback(evno2event(evno, NULL), callback);
@@ -131,6 +132,6 @@
     event_callback_t callback)
 {
-	ASSERT(evno >= (int) EVENT_END);
-	ASSERT(evno < EVENT_TASK_END);
+	assert(evno >= (int) EVENT_END);
+	assert(evno < EVENT_TASK_END);
 		
 	_event_set_unmask_callback(evno2event(evno, task), callback);
@@ -208,5 +209,5 @@
     sysarg_t a3, sysarg_t a4, sysarg_t a5)
 {
-	ASSERT(evno < EVENT_END);
+	assert(evno < EVENT_END);
 	
 	return event_enqueue(evno2event(evno, NULL), mask, a1, a2, a3, a4, a5);
@@ -236,6 +237,6 @@
     sysarg_t a1, sysarg_t a2, sysarg_t a3, sysarg_t a4, sysarg_t a5)
 {
-	ASSERT(evno >= (int) EVENT_END);
-	ASSERT(evno < EVENT_TASK_END);
+	assert(evno >= (int) EVENT_END);
+	assert(evno < EVENT_TASK_END);
 	
 	return event_enqueue(evno2event(evno, task), mask, a1, a2, a3, a4, a5);
Index: kernel/generic/src/ipc/ipc.c
===================================================================
--- kernel/generic/src/ipc/ipc.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/ipc/ipc.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -38,4 +38,5 @@
  */
 
+#include <assert.h>
 #include <synch/spinlock.h>
 #include <synch/mutex.h>
@@ -52,5 +53,4 @@
 #include <proc/task.h>
 #include <mem.h>
-#include <debug.h>
 #include <print.h>
 #include <console/console.h>
@@ -227,5 +227,5 @@
 		spinlock_lock(&TASK->active_calls_lock);
 
-		ASSERT(!request->forget);
+		assert(!request->forget);
 
 		bool answered = !request->active;
@@ -253,5 +253,5 @@
 		}
 	}
-	ASSERT(!answer || request == answer);
+	assert(!answer || request == answer);
 	
 	slab_free(ipc_answerbox_slab, mybox);
@@ -631,5 +631,5 @@
 		
 		/* Disconnect phone */
-		ASSERT(phone->state == IPC_PHONE_CONNECTED);
+		assert(phone->state == IPC_PHONE_CONNECTED);
 		
 		list_remove(&phone->link);
@@ -668,6 +668,6 @@
 static void ipc_forget_call(call_t *call)
 {
-	ASSERT(spinlock_locked(&TASK->active_calls_lock));
-	ASSERT(spinlock_locked(&call->forget_lock));
+	assert(spinlock_locked(&TASK->active_calls_lock));
+	assert(spinlock_locked(&call->forget_lock));
 
 	/*
@@ -789,5 +789,5 @@
 	call = ipc_wait_for_call(&TASK->answerbox, SYNCH_NO_TIMEOUT,
 	    SYNCH_FLAGS_NONE);
-	ASSERT(call->flags & (IPC_CALL_ANSWERED | IPC_CALL_NOTIF));
+	assert(call->flags & (IPC_CALL_ANSWERED | IPC_CALL_NOTIF));
 
 	SYSIPC_OP(answer_process, call);
Index: kernel/generic/src/ipc/ipcrsc.c
===================================================================
--- kernel/generic/src/ipc/ipcrsc.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/ipc/ipcrsc.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -131,5 +131,5 @@
 #include <proc/task.h>
 #include <ipc/ipcrsc.h>
-#include <debug.h>
+#include <assert.h>
 #include <abi/errno.h>
 
@@ -220,5 +220,5 @@
 static void phone_deallocp(phone_t *phone)
 {
-	ASSERT(phone->state == IPC_PHONE_CONNECTING);
+	assert(phone->state == IPC_PHONE_CONNECTING);
 	
 	/* Atomic operation */
@@ -253,5 +253,5 @@
 	phone_t *phone = &TASK->phones[phoneid];
 	
-	ASSERT(phone->state == IPC_PHONE_CONNECTING);
+	assert(phone->state == IPC_PHONE_CONNECTING);
 	return ipc_phone_connect(phone, box);
 }
Index: kernel/generic/src/ipc/irq.c
===================================================================
--- kernel/generic/src/ipc/irq.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/ipc/irq.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -72,4 +72,5 @@
 
 #include <arch.h>
+#include <assert.h>
 #include <mm/slab.h>
 #include <mm/page.h>
@@ -399,5 +400,5 @@
 	irq_spinlock_lock(&box->irq_lock, false);
 	
-	ASSERT(irq->notif_cfg.answerbox == box);
+	assert(irq->notif_cfg.answerbox == box);
 	
 	/* Remove the IRQ from the answerbox's list. */
@@ -463,5 +464,5 @@
 		key[1] = irq->devno;
 		
-		ASSERT(irq->notif_cfg.answerbox == box);
+		assert(irq->notif_cfg.answerbox == box);
 		
 		/* Unlist from the answerbox. */
@@ -607,8 +608,8 @@
 void ipc_irq_top_half_handler(irq_t *irq)
 {
-	ASSERT(irq);
-	
-	ASSERT(interrupts_disabled());
-	ASSERT(irq_spinlock_locked(&irq->lock));
+	assert(irq);
+	
+	assert(interrupts_disabled());
+	assert(irq_spinlock_locked(&irq->lock));
 	
 	if (irq->notif_cfg.answerbox) {
Index: kernel/generic/src/ipc/ops/dataread.c
===================================================================
--- kernel/generic/src/ipc/ops/dataread.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/ipc/ops/dataread.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -33,4 +33,5 @@
  */
 
+#include <assert.h>
 #include <ipc/sysipc_ops.h>
 #include <ipc/ipc.h>
@@ -58,5 +59,5 @@
 static int answer_preprocess(call_t *answer, ipc_data_t *olddata)
 {
-	ASSERT(!answer->buffer);
+	assert(!answer->buffer);
 
 	if (!IPC_GET_RETVAL(answer->data)) {
Index: kernel/generic/src/ipc/ops/datawrite.c
===================================================================
--- kernel/generic/src/ipc/ops/datawrite.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/ipc/ops/datawrite.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -33,4 +33,5 @@
  */
 
+#include <assert.h>
 #include <ipc/sysipc_ops.h>
 #include <ipc/ipc.h>
@@ -70,5 +71,5 @@
 static int answer_preprocess(call_t *answer, ipc_data_t *olddata)
 {
-	ASSERT(answer->buffer);
+	assert(answer->buffer);
 
 	if (!IPC_GET_RETVAL(answer->data)) {
Index: kernel/generic/src/ipc/sysipc.c
===================================================================
--- kernel/generic/src/ipc/sysipc.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/ipc/sysipc.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -34,4 +34,5 @@
 
 #include <arch.h>
+#include <assert.h>
 #include <errno.h>
 #include <mem.h>
@@ -174,5 +175,5 @@
 		return rc;
 	} else {
-		ASSERT(answer->active);
+		assert(answer->active);
 
 		/*
@@ -313,5 +314,5 @@
 				 * We are no longer expected to free it.
 				 */
-				ASSERT(rc == EINTR);
+				assert(rc == EINTR);
 			}
 			return rc;	
Index: kernel/generic/src/lib/elf.c
===================================================================
--- kernel/generic/src/lib/elf.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/lib/elf.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -37,6 +37,6 @@
  */
 
+#include <assert.h>
 #include <lib/elf.h>
-#include <debug.h>
 #include <typedefs.h>
 #include <mm/as.h>
@@ -138,5 +138,5 @@
 const char *elf_error(unsigned int rc)
 {
-	ASSERT(rc < sizeof(error_codes) / sizeof(char *));
+	assert(rc < sizeof(error_codes) / sizeof(char *));
 	
 	return error_codes[rc];
Index: kernel/generic/src/lib/ra.c
===================================================================
--- kernel/generic/src/lib/ra.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/lib/ra.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -43,9 +43,9 @@
  */
 
+#include <assert.h>
 #include <lib/ra.h>
 #include <typedefs.h>
 #include <mm/slab.h>
 #include <bitops.h>
-#include <debug.h>
 #include <panic.h>
 #include <adt/list.h>
@@ -241,5 +241,5 @@
 		    ra_segment_t, fu_link);
 
-		ASSERT(seg->flags & RA_SEGMENT_FREE);
+		assert(seg->flags & RA_SEGMENT_FREE);
 
 		/*
@@ -259,5 +259,5 @@
 		newbase = ALIGN_UP(seg->base, align);
 		if (newbase + size != seg->base + ra_segment_size_get(seg)) {
-			ASSERT(newbase + (size - 1) < seg->base +
+			assert(newbase + (size - 1) < seg->base +
 			    (ra_segment_size_get(seg) - 1));
 			succ = ra_segment_create(newbase + size);
@@ -331,7 +331,7 @@
 	hash_table_remove(&span->used, &key, 1);
 
-	ASSERT(!(seg->flags & RA_SEGMENT_FREE));
-	ASSERT(seg->base == base);
-	ASSERT(ra_segment_size_get(seg) == size);
+	assert(!(seg->flags & RA_SEGMENT_FREE));
+	assert(seg->base == base);
+	assert(ra_segment_size_get(seg) == size);
 
 	/*
@@ -342,5 +342,5 @@
 		    ra_segment_t, segment_link);
 
-		ASSERT(pred->base < seg->base);
+		assert(pred->base < seg->base);
 
 		if (pred->flags & RA_SEGMENT_FREE) {
@@ -363,5 +363,5 @@
 	succ = hash_table_get_instance(seg->segment_link.next, ra_segment_t,
 	    segment_link);
-	ASSERT(succ->base > seg->base);
+	assert(succ->base > seg->base);
 	if (succ->flags & RA_SEGMENT_FREE) {
 		/*
@@ -386,7 +386,7 @@
 	uintptr_t base = 0;
 
-	ASSERT(size >= 1);
-	ASSERT(alignment >= 1);
-	ASSERT(ispwr2(alignment));
+	assert(size >= 1);
+	assert(alignment >= 1);
+	assert(ispwr2(alignment));
 
 	irq_spinlock_lock(&arena->lock, true);
Index: kernel/generic/src/lib/rd.c
===================================================================
--- kernel/generic/src/lib/rd.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/lib/rd.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -38,4 +38,5 @@
  */
 
+#include <assert.h>
 #include <log.h>
 #include <lib/rd.h>
@@ -56,5 +57,5 @@
 {
 	uintptr_t base = (uintptr_t) data;
-	ASSERT((base % FRAME_SIZE) == 0);
+	assert((base % FRAME_SIZE) == 0);
 	
 	rd_parea.pbase = base;
Index: kernel/generic/src/lib/str.c
===================================================================
--- kernel/generic/src/lib/str.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/lib/str.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -109,5 +109,5 @@
 #include <errno.h>
 #include <align.h>
-#include <debug.h>
+#include <assert.h>
 #include <macros.h>
 #include <mm/slab.h>
@@ -567,6 +567,6 @@
 {
 	/* There must be space for a null terminator in the buffer. */
-	ASSERT(size > 0);
-	ASSERT(src != NULL);
+	assert(size > 0);
+	assert(src != NULL);
 	
 	size_t src_off = 0;
@@ -601,5 +601,5 @@
 {
 	/* There must be space for a null terminator in the buffer. */
-	ASSERT(size > 0);
+	assert(size > 0);
 	
 	size_t src_off = 0;
@@ -635,5 +635,5 @@
 	size_t size = str_size(src) + 1;
 	char *dest = malloc(size, 0);
-	ASSERT(dest);
+	assert(dest);
 	
 	str_cpy(dest, size, src);
@@ -668,5 +668,5 @@
 	
 	char *dest = malloc(size + 1, 0);
-	ASSERT(dest);
+	assert(dest);
 	
 	str_ncpy(dest, size + 1, src, size);
@@ -691,5 +691,5 @@
 
 	/* There must be space for a null terminator in the buffer. */
-	ASSERT(size > 0);
+	assert(size > 0);
 
 	src_idx = 0;
@@ -797,7 +797,7 @@
     bool *neg, uint64_t *result)
 {
-	ASSERT(endptr != NULL);
-	ASSERT(neg != NULL);
-	ASSERT(result != NULL);
+	assert(endptr != NULL);
+	assert(neg != NULL);
+	assert(result != NULL);
 	
 	*neg = false;
@@ -918,5 +918,5 @@
     bool strict, uint64_t *result)
 {
-	ASSERT(result != NULL);
+	assert(result != NULL);
 	
 	bool neg;
Index: kernel/generic/src/main/kinit.c
===================================================================
--- kernel/generic/src/main/kinit.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/main/kinit.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -42,4 +42,5 @@
  */
 
+#include <assert.h>
 #include <main/kinit.h>
 #include <config.h>
@@ -67,5 +68,4 @@
 #include <lib/rd.h>
 #include <ipc/ipc.h>
-#include <debug.h>
 #include <str.h>
 #include <sysinfo/stats.h>
@@ -240,5 +240,5 @@
 			name = "<unknown>";
 		
-		STATIC_ASSERT(TASK_NAME_BUFLEN >= INIT_PREFIX_LEN);
+		static_assert(TASK_NAME_BUFLEN >= INIT_PREFIX_LEN, "");
 		str_cpy(namebuf, TASK_NAME_BUFLEN, INIT_PREFIX);
 		str_cpy(namebuf + INIT_PREFIX_LEN,
@@ -251,5 +251,5 @@
 		    init.tasks[i].size,
 		    PAGE_READ | PAGE_WRITE | PAGE_CACHEABLE);
-		ASSERT(page);
+		assert(page);
 		
 		int rc = program_create_from_image((void *) page, namebuf,
Index: kernel/generic/src/main/main.c
===================================================================
--- kernel/generic/src/main/main.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/main/main.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -48,8 +48,9 @@
 
 #include <arch/asm.h>
+#include <debug.h>
 #include <context.h>
 #include <print.h>
 #include <panic.h>
-#include <debug.h>
+#include <assert.h>
 #include <config.h>
 #include <time/clock.h>
@@ -98,5 +99,5 @@
  */
 #define CHECK_INT_TYPE_(signness, size) \
-	STATIC_ASSERT_VERBOSE(sizeof(signness##size##_t) * 8 == size, \
+	static_assert(sizeof(signness##size##_t) * 8 == size, \
 	    #signness #size "_t does not have " #size " bits");
 
Index: kernel/generic/src/mm/as.c
===================================================================
--- kernel/generic/src/mm/as.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/mm/as.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -67,5 +67,5 @@
 #include <arch/asm.h>
 #include <panic.h>
-#include <debug.h>
+#include <assert.h>
 #include <print.h>
 #include <mem.h>
@@ -189,6 +189,6 @@
 	DEADLOCK_PROBE_INIT(p_asidlock);
 	
-	ASSERT(as != AS);
-	ASSERT(atomic_get(&as->refcount) == 0);
+	assert(as != AS);
+	assert(atomic_get(&as->refcount) == 0);
 	
 	/*
@@ -236,5 +236,5 @@
 	bool cond = true;
 	while (cond) {
-		ASSERT(!list_empty(&as->as_area_btree.leaf_list));
+		assert(!list_empty(&as->as_area_btree.leaf_list));
 		
 		btree_node_t *node =
@@ -298,6 +298,6 @@
     size_t count, bool guarded, as_area_t *avoid)
 {
-	ASSERT((addr % PAGE_SIZE) == 0);
-	ASSERT(mutex_locked(&as->lock));
+	assert((addr % PAGE_SIZE) == 0);
+	assert(mutex_locked(&as->lock));
 
 	/*
@@ -455,5 +455,5 @@
     size_t size, bool guarded)
 {
-	ASSERT(mutex_locked(&as->lock));
+	assert(mutex_locked(&as->lock));
 	
 	if (size == 0)
@@ -532,5 +532,5 @@
 	
 	mutex_lock(&sh_info->lock);
-	ASSERT(sh_info->refcount);
+	assert(sh_info->refcount);
 	
 	if (--sh_info->refcount == 0) {
@@ -696,5 +696,5 @@
 NO_TRACE static as_area_t *find_area_and_lock(as_t *as, uintptr_t va)
 {
-	ASSERT(mutex_locked(&as->lock));
+	assert(mutex_locked(&as->lock));
 	
 	btree_node_t *leaf;
@@ -827,5 +827,5 @@
 		bool cond = true;
 		while (cond) {
-			ASSERT(!list_empty(&area->used_space.leaf_list));
+			assert(!list_empty(&area->used_space.leaf_list));
 			
 			btree_node_t *node =
@@ -893,7 +893,7 @@
 					    ptr + P2SZ(i), false, &pte);
 					
-					ASSERT(found);
-					ASSERT(PTE_VALID(&pte));
-					ASSERT(PTE_PRESENT(&pte));
+					assert(found);
+					assert(PTE_VALID(&pte));
+					assert(PTE_PRESENT(&pte));
 					
 					if ((area->backend) &&
@@ -1008,7 +1008,7 @@
 				     ptr + P2SZ(size), false, &pte);
 				
-				ASSERT(found);
-				ASSERT(PTE_VALID(&pte));
-				ASSERT(PTE_PRESENT(&pte));
+				assert(found);
+				assert(PTE_VALID(&pte));
+				assert(PTE_PRESENT(&pte));
 				
 				if ((area->backend) &&
@@ -1194,5 +1194,5 @@
 NO_TRACE bool as_area_check_access(as_area_t *area, pf_access_t access)
 {
-	ASSERT(mutex_locked(&area->lock));
+	assert(mutex_locked(&area->lock));
 	
 	int flagmap[] = {
@@ -1321,7 +1321,7 @@
 				    ptr + P2SZ(size), false, &pte);
 				
-				ASSERT(found);
-				ASSERT(PTE_VALID(&pte));
-				ASSERT(PTE_PRESENT(&pte));
+				assert(found);
+				assert(PTE_VALID(&pte));
+				assert(PTE_PRESENT(&pte));
 				
 				old_frame[frame_idx++] = PTE_GET_FRAME(&pte);
@@ -1541,5 +1541,5 @@
 	 */
 	if (old_as) {
-		ASSERT(old_as->cpu_refcount);
+		assert(old_as->cpu_refcount);
 		
 		if ((--old_as->cpu_refcount == 0) && (old_as != AS_KERNEL)) {
@@ -1550,5 +1550,5 @@
 			 * ASID.
 			 */
-			ASSERT(old_as->asid != ASID_INVALID);
+			assert(old_as->asid != ASID_INVALID);
 			
 			list_append(&old_as->inactive_as_with_asid_link,
@@ -1597,5 +1597,5 @@
 NO_TRACE unsigned int as_area_get_flags(as_area_t *area)
 {
-	ASSERT(mutex_locked(&area->lock));
+	assert(mutex_locked(&area->lock));
 	
 	return area_flags_to_page_flags(area->flags);
@@ -1615,6 +1615,6 @@
 NO_TRACE pte_t *page_table_create(unsigned int flags)
 {
-	ASSERT(as_operations);
-	ASSERT(as_operations->page_table_create);
+	assert(as_operations);
+	assert(as_operations->page_table_create);
 	
 	return as_operations->page_table_create(flags);
@@ -1630,6 +1630,6 @@
 NO_TRACE void page_table_destroy(pte_t *page_table)
 {
-	ASSERT(as_operations);
-	ASSERT(as_operations->page_table_destroy);
+	assert(as_operations);
+	assert(as_operations->page_table_destroy);
 	
 	as_operations->page_table_destroy(page_table);
@@ -1651,6 +1651,6 @@
 NO_TRACE void page_table_lock(as_t *as, bool lock)
 {
-	ASSERT(as_operations);
-	ASSERT(as_operations->page_table_lock);
+	assert(as_operations);
+	assert(as_operations->page_table_lock);
 	
 	as_operations->page_table_lock(as, lock);
@@ -1665,6 +1665,6 @@
 NO_TRACE void page_table_unlock(as_t *as, bool unlock)
 {
-	ASSERT(as_operations);
-	ASSERT(as_operations->page_table_unlock);
+	assert(as_operations);
+	assert(as_operations->page_table_unlock);
 	
 	as_operations->page_table_unlock(as, unlock);
@@ -1680,6 +1680,6 @@
 NO_TRACE bool page_table_locked(as_t *as)
 {
-	ASSERT(as_operations);
-	ASSERT(as_operations->page_table_locked);
+	assert(as_operations);
+	assert(as_operations->page_table_locked);
 
 	return as_operations->page_table_locked(as);
@@ -1724,7 +1724,7 @@
 bool used_space_insert(as_area_t *area, uintptr_t page, size_t count)
 {
-	ASSERT(mutex_locked(&area->lock));
-	ASSERT(IS_ALIGNED(page, PAGE_SIZE));
-	ASSERT(count);
+	assert(mutex_locked(&area->lock));
+	assert(IS_ALIGNED(page, PAGE_SIZE));
+	assert(count);
 	
 	btree_node_t *leaf = NULL;
@@ -1737,5 +1737,5 @@
 	}
 
-	ASSERT(leaf != NULL);
+	assert(leaf != NULL);
 	
 	if (!leaf->keys) {
@@ -2010,7 +2010,7 @@
 bool used_space_remove(as_area_t *area, uintptr_t page, size_t count)
 {
-	ASSERT(mutex_locked(&area->lock));
-	ASSERT(IS_ALIGNED(page, PAGE_SIZE));
-	ASSERT(count);
+	assert(mutex_locked(&area->lock));
+	assert(IS_ALIGNED(page, PAGE_SIZE));
+	assert(count);
 	
 	btree_node_t *leaf;
@@ -2257,5 +2257,5 @@
 			as_area_t *area = node->value[i];
 			
-			ASSERT(area_idx < area_cnt);
+			assert(area_idx < area_cnt);
 			mutex_lock(&area->lock);
 			
Index: kernel/generic/src/mm/backend_anon.c
===================================================================
--- kernel/generic/src/mm/backend_anon.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/mm/backend_anon.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -37,4 +37,5 @@
  */
 
+#include <assert.h>
 #include <mm/as.h>
 #include <mm/page.h>
@@ -113,7 +114,7 @@
 void anon_share(as_area_t *area)
 {
-	ASSERT(mutex_locked(&area->as->lock));
-	ASSERT(mutex_locked(&area->lock));
-	ASSERT(!(area->flags & AS_AREA_LATE_RESERVE));
+	assert(mutex_locked(&area->as->lock));
+	assert(mutex_locked(&area->lock));
+	assert(!(area->flags & AS_AREA_LATE_RESERVE));
 
 	/*
@@ -138,7 +139,7 @@
 				    base + P2SZ(j), false, &pte);
 
-				ASSERT(found);
-				ASSERT(PTE_VALID(&pte));
-				ASSERT(PTE_PRESENT(&pte));
+				assert(found);
+				assert(PTE_VALID(&pte));
+				assert(PTE_PRESENT(&pte));
 
 				btree_insert(&area->sh_info->pagemap,
@@ -190,7 +191,7 @@
 	uintptr_t frame;
 
-	ASSERT(page_table_locked(AS));
-	ASSERT(mutex_locked(&area->lock));
-	ASSERT(IS_ALIGNED(upage, PAGE_SIZE));
+	assert(page_table_locked(AS));
+	assert(mutex_locked(&area->lock));
+	assert(IS_ALIGNED(upage, PAGE_SIZE));
 
 	if (!as_area_check_access(area, access))
@@ -294,6 +295,6 @@
 void anon_frame_free(as_area_t *area, uintptr_t page, uintptr_t frame)
 {
-	ASSERT(page_table_locked(area->as));
-	ASSERT(mutex_locked(&area->lock));
+	assert(page_table_locked(area->as));
+	assert(mutex_locked(&area->lock));
 
 	if (area->flags & AS_AREA_LATE_RESERVE) {
Index: kernel/generic/src/mm/backend_elf.c
===================================================================
--- kernel/generic/src/mm/backend_elf.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/mm/backend_elf.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -37,5 +37,5 @@
 
 #include <lib/elf.h>
-#include <debug.h>
+#include <assert.h>
 #include <typedefs.h>
 #include <mm/as.h>
@@ -142,6 +142,6 @@
 	uintptr_t start_anon = entry->p_vaddr + entry->p_filesz;
 
-	ASSERT(mutex_locked(&area->as->lock));
-	ASSERT(mutex_locked(&area->lock));
+	assert(mutex_locked(&area->as->lock));
+	assert(mutex_locked(&area->lock));
 
 	/*
@@ -200,7 +200,7 @@
 				    base + P2SZ(j), false, &pte);
 
-				ASSERT(found);
-				ASSERT(PTE_VALID(&pte));
-				ASSERT(PTE_PRESENT(&pte));
+				assert(found);
+				assert(PTE_VALID(&pte));
+				assert(PTE_PRESENT(&pte));
 
 				btree_insert(&area->sh_info->pagemap,
@@ -261,7 +261,7 @@
 	bool dirty = false;
 
-	ASSERT(page_table_locked(AS));
-	ASSERT(mutex_locked(&area->lock));
-	ASSERT(IS_ALIGNED(upage, PAGE_SIZE));
+	assert(page_table_locked(AS));
+	assert(mutex_locked(&area->lock));
+	assert(IS_ALIGNED(upage, PAGE_SIZE));
 
 	if (!as_area_check_access(area, access))
@@ -345,6 +345,6 @@
 			    base + i * FRAME_SIZE, true, &pte);
 
-			ASSERT(found);
-			ASSERT(PTE_PRESENT(&pte));
+			assert(found);
+			assert(PTE_PRESENT(&pte));
 
 			frame = PTE_GET_FRAME(&pte);
@@ -424,9 +424,9 @@
 	uintptr_t start_anon;
 
-	ASSERT(page_table_locked(area->as));
-	ASSERT(mutex_locked(&area->lock));
-
-	ASSERT(page >= ALIGN_DOWN(entry->p_vaddr, PAGE_SIZE));
-	ASSERT(page < entry->p_vaddr + entry->p_memsz);
+	assert(page_table_locked(area->as));
+	assert(mutex_locked(&area->lock));
+
+	assert(page >= ALIGN_DOWN(entry->p_vaddr, PAGE_SIZE));
+	assert(page < entry->p_vaddr + entry->p_memsz);
 
 	start_anon = entry->p_vaddr + entry->p_filesz;
Index: kernel/generic/src/mm/backend_phys.c
===================================================================
--- kernel/generic/src/mm/backend_phys.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/mm/backend_phys.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -37,5 +37,5 @@
  */
 
-#include <debug.h>
+#include <assert.h>
 #include <typedefs.h>
 #include <mm/as.h>
@@ -95,6 +95,6 @@
 void phys_share(as_area_t *area)
 {
-	ASSERT(mutex_locked(&area->as->lock));
-	ASSERT(mutex_locked(&area->lock));
+	assert(mutex_locked(&area->as->lock));
+	assert(mutex_locked(&area->lock));
 }
 
@@ -135,12 +135,12 @@
 	uintptr_t base = area->backend_data.base;
 
-	ASSERT(page_table_locked(AS));
-	ASSERT(mutex_locked(&area->lock));
-	ASSERT(IS_ALIGNED(upage, PAGE_SIZE));
+	assert(page_table_locked(AS));
+	assert(mutex_locked(&area->lock));
+	assert(IS_ALIGNED(upage, PAGE_SIZE));
 
 	if (!as_area_check_access(area, access))
 		return AS_PF_FAULT;
 
-	ASSERT(upage - area->base < area->backend_data.frames * FRAME_SIZE);
+	assert(upage - area->base < area->backend_data.frames * FRAME_SIZE);
 	page_mapping_insert(AS, upage, base + (upage - area->base),
 	    as_area_get_flags(area));
Index: kernel/generic/src/mm/backend_user.c
===================================================================
--- kernel/generic/src/mm/backend_user.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/mm/backend_user.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -46,5 +46,5 @@
 #include <typedefs.h>
 #include <align.h>
-#include <debug.h>
+#include <assert.h>
 #include <errno.h>
 #include <log.h>
@@ -108,7 +108,7 @@
 int user_page_fault(as_area_t *area, uintptr_t upage, pf_access_t access)
 {
-	ASSERT(page_table_locked(AS));
-	ASSERT(mutex_locked(&area->lock));
-	ASSERT(IS_ALIGNED(upage, PAGE_SIZE));
+	assert(page_table_locked(AS));
+	assert(mutex_locked(&area->lock));
+	assert(IS_ALIGNED(upage, PAGE_SIZE));
 
 	if (!as_area_check_access(area, access))
@@ -162,6 +162,6 @@
 void user_frame_free(as_area_t *area, uintptr_t page, uintptr_t frame)
 {
-	ASSERT(page_table_locked(area->as));
-	ASSERT(mutex_locked(&area->lock));
+	assert(page_table_locked(area->as));
+	assert(mutex_locked(&area->lock));
 
 	pfn_t pfn = ADDR2PFN(frame);
Index: kernel/generic/src/mm/frame.c
===================================================================
--- kernel/generic/src/mm/frame.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/mm/frame.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -47,5 +47,5 @@
 #include <mm/as.h>
 #include <panic.h>
-#include <debug.h>
+#include <assert.h>
 #include <adt/list.h>
 #include <synch/mutex.h>
@@ -349,5 +349,5 @@
 NO_TRACE static frame_t *zone_get_frame(zone_t *zone, size_t index)
 {
-	ASSERT(index < zone->count);
+	assert(index < zone->count);
 	
 	return &zone->frames[index];
@@ -370,5 +370,5 @@
     pfn_t constraint)
 {
-	ASSERT(zone->flags & ZONE_AVAILABLE);
+	assert(zone->flags & ZONE_AVAILABLE);
 	
 	/* Allocate frames from zone */
@@ -377,6 +377,6 @@
 	    FRAME_LOWPRIO, constraint, &index);
 	
-	ASSERT(avail);
-	ASSERT(index != (size_t) -1);
+	assert(avail);
+	assert(index != (size_t) -1);
 	
 	/* Update frame reference count */
@@ -384,5 +384,5 @@
 		frame_t *frame = zone_get_frame(zone, index + i);
 		
-		ASSERT(frame->refcount == 0);
+		assert(frame->refcount == 0);
 		frame->refcount = 1;
 	}
@@ -407,9 +407,9 @@
 NO_TRACE static size_t zone_frame_free(zone_t *zone, size_t index)
 {
-	ASSERT(zone->flags & ZONE_AVAILABLE);
+	assert(zone->flags & ZONE_AVAILABLE);
 	
 	frame_t *frame = zone_get_frame(zone, index);
 	
-	ASSERT(frame->refcount > 0);
+	assert(frame->refcount > 0);
 	
 	if (!--frame->refcount) {
@@ -429,5 +429,5 @@
 NO_TRACE static void zone_mark_unavailable(zone_t *zone, size_t index)
 {
-	ASSERT(zone->flags & ZONE_AVAILABLE);
+	assert(zone->flags & ZONE_AVAILABLE);
 	
 	frame_t *frame = zone_get_frame(zone, index);
@@ -456,9 +456,9 @@
     void *confdata)
 {
-	ASSERT(zones.info[z1].flags & ZONE_AVAILABLE);
-	ASSERT(zones.info[z2].flags & ZONE_AVAILABLE);
-	ASSERT(zones.info[z1].flags == zones.info[z2].flags);
-	ASSERT(zones.info[z1].base < zones.info[z2].base);
-	ASSERT(!overlaps(zones.info[z1].base, zones.info[z1].count,
+	assert(zones.info[z1].flags & ZONE_AVAILABLE);
+	assert(zones.info[z2].flags & ZONE_AVAILABLE);
+	assert(zones.info[z1].flags == zones.info[z2].flags);
+	assert(zones.info[z1].base < zones.info[z2].base);
+	assert(!overlaps(zones.info[z1].base, zones.info[z1].count,
 	    zones.info[z2].base, zones.info[z2].count));
 	
@@ -509,5 +509,5 @@
 NO_TRACE static void return_config_frames(size_t znum, pfn_t pfn, size_t count)
 {
-	ASSERT(zones.info[znum].flags & ZONE_AVAILABLE);
+	assert(zones.info[znum].flags & ZONE_AVAILABLE);
 	
 	size_t cframes = SIZE2FRAMES(zone_conf_size(count));
@@ -704,5 +704,5 @@
 		 * the assert
 		 */
-		ASSERT(confframe != ADDR2PFN((uintptr_t ) NULL));
+		assert(confframe != ADDR2PFN((uintptr_t ) NULL));
 		
 		/* Update the known end of physical memory. */
@@ -792,5 +792,5 @@
 	size_t znum = find_zone(pfn, 1, hint);
 	
-	ASSERT(znum != (size_t) -1);
+	assert(znum != (size_t) -1);
 	
 	zone_get_frame(&zones.info[znum],
@@ -806,5 +806,5 @@
 	size_t znum = find_zone(pfn, 1, hint);
 	
-	ASSERT(znum != (size_t) -1);
+	assert(znum != (size_t) -1);
 	
 	void *res = zone_get_frame(&zones.info[znum],
@@ -830,5 +830,5 @@
     uintptr_t constraint, size_t *pzone)
 {
-	ASSERT(count > 0);
+	assert(count > 0);
 	
 	size_t hint = pzone ? (*pzone) : 0;
@@ -970,5 +970,5 @@
 		size_t znum = find_zone(pfn, 1, 0);
 		
-		ASSERT(znum != (size_t) -1);
+		assert(znum != (size_t) -1);
 		
 		freed += zone_frame_free(&zones.info[znum],
@@ -1030,5 +1030,5 @@
 	size_t znum = find_zone(pfn, 1, 0);
 	
-	ASSERT(znum != (size_t) -1);
+	assert(znum != (size_t) -1);
 	
 	zones.info[znum].frames[pfn - zones.info[znum].base].refcount++;
@@ -1153,8 +1153,8 @@
     uint64_t *free)
 {
-	ASSERT(total != NULL);
-	ASSERT(unavail != NULL);
-	ASSERT(busy != NULL);
-	ASSERT(free != NULL);
+	assert(total != NULL);
+	assert(unavail != NULL);
+	assert(busy != NULL);
+	assert(free != NULL);
 	
 	irq_spinlock_lock(&zones.lock, true);
Index: kernel/generic/src/mm/km.c
===================================================================
--- kernel/generic/src/mm/km.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/mm/km.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -38,4 +38,5 @@
 #include <mm/km.h>
 #include <arch/mm/km.h>
+#include <assert.h>
 #include <mm/page.h>
 #include <mm/frame.h>
@@ -44,5 +45,4 @@
 #include <typedefs.h>
 #include <lib/ra.h>
-#include <debug.h>
 #include <arch.h>
 #include <align.h>
@@ -95,5 +95,5 @@
 {
 	km_ni_arena = ra_arena_create();
-	ASSERT(km_ni_arena != NULL);
+	assert(km_ni_arena != NULL);
 	km_non_identity_arch_init();
 	config.non_identity_configured = true;
@@ -112,5 +112,5 @@
 
 	span_added = ra_span_add(km_ni_arena, base, size);
-	ASSERT(span_added);
+	assert(span_added);
 }
 
@@ -132,6 +132,6 @@
 	uintptr_t offs;
 
-	ASSERT(ALIGN_DOWN(paddr, FRAME_SIZE) == paddr);
-	ASSERT(ALIGN_UP(size, FRAME_SIZE) == size);
+	assert(ALIGN_DOWN(paddr, FRAME_SIZE) == paddr);
+	assert(ALIGN_UP(size, FRAME_SIZE) == size);
 
 	/* Enforce natural or at least PAGE_SIZE alignment. */
@@ -154,6 +154,6 @@
 	ipl_t ipl;
 
-	ASSERT(ALIGN_DOWN(vaddr, PAGE_SIZE) == vaddr);
-	ASSERT(ALIGN_UP(size, PAGE_SIZE) == size);
+	assert(ALIGN_DOWN(vaddr, PAGE_SIZE) == vaddr);
+	assert(ALIGN_UP(size, PAGE_SIZE) == size);
 
 	page_table_lock(AS_KERNEL, true);
@@ -240,7 +240,7 @@
 uintptr_t km_temporary_page_get(uintptr_t *framep, frame_flags_t flags)
 {
-	ASSERT(THREAD);
-	ASSERT(framep);
-	ASSERT(!(flags & ~(FRAME_NO_RESERVE | FRAME_ATOMIC)));
+	assert(THREAD);
+	assert(framep);
+	assert(!(flags & ~(FRAME_NO_RESERVE | FRAME_ATOMIC)));
 	
 	/*
@@ -281,5 +281,5 @@
 void km_temporary_page_put(uintptr_t page)
 {
-	ASSERT(THREAD);
+	assert(THREAD);
 
 	if (km_is_non_identity(page))
Index: kernel/generic/src/mm/page.c
===================================================================
--- kernel/generic/src/mm/page.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/mm/page.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -69,6 +69,6 @@
 #include <typedefs.h>
 #include <arch/asm.h>
-#include <debug.h>
 #include <arch.h>
+#include <assert.h>
 #include <syscall/copy.h>
 #include <errno.h>
@@ -98,8 +98,8 @@
     unsigned int flags)
 {
-	ASSERT(page_table_locked(as));
-	
-	ASSERT(page_mapping_operations);
-	ASSERT(page_mapping_operations->mapping_insert);
+	assert(page_table_locked(as));
+	
+	assert(page_mapping_operations);
+	assert(page_mapping_operations->mapping_insert);
 
 	page_mapping_operations->mapping_insert(as, ALIGN_DOWN(page, PAGE_SIZE),
@@ -122,8 +122,8 @@
 NO_TRACE void page_mapping_remove(as_t *as, uintptr_t page)
 {
-	ASSERT(page_table_locked(as));
-	
-	ASSERT(page_mapping_operations);
-	ASSERT(page_mapping_operations->mapping_remove);
+	assert(page_table_locked(as));
+	
+	assert(page_mapping_operations);
+	assert(page_mapping_operations->mapping_remove);
 	
 	page_mapping_operations->mapping_remove(as,
@@ -147,8 +147,8 @@
     pte_t *pte)
 {
-	ASSERT(nolock || page_table_locked(as));
-	
-	ASSERT(page_mapping_operations);
-	ASSERT(page_mapping_operations->mapping_find);
+	assert(nolock || page_table_locked(as));
+	
+	assert(page_mapping_operations);
+	assert(page_mapping_operations->mapping_find);
 	
 	return page_mapping_operations->mapping_find(as,
@@ -168,8 +168,8 @@
     pte_t *pte)
 {
-	ASSERT(nolock || page_table_locked(as));
-	
-	ASSERT(page_mapping_operations);
-	ASSERT(page_mapping_operations->mapping_find);
+	assert(nolock || page_table_locked(as));
+	
+	assert(page_mapping_operations);
+	assert(page_mapping_operations->mapping_find);
 	
 	page_mapping_operations->mapping_update(as,
@@ -184,6 +184,6 @@
 void page_mapping_make_global(uintptr_t base, size_t size)
 {
-	ASSERT(page_mapping_operations);
-	ASSERT(page_mapping_operations->mapping_make_global);
+	assert(page_mapping_operations);
+	assert(page_mapping_operations->mapping_make_global);
 	
 	return page_mapping_operations->mapping_make_global(base, size);
Index: kernel/generic/src/mm/reserve.c
===================================================================
--- kernel/generic/src/mm/reserve.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/mm/reserve.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -36,4 +36,5 @@
  */
 
+#include <assert.h>
 #include <mm/reserve.h>
 #include <mm/frame.h>
@@ -42,5 +43,4 @@
 #include <typedefs.h>
 #include <arch/types.h>
-#include <debug.h>
 
 static bool reserve_initialized = false;
@@ -72,5 +72,5 @@
 	bool reserved = false;
 
-	ASSERT(reserve_initialized);
+	assert(reserve_initialized);
 
 	irq_spinlock_lock(&reserve_lock, true);
Index: kernel/generic/src/mm/slab.c
===================================================================
--- kernel/generic/src/mm/slab.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/mm/slab.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -101,4 +101,5 @@
  */
 
+#include <assert.h>
 #include <synch/spinlock.h>
 #include <mm/slab.h>
@@ -111,5 +112,4 @@
 #include <arch.h>
 #include <panic.h>
-#include <debug.h>
 #include <bitops.h>
 #include <macros.h>
@@ -260,5 +260,5 @@
 		slab = obj2slab(obj);
 	
-	ASSERT(slab->cache == cache);
+	assert(slab->cache == cache);
 	
 	size_t freed = 0;
@@ -268,5 +268,5 @@
 	
 	irq_spinlock_lock(&cache->slablock, true);
-	ASSERT(slab->available < cache->objects);
+	assert(slab->available < cache->objects);
 	
 	*((size_t *) obj) = slab->nextavail;
@@ -417,5 +417,5 @@
 	slab_magazine_t *lastmag = cache->mag_cache[CPU->id].last;
 	
-	ASSERT(irq_spinlock_locked(&cache->mag_cache[CPU->id].lock));
+	assert(irq_spinlock_locked(&cache->mag_cache[CPU->id].lock));
 	
 	if (cmag) { /* First try local CPU magazines */
@@ -484,5 +484,5 @@
 	slab_magazine_t *lastmag = cache->mag_cache[CPU->id].last;
 	
-	ASSERT(irq_spinlock_locked(&cache->mag_cache[CPU->id].lock));
+	assert(irq_spinlock_locked(&cache->mag_cache[CPU->id].lock));
 	
 	if (cmag) {
@@ -586,5 +586,5 @@
 NO_TRACE static bool make_magcache(slab_cache_t *cache)
 {
-	ASSERT(_slab_initialized >= 2);
+	assert(_slab_initialized >= 2);
 	
 	cache->mag_cache = malloc(sizeof(slab_mag_cache_t) * config.cpu_count,
@@ -610,5 +610,5 @@
     unsigned int kmflag), size_t (*destructor)(void *obj), unsigned int flags)
 {
-	ASSERT(size > 0);
+	assert(size > 0);
 	
 	memsetb(cache, sizeof(*cache), 0);
@@ -948,6 +948,6 @@
 void *malloc(size_t size, unsigned int flags)
 {
-	ASSERT(_slab_initialized);
-	ASSERT(size <= (1 << SLAB_MAX_MALLOC_W));
+	assert(_slab_initialized);
+	assert(size <= (1 << SLAB_MAX_MALLOC_W));
 	
 	if (size < (1 << SLAB_MIN_MALLOC_W))
@@ -961,6 +961,6 @@
 void *realloc(void *ptr, size_t size, unsigned int flags)
 {
-	ASSERT(_slab_initialized);
-	ASSERT(size <= (1 << SLAB_MAX_MALLOC_W));
+	assert(_slab_initialized);
+	assert(size <= (1 << SLAB_MAX_MALLOC_W));
 	
 	void *new_ptr;
Index: kernel/generic/src/mm/tlb.c
===================================================================
--- kernel/generic/src/mm/tlb.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/mm/tlb.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -43,4 +43,5 @@
 #include <mm/asid.h>
 #include <arch/mm/tlb.h>
+#include <assert.h>
 #include <smp/ipi.h>
 #include <synch/spinlock.h>
@@ -50,5 +51,4 @@
 #include <arch.h>
 #include <panic.h>
-#include <debug.h>
 #include <cpu.h>
 
@@ -152,5 +152,5 @@
 void tlb_shootdown_ipi_recv(void)
 {
-	ASSERT(CPU);
+	assert(CPU);
 	
 	CPU->tlb_active = false;
@@ -159,5 +159,5 @@
 	
 	irq_spinlock_lock(&CPU->lock, false);
-	ASSERT(CPU->tlb_messages_count <= TLB_MESSAGE_QUEUE_LEN);
+	assert(CPU->tlb_messages_count <= TLB_MESSAGE_QUEUE_LEN);
 	
 	size_t i;
@@ -176,5 +176,5 @@
 			break;
 		case TLB_INVL_PAGES:
-			ASSERT(count);
+			assert(count);
 			tlb_invalidate_pages(asid, page, count);
 			break;
Index: kernel/generic/src/proc/scheduler.c
===================================================================
--- kernel/generic/src/proc/scheduler.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/proc/scheduler.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -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 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -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 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -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 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -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;
Index: kernel/generic/src/smp/smp_call.c
===================================================================
--- kernel/generic/src/smp/smp_call.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/smp/smp_call.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -40,7 +40,7 @@
 #include <arch/asm.h>  /* interrupt_disable */
 #include <arch.h>
+#include <assert.h>
 #include <config.h>
 #include <preemption.h>
-#include <debug.h>
 #include <cpu.h>
 
@@ -53,6 +53,6 @@
 void smp_call_init(void)
 {
-	ASSERT(CPU);
-	ASSERT(PREEMPTION_DISABLED || interrupts_disabled());
+	assert(CPU);
+	assert(PREEMPTION_DISABLED || interrupts_disabled());
 	
 	spinlock_initialize(&CPU->smp_calls_lock, "cpu[].smp_calls_lock");
@@ -131,6 +131,6 @@
 	 * for an acknowledgment of the IPI from the other cpu.
 	 */
-	ASSERT(!interrupts_disabled());
-	ASSERT(call_info != NULL);
+	assert(!interrupts_disabled());
+	assert(call_info != NULL);
 	
 	/* Discard invalid calls. */
@@ -207,6 +207,6 @@
 void smp_call_ipi_recv(void)
 {
-	ASSERT(interrupts_disabled());
-	ASSERT(CPU);
+	assert(interrupts_disabled());
+	assert(CPU);
 	
 	list_t calls_list;
Index: kernel/generic/src/synch/futex.c
===================================================================
--- kernel/generic/src/synch/futex.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/synch/futex.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -61,4 +61,5 @@
  */
 
+#include <assert.h>
 #include <synch/futex.h>
 #include <synch/mutex.h>
@@ -241,6 +242,6 @@
 static void futex_add_ref(futex_t *futex)
 {
-	ASSERT(spinlock_locked(&futex_ht_lock));
-	ASSERT(0 < futex->refcount);
+	assert(spinlock_locked(&futex_ht_lock));
+	assert(0 < futex->refcount);
 	++futex->refcount;
 }
@@ -249,6 +250,6 @@
 static void futex_release_ref(futex_t *futex)
 {
-	ASSERT(spinlock_locked(&futex_ht_lock));
-	ASSERT(0 < futex->refcount);
+	assert(spinlock_locked(&futex_ht_lock));
+	assert(0 < futex->refcount);
 	
 	--futex->refcount;
@@ -459,5 +460,5 @@
 	futex_t *futex;
 
-	ASSERT(keys == 1);
+	assert(keys == 1);
 
 	futex = hash_table_get_instance(item, futex_t, ht_link);
Index: kernel/generic/src/synch/mutex.c
===================================================================
--- kernel/generic/src/synch/mutex.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/synch/mutex.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -36,7 +36,7 @@
  */
 
+#include <assert.h>
 #include <synch/mutex.h>
 #include <synch/semaphore.h>
-#include <debug.h>
 #include <arch.h>
 #include <stacktrace.h>
@@ -88,7 +88,7 @@
 		rc = _semaphore_down_timeout(&mtx->sem, usec, flags);
 	} else {
-		ASSERT((mtx->type == MUTEX_ACTIVE) || (!THREAD));
-		ASSERT(usec == SYNCH_NO_TIMEOUT);
-		ASSERT(!(flags & SYNCH_FLAGS_INTERRUPTIBLE));
+		assert((mtx->type == MUTEX_ACTIVE) || (!THREAD));
+		assert(usec == SYNCH_NO_TIMEOUT);
+		assert(!(flags & SYNCH_FLAGS_INTERRUPTIBLE));
 		
 		unsigned int cnt = 0;
Index: kernel/generic/src/synch/rcu.c
===================================================================
--- kernel/generic/src/synch/rcu.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/synch/rcu.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -123,5 +123,6 @@
  * 
  */
- 
+
+#include <assert.h>
 #include <synch/rcu.h>
 #include <synch/condvar.h>
@@ -404,5 +405,5 @@
 	/* Stop and wait for reclaimers. */
 	for (unsigned int cpu_id = 0; cpu_id < config.cpu_active; ++cpu_id) {
-		ASSERT(cpus[cpu_id].rcu.reclaimer_thr != NULL);
+		assert(cpus[cpu_id].rcu.reclaimer_thr != NULL);
 	
 		if (cpus[cpu_id].rcu.reclaimer_thr) {
@@ -487,5 +488,5 @@
 static void read_unlock_impl(size_t *pnesting_cnt)
 {
-	ASSERT(PREEMPTION_DISABLED || interrupts_disabled());
+	assert(PREEMPTION_DISABLED || interrupts_disabled());
 	
 	if (0 == --(*pnesting_cnt)) {
@@ -509,5 +510,5 @@
 void _rcu_signal_read_unlock(void)
 {
-	ASSERT(PREEMPTION_DISABLED || interrupts_disabled());
+	assert(PREEMPTION_DISABLED || interrupts_disabled());
 	
 	/*
@@ -531,5 +532,5 @@
 	 */
 	if (THREAD && local_atomic_exchange(&THREAD->rcu.was_preempted, false)) {
-		ASSERT(link_used(&THREAD->rcu.preempt_link));
+		assert(link_used(&THREAD->rcu.preempt_link));
 
 		rm_preempted_reader();
@@ -563,5 +564,5 @@
 {
 	/* Calling from a reader section will deadlock. */
-	ASSERT(!rcu_read_locked());
+	assert(!rcu_read_locked());
 	
 	synch_item_t completion; 
@@ -576,5 +577,5 @@
 {
 	synch_item_t *completion = member_to_inst(rcu_item, synch_item_t, rcu_item);
-	ASSERT(completion);
+	assert(completion);
 	waitq_wakeup(&completion->wq, WAKEUP_FIRST);
 }
@@ -615,5 +616,5 @@
 static void add_barrier_cb(void *arg)
 {
-	ASSERT(interrupts_disabled() || PREEMPTION_DISABLED);
+	assert(interrupts_disabled() || PREEMPTION_DISABLED);
 	atomic_inc(&rcu.barrier_wait_cnt);
 	rcu_call(&CPU->rcu.barrier_item, barrier_complete);
@@ -657,5 +658,5 @@
 	rcu_func_t func)
 {
-	ASSERT(rcu_item);
+	assert(rcu_item);
 	
 	rcu_item->func = func;
@@ -689,5 +690,5 @@
 static bool cur_cbs_empty(void)
 {
-	ASSERT(THREAD && THREAD->wired);
+	assert(THREAD && THREAD->wired);
 	return NULL == CPU->rcu.cur_cbs;
 }
@@ -695,5 +696,5 @@
 static bool next_cbs_empty(void)
 {
-	ASSERT(THREAD && THREAD->wired);
+	assert(THREAD && THREAD->wired);
 	return NULL == CPU->rcu.next_cbs;
 }
@@ -702,5 +703,5 @@
 static bool arriving_cbs_empty(void)
 {
-	ASSERT(THREAD && THREAD->wired);
+	assert(THREAD && THREAD->wired);
 	/* 
 	 * Accessing with interrupts enabled may at worst lead to 
@@ -719,6 +720,6 @@
 static void reclaimer(void *arg)
 {
-	ASSERT(THREAD && THREAD->wired);
-	ASSERT(THREAD == CPU->rcu.reclaimer_thr);
+	assert(THREAD && THREAD->wired);
+	assert(THREAD == CPU->rcu.reclaimer_thr);
 
 	rcu_gp_t last_compl_gp = 0;
@@ -726,5 +727,5 @@
 	
 	while (ok && wait_for_pending_cbs()) {
-		ASSERT(CPU->rcu.reclaimer_thr == THREAD);
+		assert(CPU->rcu.reclaimer_thr == THREAD);
 		
 		exec_completed_cbs(last_compl_gp);
@@ -765,5 +766,5 @@
 	/* Both next_cbs and cur_cbs GP elapsed. */
 	if (CPU->rcu.next_cbs_gp <= last_completed_gp) {
-		ASSERT(CPU->rcu.cur_cbs_gp <= CPU->rcu.next_cbs_gp);
+		assert(CPU->rcu.cur_cbs_gp <= CPU->rcu.next_cbs_gp);
 		
 		size_t exec_cnt = CPU->rcu.cur_cbs_cnt + CPU->rcu.next_cbs_cnt;
@@ -864,5 +865,5 @@
 	 */
 	if (CPU->rcu.next_cbs) {
-		ASSERT(CPU->rcu.parriving_cbs_tail != &CPU->rcu.arriving_cbs);
+		assert(CPU->rcu.parriving_cbs_tail != &CPU->rcu.arriving_cbs);
 		
 		CPU->rcu.arriving_cbs = NULL;
@@ -913,5 +914,5 @@
 	}
 	
-	ASSERT(CPU->rcu.cur_cbs_gp <= CPU->rcu.next_cbs_gp);
+	assert(CPU->rcu.cur_cbs_gp <= CPU->rcu.next_cbs_gp);
 	
 	return expedite;	
@@ -933,6 +934,6 @@
 	spinlock_lock(&rcu.gp_lock);
 
-	ASSERT(CPU->rcu.cur_cbs_gp <= CPU->rcu.next_cbs_gp);
-	ASSERT(CPU->rcu.cur_cbs_gp <= _rcu_cur_gp + 1);
+	assert(CPU->rcu.cur_cbs_gp <= CPU->rcu.next_cbs_gp);
+	assert(CPU->rcu.cur_cbs_gp <= _rcu_cur_gp + 1);
 	
 	while (rcu.completed_gp < CPU->rcu.cur_cbs_gp) {
@@ -1029,5 +1030,5 @@
 static void sample_local_cpu(void *arg)
 {
-	ASSERT(interrupts_disabled());
+	assert(interrupts_disabled());
 	cpu_mask_t *reader_cpus = (cpu_mask_t *)arg;
 	
@@ -1054,5 +1055,5 @@
 void rcu_after_thread_ran(void)
 {
-	ASSERT(interrupts_disabled());
+	assert(interrupts_disabled());
 
 	/* 
@@ -1116,5 +1117,5 @@
 void rcu_before_thread_runs(void)
 {
-	ASSERT(!rcu_read_locked());
+	assert(!rcu_read_locked());
 	
 	/* Load the thread's saved nesting count from before it was preempted. */
@@ -1129,5 +1130,5 @@
 void rcu_thread_exiting(void)
 {
-	ASSERT(THE->rcu_nesting == 0);
+	assert(THE->rcu_nesting == 0);
 	
 	/* 
@@ -1157,5 +1158,5 @@
 void _rcu_preempted_unlock(void)
 {
-	ASSERT(0 == THE->rcu_nesting || RCU_WAS_PREEMPTED == THE->rcu_nesting);
+	assert(0 == THE->rcu_nesting || RCU_WAS_PREEMPTED == THE->rcu_nesting);
 	
 	size_t prev = local_atomic_exchange(&THE->rcu_nesting, 0);
@@ -1220,6 +1221,6 @@
 	}
 	
-	ASSERT(CPU->rcu.cur_cbs_gp <= CPU->rcu.next_cbs_gp);
-	ASSERT(_rcu_cur_gp <= CPU->rcu.cur_cbs_gp);
+	assert(CPU->rcu.cur_cbs_gp <= CPU->rcu.next_cbs_gp);
+	assert(_rcu_cur_gp <= CPU->rcu.cur_cbs_gp);
 	
 	/* 
@@ -1262,5 +1263,5 @@
 static bool cv_wait_for_gp(rcu_gp_t wait_on_gp)
 {
-	ASSERT(spinlock_locked(&rcu.gp_lock));
+	assert(spinlock_locked(&rcu.gp_lock));
 	
 	bool interrupted = false;
@@ -1284,5 +1285,5 @@
 
 		if (detector_idle) {
-			ASSERT(_rcu_cur_gp == rcu.completed_gp);
+			assert(_rcu_cur_gp == rcu.completed_gp);
 			condvar_signal(&rcu.req_gp_changed);
 		}
@@ -1323,5 +1324,5 @@
 static bool wait_for_detect_req(void)
 {
-	ASSERT(spinlock_locked(&rcu.gp_lock));
+	assert(spinlock_locked(&rcu.gp_lock));
 	
 	bool interrupted = false;
@@ -1340,5 +1341,5 @@
 static void end_cur_gp(void)
 {
-	ASSERT(spinlock_locked(&rcu.gp_lock));
+	assert(spinlock_locked(&rcu.gp_lock));
 	
 	rcu.completed_gp = _rcu_cur_gp;
@@ -1423,6 +1424,6 @@
 static void sample_local_cpu(void *arg)
 {
-	ASSERT(interrupts_disabled());
-	ASSERT(!CPU->rcu.is_delaying_gp);
+	assert(interrupts_disabled());
+	assert(!CPU->rcu.is_delaying_gp);
 	
 	/* Cpu did not pass a quiescent state yet. */
@@ -1430,5 +1431,5 @@
 		/* Interrupted a reader in a reader critical section. */
 		if (0 < CPU->rcu.nesting_cnt) {
-			ASSERT(!CPU->idle);
+			assert(!CPU->idle);
 			/* 
 			 * Note to notify the detector from rcu_read_unlock(). 
@@ -1492,5 +1493,5 @@
 void rcu_after_thread_ran(void)
 {
-	ASSERT(interrupts_disabled());
+	assert(interrupts_disabled());
 
 	/* 
@@ -1559,6 +1560,6 @@
 void rcu_before_thread_runs(void)
 {
-	ASSERT(PREEMPTION_DISABLED || interrupts_disabled());
-	ASSERT(0 == CPU->rcu.nesting_cnt);
+	assert(PREEMPTION_DISABLED || interrupts_disabled());
+	assert(0 == CPU->rcu.nesting_cnt);
 	
 	/* Load the thread's saved nesting count from before it was preempted. */
@@ -1590,7 +1591,7 @@
 void rcu_thread_exiting(void)
 {
-	ASSERT(THREAD != NULL);
-	ASSERT(THREAD->state == Exiting);
-	ASSERT(PREEMPTION_DISABLED || interrupts_disabled());
+	assert(THREAD != NULL);
+	assert(THREAD->state == Exiting);
+	assert(PREEMPTION_DISABLED || interrupts_disabled());
 	
 	/* 
@@ -1615,5 +1616,5 @@
 static void start_new_gp(void)
 {
-	ASSERT(spinlock_locked(&rcu.gp_lock));
+	assert(spinlock_locked(&rcu.gp_lock));
 	
 	irq_spinlock_lock(&rcu.preempt_lock, true);
@@ -1734,5 +1735,5 @@
 static void upd_missed_gp_in_wait(rcu_gp_t completed_gp)
 {
-	ASSERT(CPU->rcu.cur_cbs_gp <= completed_gp);
+	assert(CPU->rcu.cur_cbs_gp <= completed_gp);
 	
 	size_t delta = (size_t)(completed_gp - CPU->rcu.cur_cbs_gp);
@@ -1764,5 +1765,5 @@
 	irq_spinlock_lock(&rcu.preempt_lock, true);
 	
-	ASSERT(link_used(&THREAD->rcu.preempt_link));
+	assert(link_used(&THREAD->rcu.preempt_link));
 
 	bool prev_empty = list_empty(&rcu.cur_preempted);
Index: kernel/generic/src/synch/waitq.c
===================================================================
--- kernel/generic/src/synch/waitq.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/synch/waitq.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -44,4 +44,5 @@
  */
 
+#include <assert.h>
 #include <synch/waitq.h>
 #include <synch/spinlock.h>
@@ -203,5 +204,5 @@
 		irq_spinlock_lock(&thread->lock, false);
 		
-		ASSERT(thread->sleep_interruptible);
+		assert(thread->sleep_interruptible);
 		
 		if ((thread->timeout_pending) &&
@@ -264,5 +265,5 @@
 int waitq_sleep_timeout(waitq_t *wq, uint32_t usec, unsigned int flags)
 {
-	ASSERT((!PREEMPTION_DISABLED) || (PARAM_NON_BLOCKING(flags, usec)));
+	assert((!PREEMPTION_DISABLED) || (PARAM_NON_BLOCKING(flags, usec)));
 	
 	ipl_t ipl = waitq_sleep_prepare(wq);
@@ -496,5 +497,5 @@
 static void waitq_complete_wakeup(waitq_t *wq)
 {
-	ASSERT(interrupts_disabled());
+	assert(interrupts_disabled());
 	
 	irq_spinlock_lock(&wq->lock, false);
@@ -520,6 +521,6 @@
 	size_t count = 0;
 
-	ASSERT(interrupts_disabled());
-	ASSERT(irq_spinlock_locked(&wq->lock));
+	assert(interrupts_disabled());
+	assert(irq_spinlock_locked(&wq->lock));
 	
 loop:
Index: kernel/generic/src/synch/workqueue.c
===================================================================
--- kernel/generic/src/synch/workqueue.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/synch/workqueue.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -37,4 +37,5 @@
  */
 
+#include <assert.h>
 #include <synch/workqueue.h>
 #include <synch/spinlock.h>
@@ -189,5 +190,5 @@
 	if (workq) {
 		if (workq_init(workq, name)) {
-			ASSERT(!workq_corrupted(workq));
+			assert(!workq_corrupted(workq));
 			return workq;
 		}
@@ -202,5 +203,5 @@
 void workq_destroy(struct work_queue *workq)
 {
-	ASSERT(!workq_corrupted(workq));
+	assert(!workq_corrupted(workq));
 	
 	irq_spinlock_lock(&workq->lock, true);
@@ -214,5 +215,5 @@
 		workq_stop(workq);
 	} else {
-		ASSERT(0 == running_workers);
+		assert(0 == running_workers);
 	}
 	
@@ -264,5 +265,5 @@
 static bool add_worker(struct work_queue *workq)
 {
-	ASSERT(!workq_corrupted(workq));
+	assert(!workq_corrupted(workq));
 
 	thread_t *thread = thread_create(worker_thread, workq, TASK, 
@@ -273,5 +274,5 @@
 		
 		/* cur_worker_cnt proactively increased in signal_worker_logic() .*/
-		ASSERT(0 < workq->cur_worker_cnt);
+		assert(0 < workq->cur_worker_cnt);
 		--workq->cur_worker_cnt;
 		
@@ -312,5 +313,5 @@
 		
 		/* cur_worker_cnt proactively increased in signal_worker() .*/
-		ASSERT(0 < workq->cur_worker_cnt);
+		assert(0 < workq->cur_worker_cnt);
 		--workq->cur_worker_cnt;
 	}
@@ -334,5 +335,5 @@
 void workq_stop(struct work_queue *workq)
 {
-	ASSERT(!workq_corrupted(workq));
+	assert(!workq_corrupted(workq));
 	
 	interrupt_workers(workq);
@@ -346,5 +347,5 @@
 
 	/* workq_stop() may only be called once. */
-	ASSERT(!workq->stopping);
+	assert(!workq->stopping);
 	workq->stopping = true;
 	
@@ -358,5 +359,5 @@
 static void wait_for_workers(struct work_queue *workq)
 {
-	ASSERT(!PREEMPTION_DISABLED);
+	assert(!PREEMPTION_DISABLED);
 	
 	irq_spinlock_lock(&workq->lock, true);
@@ -375,5 +376,5 @@
 	}
 	
-	ASSERT(list_empty(&workq->workers));
+	assert(list_empty(&workq->workers));
 	
 	/* Wait for deferred add_worker_op(), signal_worker_op() to finish. */
@@ -473,5 +474,5 @@
 	work_func_t func, bool can_block)
 {
-	ASSERT(!workq_corrupted(workq));
+	assert(!workq_corrupted(workq));
 	
 	bool success = true;
@@ -521,17 +522,17 @@
 static size_t active_workers_now(struct work_queue *workq)
 {
-	ASSERT(irq_spinlock_locked(&workq->lock));
+	assert(irq_spinlock_locked(&workq->lock));
 	
 	/* Workers blocked are sleeping in the work function (ie not idle). */
-	ASSERT(workq->blocked_worker_cnt <= workq->cur_worker_cnt);
+	assert(workq->blocked_worker_cnt <= workq->cur_worker_cnt);
 	/* Idle workers are waiting for more work to arrive in condvar_wait. */
-	ASSERT(workq->idle_worker_cnt <= workq->cur_worker_cnt);
+	assert(workq->idle_worker_cnt <= workq->cur_worker_cnt);
 	
 	/* Idle + blocked workers == sleeping worker threads. */
 	size_t sleeping_workers = workq->blocked_worker_cnt + workq->idle_worker_cnt;
 	
-	ASSERT(sleeping_workers	<= workq->cur_worker_cnt);
+	assert(sleeping_workers	<= workq->cur_worker_cnt);
 	/* Workers pending activation are idle workers not yet given a time slice. */
-	ASSERT(workq->activate_pending <= workq->idle_worker_cnt);
+	assert(workq->activate_pending <= workq->idle_worker_cnt);
 	
 	/* 
@@ -550,5 +551,5 @@
 static size_t active_workers(struct work_queue *workq)
 {
-	ASSERT(irq_spinlock_locked(&workq->lock));
+	assert(irq_spinlock_locked(&workq->lock));
 	
 	/* 
@@ -573,10 +574,10 @@
 static void signal_worker_op(struct work_queue *workq)
 {
-	ASSERT(!workq_corrupted(workq));
+	assert(!workq_corrupted(workq));
 
 	condvar_signal(&workq->activate_worker);
 	
 	irq_spinlock_lock(&workq->lock, true);
-	ASSERT(0 < workq->pending_op_cnt);
+	assert(0 < workq->pending_op_cnt);
 	--workq->pending_op_cnt;
 	irq_spinlock_unlock(&workq->lock, true);
@@ -593,6 +594,6 @@
 static signal_op_t signal_worker_logic(struct work_queue *workq, bool can_block)
 {
-	ASSERT(!workq_corrupted(workq));
-	ASSERT(irq_spinlock_locked(&workq->lock));
+	assert(!workq_corrupted(workq));
+	assert(irq_spinlock_locked(&workq->lock));
 	
 	/* Only signal workers if really necessary. */
@@ -645,5 +646,5 @@
 			 */
 			if (need_worker && !can_block && 0 == active) {
-				ASSERT(0 == workq->idle_worker_cnt);
+				assert(0 == workq->idle_worker_cnt);
 				
 				irq_spinlock_lock(&nonblock_adder.lock, true);
@@ -681,5 +682,5 @@
 	}
 	
-	ASSERT(arg != NULL);
+	assert(arg != NULL);
 	
 	struct work_queue *workq = arg;
@@ -697,5 +698,5 @@
 static bool dequeue_work(struct work_queue *workq, work_t **pwork_item)
 {
-	ASSERT(!workq_corrupted(workq));
+	assert(!workq_corrupted(workq));
 	
 	irq_spinlock_lock(&workq->lock, true);
@@ -704,5 +705,5 @@
 	if (!workq->stopping && worker_unnecessary(workq)) {
 		/* There are too many workers for this load. Exit. */
-		ASSERT(0 < workq->cur_worker_cnt);
+		assert(0 < workq->cur_worker_cnt);
 		--workq->cur_worker_cnt;
 		list_remove(&THREAD->workq_link);
@@ -729,5 +730,5 @@
 		
 #ifdef CONFIG_DEBUG
-		ASSERT(!work_item_corrupted(*pwork_item));
+		assert(!work_item_corrupted(*pwork_item));
 		(*pwork_item)->cookie = 0;
 #endif
@@ -738,5 +739,5 @@
 	} else {
 		/* Requested to stop and no more work queued. */
-		ASSERT(workq->stopping);
+		assert(workq->stopping);
 		--workq->cur_worker_cnt;
 		stop = true;
@@ -751,5 +752,5 @@
 static bool worker_unnecessary(struct work_queue *workq)
 {
-	ASSERT(irq_spinlock_locked(&workq->lock));
+	assert(irq_spinlock_locked(&workq->lock));
 	
 	/* No work is pending. We don't need too many idle threads. */
@@ -775,11 +776,11 @@
 	
 	/* Ignore lock ordering just here. */
-	ASSERT(irq_spinlock_locked(&workq->lock));
+	assert(irq_spinlock_locked(&workq->lock));
 	
 	_condvar_wait_timeout_irq_spinlock(&workq->activate_worker,
 		&workq->lock, SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE);
 
-	ASSERT(!workq_corrupted(workq));
-	ASSERT(irq_spinlock_locked(&workq->lock));
+	assert(!workq_corrupted(workq));
+	assert(irq_spinlock_locked(&workq->lock));
 	
 	THREAD->workq_idling = false;
@@ -791,14 +792,14 @@
 void workq_before_thread_is_ready(thread_t *thread)
 {
-	ASSERT(thread);
-	ASSERT(irq_spinlock_locked(&thread->lock));
+	assert(thread);
+	assert(irq_spinlock_locked(&thread->lock));
 
 	/* Worker's work func() is about to wake up from sleeping. */
 	if (thread->workq && thread->workq_blocked) {
 		/* Must be blocked in user work func() and not be waiting for work. */
-		ASSERT(!thread->workq_idling);
-		ASSERT(thread->state == Sleeping);
-		ASSERT(THREAD != thread);
-		ASSERT(!workq_corrupted(thread->workq));
+		assert(!thread->workq_idling);
+		assert(thread->state == Sleeping);
+		assert(THREAD != thread);
+		assert(!workq_corrupted(thread->workq));
 		
 		/* Protected by thread->lock */
@@ -814,11 +815,11 @@
 void workq_after_thread_ran(void)
 {
-	ASSERT(THREAD);
-	ASSERT(irq_spinlock_locked(&THREAD->lock));
+	assert(THREAD);
+	assert(irq_spinlock_locked(&THREAD->lock));
 
 	/* Worker's work func() is about to sleep/block. */
 	if (THREAD->workq && THREAD->state == Sleeping && !THREAD->workq_idling) {
-		ASSERT(!THREAD->workq_blocked);
-		ASSERT(!workq_corrupted(THREAD->workq));
+		assert(!THREAD->workq_blocked);
+		assert(!workq_corrupted(THREAD->workq));
 		
 		THREAD->workq_blocked = true;
@@ -834,5 +835,5 @@
 		
 		if (op) {
-			ASSERT(add_worker_noblock_op == op || signal_worker_op == op);
+			assert(add_worker_noblock_op == op || signal_worker_op == op);
 			op(THREAD->workq);
 		}
@@ -903,5 +904,5 @@
 			struct work_queue, nb_link);
 
-		ASSERT(!workq_corrupted(*pworkq));
+		assert(!workq_corrupted(*pworkq));
 		
 		list_remove(&(*pworkq)->nb_link);
Index: kernel/generic/src/syscall/copy.c
===================================================================
--- kernel/generic/src/syscall/copy.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/syscall/copy.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -39,4 +39,5 @@
  */
 
+#include <assert.h>
 #include <syscall/copy.h>
 #include <proc/thread.h>
@@ -63,6 +64,6 @@
 	int rc;
 	
-	ASSERT(THREAD);
-	ASSERT(!THREAD->in_copy_from_uspace);
+	assert(THREAD);
+	assert(!THREAD->in_copy_from_uspace);
 	
 	if (!KERNEL_ADDRESS_SPACE_SHADOWED) {
@@ -114,6 +115,6 @@
 	int rc;
 	
-	ASSERT(THREAD);
-	ASSERT(!THREAD->in_copy_to_uspace);
+	assert(THREAD);
+	assert(!THREAD->in_copy_to_uspace);
 	
 	if (!KERNEL_ADDRESS_SPACE_SHADOWED) {
Index: kernel/generic/src/sysinfo/stats.c
===================================================================
--- kernel/generic/src/sysinfo/stats.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/sysinfo/stats.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -34,4 +34,5 @@
  */
 
+#include <assert.h>
 #include <typedefs.h>
 #include <abi/sysinfo.h>
@@ -231,6 +232,6 @@
 static void produce_stats_task(task_t *task, stats_task_t *stats_task)
 {
-	ASSERT(interrupts_disabled());
-	ASSERT(irq_spinlock_locked(&task->lock));
+	assert(interrupts_disabled());
+	assert(irq_spinlock_locked(&task->lock));
 	
 	stats_task->task_id = task->taskid;
@@ -333,6 +334,6 @@
 static void produce_stats_thread(thread_t *thread, stats_thread_t *stats_thread)
 {
-	ASSERT(interrupts_disabled());
-	ASSERT(irq_spinlock_locked(&thread->lock));
+	assert(interrupts_disabled());
+	assert(irq_spinlock_locked(&thread->lock));
 	
 	stats_thread->thread_id = thread->tid;
Index: kernel/generic/src/sysinfo/sysinfo.c
===================================================================
--- kernel/generic/src/sysinfo/sysinfo.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/sysinfo/sysinfo.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -34,4 +34,5 @@
  */
 
+#include <assert.h>
 #include <sysinfo/sysinfo.h>
 #include <mm/slab.h>
@@ -125,5 +126,5 @@
     sysinfo_item_t *subtree, sysinfo_return_t **ret, bool dry_run)
 {
-	ASSERT(subtree != NULL);
+	assert(subtree != NULL);
 	
 	sysinfo_item_t *cur = subtree;
@@ -191,5 +192,5 @@
     sysinfo_item_t **psubtree)
 {
-	ASSERT(psubtree != NULL);
+	assert(psubtree != NULL);
 	
 	if (*psubtree == NULL) {
@@ -204,9 +205,9 @@
 		*psubtree =
 		    (sysinfo_item_t *) slab_alloc(sysinfo_item_slab, 0);
-		ASSERT(*psubtree);
+		assert(*psubtree);
 		
 		/* Fill in item name up to the delimiter */
 		(*psubtree)->name = str_ndup(name, i);
-		ASSERT((*psubtree)->name);
+		assert((*psubtree)->name);
 		
 		/* Create subtree items */
@@ -268,5 +269,5 @@
 			sysinfo_item_t *item =
 			    (sysinfo_item_t *) slab_alloc(sysinfo_item_slab, 0);
-			ASSERT(item);
+			assert(item);
 			
 			cur->next = item;
@@ -274,5 +275,5 @@
 			/* Fill in item name up to the delimiter */
 			item->name = str_ndup(name, i);
-			ASSERT(item->name);
+			assert(item->name);
 			
 			/* Create subtree items */
@@ -291,5 +292,5 @@
 	
 	/* Unreachable */
-	ASSERT(false);
+	assert(false);
 	return NULL;
 }
@@ -649,5 +650,5 @@
 	
 	char *path = (char *) malloc(size + 1, 0);
-	ASSERT(path);
+	assert(path);
 	
 	if ((copy_from_uspace(path, ptr, size + 1) == 0) &&
@@ -760,5 +761,5 @@
 	
 	char *path = (char *) malloc(size + 1, 0);
-	ASSERT(path);
+	assert(path);
 	
 	if ((copy_from_uspace(path, ptr, size + 1) == 0) &&
Index: kernel/generic/src/udebug/udebug.c
===================================================================
--- kernel/generic/src/udebug/udebug.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/udebug/udebug.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -38,6 +38,7 @@
  */
 
+#include <assert.h>
+#include <debug.h>
 #include <synch/waitq.h>
-#include <debug.h>
 #include <udebug/udebug.h>
 #include <errno.h>
@@ -116,6 +117,6 @@
 void udebug_stoppable_begin(void)
 {
-	ASSERT(THREAD);
-	ASSERT(TASK);
+	assert(THREAD);
+	assert(TASK);
 	
 	mutex_lock(&TASK->udebug.lock);
@@ -125,5 +126,5 @@
 	/* Lock order OK, THREAD->udebug.lock is after TASK->udebug.lock */
 	mutex_lock(&THREAD->udebug.lock);
-	ASSERT(THREAD->udebug.stoppable == false);
+	assert(THREAD->udebug.stoppable == false);
 	THREAD->udebug.stoppable = true;
 	
@@ -136,5 +137,5 @@
 		
 		call_t *db_call = TASK->udebug.begin_call;
-		ASSERT(db_call);
+		assert(db_call);
 		
 		TASK->udebug.dt_state = UDEBUG_TS_ACTIVE;
@@ -158,5 +159,5 @@
 			call_t *go_call = THREAD->udebug.go_call;
 			THREAD->udebug.go_call = NULL;
-			ASSERT(go_call);
+			assert(go_call);
 			
 			IPC_SET_RETVAL(go_call->data, 0);
@@ -195,5 +196,5 @@
 	} else {
 		++TASK->udebug.not_stoppable_count;
-		ASSERT(THREAD->udebug.stoppable == true);
+		assert(THREAD->udebug.stoppable == true);
 		THREAD->udebug.stoppable = false;
 		
@@ -398,5 +399,5 @@
 int udebug_task_cleanup(struct task *task)
 {
-	ASSERT(mutex_locked(&task->udebug.lock));
+	assert(mutex_locked(&task->udebug.lock));
 
 	if ((task->udebug.dt_state != UDEBUG_TS_BEGINNING) &&
Index: kernel/generic/src/udebug/udebug_ipc.c
===================================================================
--- kernel/generic/src/udebug/udebug_ipc.c	(revision 44a7ee5373ccc121fce74799244a44867eed301d)
+++ kernel/generic/src/udebug/udebug_ipc.c	(revision 9e7615d35069136ff63e031e297b82ddbd2e00b0)
@@ -38,5 +38,6 @@
  * functions from the udebug_ops module which implement them.
  */
- 
+
+#include <assert.h>
 #include <proc/task.h>
 #include <proc/thread.h>
@@ -355,5 +356,5 @@
 	}
 
-	ASSERT(buffer != NULL);
+	assert(buffer != NULL);
 
 	/*
@@ -401,5 +402,5 @@
 	}
 
-	ASSERT(buffer != NULL);
+	assert(buffer != NULL);
 
 	IPC_SET_RETVAL(call->data, 0);
