Index: kernel/arch/ia64/src/drivers/ski.c
===================================================================
--- kernel/arch/ia64/src/drivers/ski.c	(revision abfc9f3fe25d6b047d9f3199bff85443b03ecbc8)
+++ kernel/arch/ia64/src/drivers/ski.c	(revision da0fef6126d5ca1836cfcd2bb32043a899aff458)
@@ -150,6 +150,6 @@
 	
 	if (instance) {
-		instance->thread = thread_create(kskipoll, instance, TASK, 0,
-		    "kskipoll", true);
+		instance->thread = thread_create(kskipoll, instance, TASK,
+		    THREAD_FLAG_UNCOUNTED, "kskipoll");
 		
 		if (!instance->thread) {
Index: kernel/arch/sparc64/src/drivers/niagara.c
===================================================================
--- kernel/arch/sparc64/src/drivers/niagara.c	(revision abfc9f3fe25d6b047d9f3199bff85443b03ecbc8)
+++ kernel/arch/sparc64/src/drivers/niagara.c	(revision da0fef6126d5ca1836cfcd2bb32043a899aff458)
@@ -184,6 +184,6 @@
 	
 	instance = malloc(sizeof(niagara_instance_t), FRAME_ATOMIC);
-	instance->thread = thread_create(kniagarapoll, NULL, TASK, 0,
-	    "kniagarapoll", true);
+	instance->thread = thread_create(kniagarapoll, NULL, TASK,
+	    THREAD_FLAG_UNCOUNTED, "kniagarapoll");
 	
 	if (!instance->thread) {
Index: kernel/arch/sparc64/src/proc/sun4u/scheduler.c
===================================================================
--- kernel/arch/sparc64/src/proc/sun4u/scheduler.c	(revision abfc9f3fe25d6b047d9f3199bff85443b03ecbc8)
+++ kernel/arch/sparc64/src/proc/sun4u/scheduler.c	(revision da0fef6126d5ca1836cfcd2bb32043a899aff458)
@@ -51,5 +51,5 @@
 void before_thread_runs_arch(void)
 {
-	if ((THREAD->flags & THREAD_FLAG_USPACE)) {
+	if (THREAD->uspace) {
 		/*
 		 * Write kernel stack address to %g6 of the alternate and
@@ -74,6 +74,6 @@
 void after_thread_ran_arch(void)
 {
-	if ((THREAD->flags & THREAD_FLAG_USPACE)) {
-		/* sample the state of the userspace window buffer */	
+	if (THREAD->uspace) {
+		/* sample the state of the userspace window buffer */
 		THREAD->arch.uspace_window_buffer = (uint8_t *) read_from_ag_g7();
 	}
Index: kernel/arch/sparc64/src/proc/sun4v/scheduler.c
===================================================================
--- kernel/arch/sparc64/src/proc/sun4v/scheduler.c	(revision abfc9f3fe25d6b047d9f3199bff85443b03ecbc8)
+++ kernel/arch/sparc64/src/proc/sun4v/scheduler.c	(revision da0fef6126d5ca1836cfcd2bb32043a899aff458)
@@ -54,5 +54,5 @@
 void before_thread_runs_arch(void)
 {
-	if ((THREAD->flags & THREAD_FLAG_USPACE)) {
+	if (THREAD->uspace) {
 		uint64_t sp = (uintptr_t) THREAD->kstack + STACK_SIZE -
 		    (STACK_BIAS + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT));
@@ -66,6 +66,6 @@
 void after_thread_ran_arch(void)
 {
-	if ((THREAD->flags & THREAD_FLAG_USPACE)) {
-		/* sample the state of the userspace window buffer */	
+	if (THREAD->uspace) {
+		/* sample the state of the userspace window buffer */
 		THREAD->arch.uspace_window_buffer =
 		    (uint8_t *) asi_u64_read(ASI_SCRATCHPAD, SCRATCHPAD_WBUF);
Index: kernel/arch/sparc64/src/proc/thread.c
===================================================================
--- kernel/arch/sparc64/src/proc/thread.c	(revision abfc9f3fe25d6b047d9f3199bff85443b03ecbc8)
+++ kernel/arch/sparc64/src/proc/thread.c	(revision da0fef6126d5ca1836cfcd2bb32043a899aff458)
@@ -61,5 +61,5 @@
 void thread_create_arch(thread_t *t)
 {
-	if ((t->flags & THREAD_FLAG_USPACE) && (!t->arch.uspace_window_buffer))
+	if ((t->uspace) && (!t->arch.uspace_window_buffer))
 		{
 		/*
Index: kernel/genarch/src/kbrd/kbrd.c
===================================================================
--- kernel/genarch/src/kbrd/kbrd.c	(revision abfc9f3fe25d6b047d9f3199bff85443b03ecbc8)
+++ kernel/genarch/src/kbrd/kbrd.c	(revision da0fef6126d5ca1836cfcd2bb32043a899aff458)
@@ -158,6 +158,6 @@
 	    = malloc(sizeof(kbrd_instance_t), FRAME_ATOMIC);
 	if (instance) {
-		instance->thread
-			= thread_create(kkbrd, (void *) instance, TASK, 0, "kkbrd", false);
+		instance->thread = thread_create(kkbrd, (void *) instance,
+		    TASK, THREAD_FLAG_NONE, "kkbrd");
 		
 		if (!instance->thread) {
Index: kernel/genarch/src/srln/srln.c
===================================================================
--- kernel/genarch/src/srln/srln.c	(revision abfc9f3fe25d6b047d9f3199bff85443b03ecbc8)
+++ kernel/genarch/src/srln/srln.c	(revision da0fef6126d5ca1836cfcd2bb32043a899aff458)
@@ -130,6 +130,6 @@
 	    = malloc(sizeof(srln_instance_t), FRAME_ATOMIC);
 	if (instance) {
-		instance->thread
-			= thread_create(ksrln, (void *) instance, TASK, 0, "ksrln", false);
+		instance->thread = thread_create(ksrln, (void *) instance,
+		    TASK, THREAD_FLAG_NONE, "ksrln");
 		
 		if (!instance->thread) {
Index: kernel/generic/include/proc/thread.h
===================================================================
--- kernel/generic/include/proc/thread.h	(revision abfc9f3fe25d6b047d9f3199bff85443b03ecbc8)
+++ kernel/generic/include/proc/thread.h	(revision da0fef6126d5ca1836cfcd2bb32043a899aff458)
@@ -54,21 +54,13 @@
 
 /* Thread flags */
-
-/** Thread cannot be migrated to another CPU.
- *
- * When using this flag, the caller must set cpu in the thread_t
- * structure manually before calling thread_ready (even on uniprocessor).
- *
- */
-#define THREAD_FLAG_WIRED  (1 << 0)
-
-/** Thread was migrated to another CPU and has not run yet. */
-#define THREAD_FLAG_STOLEN  (1 << 1)
-
-/** Thread executes in userspace. */
-#define THREAD_FLAG_USPACE  (1 << 2)
-
-/** Thread will be attached by the caller. */
-#define THREAD_FLAG_NOATTACH  (1 << 3)
+typedef enum {
+	THREAD_FLAG_NONE = 0,
+	/** Thread executes in user space. */
+	THREAD_FLAG_USPACE = (1 << 0),
+	/** Thread will be attached by the caller. */
+	THREAD_FLAG_NOATTACH = (1 << 1),
+	/** Thread accounting doesn't affect accumulated task accounting. */
+	THREAD_FLAG_UNCOUNTED = (1 << 2)
+} thread_flags_t;
 
 /** Thread structure. There is one per thread. */
@@ -147,5 +139,5 @@
 	
 	fpu_context_t *saved_fpu_context;
-	int fpu_context_exists;
+	bool fpu_context_exists;
 	
 	/*
@@ -154,18 +146,22 @@
 	 * thread. This disables migration.
 	 */
-	int fpu_context_engaged;
+	bool fpu_context_engaged;
 	
 	/* The thread will not be migrated if nomigrate is non-zero. */
-	int nomigrate;
-	
-	/** Thread's state. */
+	unsigned int nomigrate;
+	
+	/** Thread state. */
 	state_t state;
-	/** Thread's flags. */
-	unsigned int flags;
-	
-	/** Thread's CPU. */
+	
+	/** Thread CPU. */
 	cpu_t *cpu;
 	/** Containing task. */
 	task_t *task;
+	/** Thread is wired to CPU. */
+	bool wired;
+	/** Thread was migrated to another CPU and has not run yet. */
+	bool stolen;
+	/** Thread is executed in user space. */
+	bool uspace;
 	
 	/** Ticks before preemption. */
@@ -216,5 +212,6 @@
 extern void thread_init(void);
 extern thread_t *thread_create(void (*)(void *), void *, task_t *,
-    unsigned int, const char *, bool);
+    thread_flags_t, const char *);
+extern void thread_wire(thread_t *, cpu_t *);
 extern void thread_attach(thread_t *, task_t *);
 extern void thread_ready(thread_t *);
Index: kernel/generic/src/console/cmd.c
===================================================================
--- kernel/generic/src/console/cmd.c	(revision abfc9f3fe25d6b047d9f3199bff85443b03ecbc8)
+++ kernel/generic/src/console/cmd.c	(revision da0fef6126d5ca1836cfcd2bb32043a899aff458)
@@ -724,11 +724,7 @@
 		thread_t *thread;
 		if ((thread = thread_create((void (*)(void *)) cmd_call0,
-		    (void *) argv, TASK, THREAD_FLAG_WIRED, "call0", false))) {
-			irq_spinlock_lock(&thread->lock, true);
-			thread->cpu = &cpus[i];
-			irq_spinlock_unlock(&thread->lock, true);
-			
+		    (void *) argv, TASK, THREAD_FLAG_NONE, "call0"))) {
 			printf("cpu%u: ", i);
-			
+			thread_wire(thread, &cpus[i]);
 			thread_ready(thread);
 			thread_join(thread);
Index: kernel/generic/src/ipc/kbox.c
===================================================================
--- kernel/generic/src/ipc/kbox.c	(revision abfc9f3fe25d6b047d9f3199bff85443b03ecbc8)
+++ kernel/generic/src/ipc/kbox.c	(revision da0fef6126d5ca1836cfcd2bb32043a899aff458)
@@ -244,6 +244,6 @@
 	
 	/* Create a kbox thread */
-	thread_t *kb_thread = thread_create(kbox_thread_proc, NULL, task, 0,
-	    "kbox", false);
+	thread_t *kb_thread = thread_create(kbox_thread_proc, NULL, task,
+	    THREAD_FLAG_NONE, "kbox");
 	if (!kb_thread) {
 		mutex_unlock(&task->kb.cleanup_lock);
Index: kernel/generic/src/main/kinit.c
===================================================================
--- kernel/generic/src/main/kinit.c	(revision abfc9f3fe25d6b047d9f3199bff85443b03ecbc8)
+++ kernel/generic/src/main/kinit.c	(revision da0fef6126d5ca1836cfcd2bb32043a899aff458)
@@ -116,9 +116,8 @@
 		 * Just a beautification.
 		 */
-		thread = thread_create(kmp, NULL, TASK, THREAD_FLAG_WIRED, "kmp", true);
+		thread = thread_create(kmp, NULL, TASK,
+		    THREAD_FLAG_UNCOUNTED, "kmp");
 		if (thread != NULL) {
-			irq_spinlock_lock(&thread->lock, false);
-			thread->cpu = &cpus[0];
-			irq_spinlock_unlock(&thread->lock, false);
+			thread_wire(thread, &cpus[0]);
 			thread_ready(thread);
 		} else
@@ -134,9 +133,8 @@
 		
 		for (i = 0; i < config.cpu_count; i++) {
-			thread = thread_create(kcpulb, NULL, TASK, THREAD_FLAG_WIRED, "kcpulb", true);
+			thread = thread_create(kcpulb, NULL, TASK,
+			    THREAD_FLAG_UNCOUNTED, "kcpulb");
 			if (thread != NULL) {
-				irq_spinlock_lock(&thread->lock, false);
-				thread->cpu = &cpus[i];
-				irq_spinlock_unlock(&thread->lock, false);
+				thread_wire(thread, &cpus[i]);
 				thread_ready(thread);
 			} else
@@ -152,5 +150,6 @@
 	
 	/* Start thread computing system load */
-	thread = thread_create(kload, NULL, TASK, 0, "kload", false);
+	thread = thread_create(kload, NULL, TASK, THREAD_FLAG_NONE,
+	    "kload");
 	if (thread != NULL)
 		thread_ready(thread);
@@ -163,5 +162,6 @@
 		 * Create kernel console.
 		 */
-		thread = thread_create(kconsole_thread, NULL, TASK, 0, "kconsole", false);
+		thread = thread_create(kconsole_thread, NULL, TASK,
+		    THREAD_FLAG_NONE, "kconsole");
 		if (thread != NULL)
 			thread_ready(thread);
Index: kernel/generic/src/main/main.c
===================================================================
--- kernel/generic/src/main/main.c	(revision abfc9f3fe25d6b047d9f3199bff85443b03ecbc8)
+++ kernel/generic/src/main/main.c	(revision da0fef6126d5ca1836cfcd2bb32043a899aff458)
@@ -276,6 +276,6 @@
 	 * Create the first thread.
 	 */
-	thread_t *kinit_thread =
-	    thread_create(kinit, NULL, kernel, 0, "kinit", true);
+	thread_t *kinit_thread = thread_create(kinit, NULL, kernel,
+	    THREAD_FLAG_UNCOUNTED, "kinit");
 	if (!kinit_thread)
 		panic("Cannot create kinit thread.");
Index: kernel/generic/src/proc/program.c
===================================================================
--- kernel/generic/src/proc/program.c	(revision abfc9f3fe25d6b047d9f3199bff85443b03ecbc8)
+++ kernel/generic/src/proc/program.c	(revision da0fef6126d5ca1836cfcd2bb32043a899aff458)
@@ -102,5 +102,5 @@
 	 */
 	prg->main_thread = thread_create(uinit, kernel_uarg, prg->task,
-	    THREAD_FLAG_USPACE, "uinit", false);
+	    THREAD_FLAG_USPACE, "uinit");
 	if (!prg->main_thread) {
 		free(kernel_uarg);
Index: kernel/generic/src/proc/scheduler.c
===================================================================
--- kernel/generic/src/proc/scheduler.c	(revision abfc9f3fe25d6b047d9f3199bff85443b03ecbc8)
+++ kernel/generic/src/proc/scheduler.c	(revision da0fef6126d5ca1836cfcd2bb32043a899aff458)
@@ -98,5 +98,5 @@
 	else {
 		fpu_init();
-		THREAD->fpu_context_exists = 1;
+		THREAD->fpu_context_exists = true;
 	}
 #endif
@@ -142,5 +142,5 @@
 		
 		/* Don't prevent migration */
-		CPU->fpu_owner->fpu_context_engaged = 0;
+		CPU->fpu_owner->fpu_context_engaged = false;
 		irq_spinlock_unlock(&CPU->fpu_owner->lock, false);
 		CPU->fpu_owner = NULL;
@@ -163,9 +163,9 @@
 		}
 		fpu_init();
-		THREAD->fpu_context_exists = 1;
+		THREAD->fpu_context_exists = true;
 	}
 	
 	CPU->fpu_owner = THREAD;
-	THREAD->fpu_context_engaged = 1;
+	THREAD->fpu_context_engaged = true;
 	irq_spinlock_unlock(&THREAD->lock, false);
 	
@@ -248,8 +248,8 @@
 		
 		/*
-		 * Clear the THREAD_FLAG_STOLEN flag so that t can be migrated
+		 * Clear the stolen flag so that it can be migrated
 		 * when load balancing needs emerge.
 		 */
-		thread->flags &= ~THREAD_FLAG_STOLEN;
+		thread->stolen = false;
 		irq_spinlock_unlock(&thread->lock, false);
 		
@@ -630,8 +630,7 @@
 				irq_spinlock_lock(&thread->lock, false);
 				
-				if (!(thread->flags & THREAD_FLAG_WIRED) &&
-				    !(thread->flags & THREAD_FLAG_STOLEN) &&
-				    !thread->nomigrate &&
-				    !thread->fpu_context_engaged) {
+				if ((!thread->wired) && (!thread->stolen) &&
+				    (!thread->nomigrate) &&
+				    (!thread->fpu_context_engaged)) {
 					/*
 					 * Remove thread from ready queue.
@@ -670,5 +669,5 @@
 #endif
 				
-				thread->flags |= THREAD_FLAG_STOLEN;
+				thread->stolen = true;
 				thread->state = Entering;
 				
Index: kernel/generic/src/proc/thread.c
===================================================================
--- kernel/generic/src/proc/thread.c	(revision abfc9f3fe25d6b047d9f3199bff85443b03ecbc8)
+++ kernel/generic/src/proc/thread.c	(revision da0fef6126d5ca1836cfcd2bb32043a899aff458)
@@ -191,5 +191,5 @@
 	kmflags |= FRAME_LOWMEM;
 	kmflags &= ~FRAME_HIGHMEM;
-
+	
 	thread->kstack = (uint8_t *) frame_alloc(STACK_FRAMES, FRAME_KA | kmflags);
 	if (!thread->kstack) {
@@ -247,4 +247,17 @@
 }
 
+/** Wire thread to the given CPU
+ *
+ * @param cpu CPU to wire the thread to.
+ *
+ */
+void thread_wire(thread_t *thread, cpu_t *cpu)
+{
+	irq_spinlock_lock(&thread->lock, true);
+	thread->cpu = cpu;
+	thread->wired = true;
+	irq_spinlock_unlock(&thread->lock, true);
+}
+
 /** Make thread ready
  *
@@ -260,12 +273,14 @@
 	ASSERT(thread->state != Ready);
 	
-	int i = (thread->priority < RQ_COUNT - 1)
-	    ? ++thread->priority : thread->priority;
-	
-	cpu_t *cpu = CPU;
-	if (thread->flags & THREAD_FLAG_WIRED) {
+	int i = (thread->priority < RQ_COUNT - 1) ?
+	    ++thread->priority : thread->priority;
+	
+	cpu_t *cpu;
+	if (thread->wired) {
 		ASSERT(thread->cpu != NULL);
 		cpu = thread->cpu;
-	}
+	} else
+		cpu = CPU;
+	
 	thread->state = Ready;
 	
@@ -298,6 +313,4 @@
  * @param flags     Thread flags.
  * @param name      Symbolic name (a copy is made).
- * @param uncounted Thread's accounting doesn't affect accumulated task
- *                  accounting.
  *
  * @return New thread's structure on success, NULL on failure.
@@ -305,5 +318,5 @@
  */
 thread_t *thread_create(void (* func)(void *), void *arg, task_t *task,
-    unsigned int flags, const char *name, bool uncounted)
+    thread_flags_t flags, const char *name)
 {
 	thread_t *thread = (thread_t *) slab_alloc(thread_slab, 0);
@@ -335,8 +348,13 @@
 	thread->ucycles = 0;
 	thread->kcycles = 0;
-	thread->uncounted = uncounted;
+	thread->uncounted =
+	    ((flags & THREAD_FLAG_UNCOUNTED) == THREAD_FLAG_UNCOUNTED);
 	thread->priority = -1;          /* Start in rq[0] */
 	thread->cpu = NULL;
-	thread->flags = flags;
+	thread->wired = false;
+	thread->stolen = false;
+	thread->uspace =
+	    ((flags & THREAD_FLAG_USPACE) == THREAD_FLAG_USPACE);
+	
 	thread->nomigrate = 0;
 	thread->state = Entering;
@@ -356,6 +374,6 @@
 	thread->task = task;
 	
-	thread->fpu_context_exists = 0;
-	thread->fpu_context_engaged = 0;
+	thread->fpu_context_exists = false;
+	thread->fpu_context_engaged = false;
 	
 	avltree_node_initialize(&thread->threads_tree_node);
@@ -371,5 +389,5 @@
 	thread_create_arch(thread);
 	
-	if (!(flags & THREAD_FLAG_NOATTACH))
+	if ((flags & THREAD_FLAG_NOATTACH) != THREAD_FLAG_NOATTACH)
 		thread_attach(thread, task);
 	
@@ -437,5 +455,5 @@
 	
 	/* Must not count kbox thread into lifecount */
-	if (thread->flags & THREAD_FLAG_USPACE)
+	if (thread->uspace)
 		atomic_inc(&task->lifecount);
 	
@@ -459,9 +477,9 @@
 void thread_exit(void)
 {
-	if (THREAD->flags & THREAD_FLAG_USPACE) {
+	if (THREAD->uspace) {
 #ifdef CONFIG_UDEBUG
 		/* Generate udebug THREAD_E event */
 		udebug_thread_e_event();
-
+		
 		/*
 		 * This thread will not execute any code or system calls from
@@ -506,5 +524,5 @@
 {
 	ASSERT(THREAD);
-
+	
 	THREAD->nomigrate++;
 }
@@ -515,6 +533,7 @@
 	ASSERT(THREAD);
 	ASSERT(THREAD->nomigrate > 0);
-
-	THREAD->nomigrate--;
+	
+	if (THREAD->nomigrate > 0)
+		THREAD->nomigrate--;
 }
 
@@ -865,5 +884,5 @@
 	
 	thread_t *thread = thread_create(uinit, kernel_uarg, TASK,
-	    THREAD_FLAG_USPACE | THREAD_FLAG_NOATTACH, namebuf, false);
+	    THREAD_FLAG_USPACE | THREAD_FLAG_NOATTACH, namebuf);
 	if (thread) {
 		if (uspace_thread_id != NULL) {
Index: kernel/generic/src/udebug/udebug.c
===================================================================
--- kernel/generic/src/udebug/udebug.c	(revision abfc9f3fe25d6b047d9f3199bff85443b03ecbc8)
+++ kernel/generic/src/udebug/udebug.c	(revision da0fef6126d5ca1836cfcd2bb32043a899aff458)
@@ -410,8 +410,7 @@
 		
 		mutex_lock(&thread->udebug.lock);
-		unsigned int flags = thread->flags;
 		
 		/* Only process userspace threads. */
-		if ((flags & THREAD_FLAG_USPACE) != 0) {
+		if (thread->uspace) {
 			/* Prevent any further debug activity in thread. */
 			thread->udebug.active = false;
Index: kernel/generic/src/udebug/udebug_ops.c
===================================================================
--- kernel/generic/src/udebug/udebug_ops.c	(revision abfc9f3fe25d6b047d9f3199bff85443b03ecbc8)
+++ kernel/generic/src/udebug/udebug_ops.c	(revision da0fef6126d5ca1836cfcd2bb32043a899aff458)
@@ -95,5 +95,5 @@
 	
 	/* Verify that 'thread' is a userspace thread. */
-	if ((thread->flags & THREAD_FLAG_USPACE) == 0) {
+	if (!thread->uspace) {
 		/* It's not, deny its existence */
 		irq_spinlock_unlock(&thread->lock, true);
@@ -200,5 +200,5 @@
 		
 		mutex_lock(&thread->udebug.lock);
-		if ((thread->flags & THREAD_FLAG_USPACE) != 0) {
+		if (thread->uspace) {
 			thread->udebug.active = true;
 			mutex_unlock(&thread->udebug.lock);
@@ -393,9 +393,9 @@
 		
 		irq_spinlock_lock(&thread->lock, false);
-		int flags = thread->flags;
+		bool uspace = thread->uspace;
 		irq_spinlock_unlock(&thread->lock, false);
 		
 		/* Not interested in kernel threads. */
-		if ((flags & THREAD_FLAG_USPACE) == 0)
+		if (!uspace)
 			continue;
 		
Index: kernel/test/mm/falloc2.c
===================================================================
--- kernel/test/mm/falloc2.c	(revision abfc9f3fe25d6b047d9f3199bff85443b03ecbc8)
+++ kernel/test/mm/falloc2.c	(revision da0fef6126d5ca1836cfcd2bb32043a899aff458)
@@ -122,6 +122,6 @@
 	
 	for (unsigned int i = 0; i < THREADS; i++) {
-		thread_t *thrd =
-		    thread_create(falloc, NULL, TASK, 0, "falloc2", false);
+		thread_t *thrd = thread_create(falloc, NULL, TASK,
+		    THREAD_FLAG_NONE, "falloc2");
 		if (!thrd) {
 			TPRINTF("Could not create thread %u\n", i);
Index: kernel/test/mm/slab1.c
===================================================================
--- kernel/test/mm/slab1.c	(revision abfc9f3fe25d6b047d9f3199bff85443b03ecbc8)
+++ kernel/test/mm/slab1.c	(revision da0fef6126d5ca1836cfcd2bb32043a899aff458)
@@ -155,6 +155,6 @@
 	
 	semaphore_initialize(&thr_sem, 0);
-	for (i = 0; i < THREADS; i++) {  
-		if (!(t = thread_create(slabtest, (void *) (sysarg_t) i, TASK, 0, "slabtest", false))) {
+	for (i = 0; i < THREADS; i++) {
+		if (!(t = thread_create(slabtest, (void *) (sysarg_t) i, TASK, THREAD_FLAG_NONE, "slabtest"))) {
 			TPRINTF("Could not create thread %d\n", i);
 		} else
Index: kernel/test/mm/slab2.c
===================================================================
--- kernel/test/mm/slab2.c	(revision abfc9f3fe25d6b047d9f3199bff85443b03ecbc8)
+++ kernel/test/mm/slab2.c	(revision da0fef6126d5ca1836cfcd2bb32043a899aff458)
@@ -211,5 +211,5 @@
 	semaphore_initialize(&thr_sem,0);
 	for (i = 0; i < THREADS; i++) {
-		if (!(t = thread_create(slabtest, NULL, TASK, 0, "slabtest", false))) {
+		if (!(t = thread_create(slabtest, NULL, TASK, THREAD_FLAG_NONE, "slabtest"))) {
 			TPRINTF("Could not create thread %d\n", i);
 		} else
Index: kernel/test/synch/semaphore1.c
===================================================================
--- kernel/test/synch/semaphore1.c	(revision abfc9f3fe25d6b047d9f3199bff85443b03ecbc8)
+++ kernel/test/synch/semaphore1.c	(revision da0fef6126d5ca1836cfcd2bb32043a899aff458)
@@ -93,5 +93,6 @@
 		for (j = 0; j < (CONSUMERS + PRODUCERS) / 2; j++) {
 			for (k = 0; k < i; k++) {
-				thrd = thread_create(consumer, NULL, TASK, 0, "consumer", false);
+				thrd = thread_create(consumer, NULL, TASK,
+				    THREAD_FLAG_NONE, "consumer");
 				if (thrd)
 					thread_ready(thrd);
@@ -100,5 +101,6 @@
 			}
 			for (k = 0; k < (4 - i); k++) {
-				thrd = thread_create(producer, NULL, TASK, 0, "producer", false);
+				thrd = thread_create(producer, NULL, TASK,
+				    THREAD_FLAG_NONE, "producer");
 				if (thrd)
 					thread_ready(thrd);
Index: kernel/test/synch/semaphore2.c
===================================================================
--- kernel/test/synch/semaphore2.c	(revision abfc9f3fe25d6b047d9f3199bff85443b03ecbc8)
+++ kernel/test/synch/semaphore2.c	(revision da0fef6126d5ca1836cfcd2bb32043a899aff458)
@@ -93,5 +93,6 @@
 	TPRINTF("Creating %" PRIu32 " consumers\n", k);
 	for (i = 0; i < k; i++) {
-		thrd = thread_create(consumer, NULL, TASK, 0, "consumer", false);
+		thrd = thread_create(consumer, NULL, TASK,
+		    THREAD_FLAG_NONE, "consumer");
 		if (thrd)
 			thread_ready(thrd);
Index: kernel/test/thread/thread1.c
===================================================================
--- kernel/test/thread/thread1.c	(revision abfc9f3fe25d6b047d9f3199bff85443b03ecbc8)
+++ kernel/test/thread/thread1.c	(revision da0fef6126d5ca1836cfcd2bb32043a899aff458)
@@ -63,5 +63,6 @@
 	for (i = 0; i < THREADS; i++) {
 		thread_t *t;
-		if (!(t = thread_create(threadtest, NULL, TASK, 0, "threadtest", false))) {
+		if (!(t = thread_create(threadtest, NULL, TASK,
+		    THREAD_FLAG_NONE, "threadtest"))) {
 			TPRINTF("Could not create thread %d\n", i);
 			break;
