Index: arch/ia32/src/cpu/cpu.c
===================================================================
--- arch/ia32/src/cpu/cpu.c	(revision 2968fe29b85195e4cb1bced263ec3f04ff0684c7)
+++ arch/ia32/src/cpu/cpu.c	(revision cb4b61d90a7db05768043294b12025328b4f7a02)
@@ -105,5 +105,5 @@
 }
 
-void cpu_print_report(struct cpu* m)
+void cpu_print_report(cpu_t* m)
 {
 	printf("cpu%d: (%s family=%d model=%d stepping=%d) %dMHz\n",
Index: arch/ia32/src/interrupt.c
===================================================================
--- arch/ia32/src/interrupt.c	(revision 2968fe29b85195e4cb1bced263ec3f04ff0684c7)
+++ arch/ia32/src/interrupt.c	(revision cb4b61d90a7db05768043294b12025328b4f7a02)
@@ -35,4 +35,5 @@
 #include <arch/asm.h>
 #include <mm/tlb.h>
+#include <arch.h>
 
 /*
@@ -91,6 +92,6 @@
 void syscall(__u8 n, __u32 stack[])
 {
-	printf("syscall... ");
-	thread_sleep(1);
+	printf("cpu%d: syscall\n", CPU->id);
+	thread_usleep(600);
 }
 
Index: arch/ia32/src/pm.c
===================================================================
--- arch/ia32/src/pm.c	(revision 2968fe29b85195e4cb1bced263ec3f04ff0684c7)
+++ arch/ia32/src/pm.c	(revision cb4b61d90a7db05768043294b12025328b4f7a02)
@@ -66,5 +66,5 @@
 struct tss *tss_p = NULL;
 
-/* gdtr changes everytime new CPU is initialized */
+/* gdtr is changed by kmp before next CPU is initialized */
 struct ptr_16_32 gdtr __attribute__ ((section ("K_DATA_START"))) = { .limit = sizeof(gdt), .base = (__address) gdt };
 struct ptr_16_32 idtr __attribute__ ((section ("K_DATA_START")))= { .limit = sizeof(idt), .base = (__address) idt };
Index: arch/ia32/src/proc/scheduler.c
===================================================================
--- arch/ia32/src/proc/scheduler.c	(revision cb4b61d90a7db05768043294b12025328b4f7a02)
+++ arch/ia32/src/proc/scheduler.c	(revision cb4b61d90a7db05768043294b12025328b4f7a02)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2005 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <proc/scheduler.h>
+#include <cpu.h>
+#include <proc/thread.h>
+#include <arch.h>
+
+void before_thread_runs(void)
+{
+	CPU->arch.tss->esp0 = (__address) &THREAD->kstack[THREAD_STACK_SIZE-8];
+        CPU->arch.tss->ss0 = selector(KDATA_DES);	
+}
Index: arch/ia32/src/userspace.c
===================================================================
--- arch/ia32/src/userspace.c	(revision 2968fe29b85195e4cb1bced263ec3f04ff0684c7)
+++ arch/ia32/src/userspace.c	(revision cb4b61d90a7db05768043294b12025328b4f7a02)
@@ -39,11 +39,5 @@
 	
 	pri = cpu_priority_high();
-	
-	/*
-	 * Prepare TSS stack selector and pointers for next syscall.
-	 */
-	CPU->arch.tss->esp0 = (__address) &THREAD->kstack[THREAD_STACK_SIZE-8];
-	CPU->arch.tss->ss0 = selector(KDATA_DES);
-	
+
 	__asm__ volatile (""
 	    "pushl %0\n"
