Index: kernel/generic/src/proc/thread.c
===================================================================
--- kernel/generic/src/proc/thread.c	(revision cfffb29045b608bdb22354635488347597622ae3)
+++ kernel/generic/src/proc/thread.c	(revision 9314ee12dbab7b901af6bd9906a7c6a1fa0aa885)
@@ -130,4 +130,7 @@
 	link_initialize(&t->wq_link);
 	link_initialize(&t->th_link);
+
+	/* call the architecture-specific part of the constructor */
+	thr_constructor_arch(t);
 	
 #ifdef ARCH_HAS_FPU
@@ -157,4 +160,7 @@
 {
 	thread_t *t = (thread_t *) obj;
+
+	/* call the architecture-specific part of the destructor */
+	thr_destructor_arch(t);
 
 	frame_free(KA2PA(t->kstack));
@@ -211,5 +217,5 @@
 	
 	cpu = CPU;
-	if (t->flags & X_WIRED) {
+	if (t->flags & THREAD_FLAG_WIRED) {
 		cpu = t->cpu;
 	}
@@ -296,6 +302,4 @@
 	if (!t)
 		return NULL;
-
-	thread_create_arch(t);
 	
 	/* Not needed, but good for debugging */
@@ -324,5 +328,5 @@
 	t->priority = -1;		/* start in rq[0] */
 	t->cpu = NULL;
-	t->flags = 0;
+	t->flags = flags;
 	t->state = Entering;
 	t->call_me = NULL;
@@ -348,4 +352,6 @@
 	t->fpu_context_exists = 0;
 	t->fpu_context_engaged = 0;
+
+	thread_create_arch(t);		/* might depend on previous initialization */
 	
 	/*
@@ -590,5 +596,5 @@
 	}
 
-	if ((t = thread_create(uinit, kernel_uarg, TASK, 0, namebuf))) {
+	if ((t = thread_create(uinit, kernel_uarg, TASK, THREAD_FLAG_USPACE, namebuf))) {
 		tid = t->tid;
 		thread_ready(t);
