Index: arch/amd64/Makefile.inc
===================================================================
--- arch/amd64/Makefile.inc	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ arch/amd64/Makefile.inc	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -11,5 +11,5 @@
 DEFS=-DARCH=$(ARCH)
 CPPFLAGS=$(DEFS) -nostdinc -I../include
-CFLAGS=$(CPPFLAGS) -nostdlib -fno-builtin -fno-unwind-tables -Wmissing-prototypes -Werror -O3 -march=opteron -m64 -mcmodel=kernel -mno-red-zone
+CFLAGS=$(CPPFLAGS) -nostdlib -fno-builtin -fno-unwind-tables -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3 -march=opteron -m64 -mcmodel=kernel -mno-red-zone
 LFLAGS=-M -T ../arch/amd64/_link.ld
 
Index: arch/ia32/Makefile.inc
===================================================================
--- arch/ia32/Makefile.inc	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ arch/ia32/Makefile.inc	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -14,5 +14,5 @@
 
 CPPFLAGS=$(DEFS) -nostdinc -I../include
-CFLAGS=$(CPPFLAGS) -nostdlib -fno-builtin -fomit-frame-pointer -Wmissing-prototypes -Werror -O3
+CFLAGS=$(CPPFLAGS) -nostdlib -fno-builtin -fomit-frame-pointer -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3
 LFLAGS=-M -no-check-sections -T ../arch/ia32/_link.ld
 
Index: arch/ia32/include/asm.h
===================================================================
--- arch/ia32/include/asm.h	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ arch/ia32/include/asm.h	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -52,4 +52,9 @@
 
 extern void enable_l_apic_in_msr(void);
+
+
+void asm_delay_loop(__u32 t);
+void asm_fake_loop(__u32 t);
+
 
 /** Halt CPU
Index: arch/ia32/src/acpi/acpi.c
===================================================================
--- arch/ia32/src/acpi/acpi.c	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ arch/ia32/src/acpi/acpi.c	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -32,4 +32,5 @@
 
 #include <mm/page.h>
+#include <print.h>
 
 #define RSDP_SIGNATURE		"RSD PTR "
Index: arch/ia32/src/acpi/madt.c
===================================================================
--- arch/ia32/src/acpi/madt.c	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ arch/ia32/src/acpi/madt.c	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -36,4 +36,5 @@
 #include <debug.h>
 #include <config.h>
+#include <print.h>
 
 struct acpi_madt *acpi_madt = NULL;
Index: arch/ia32/src/drivers/ega.c
===================================================================
--- arch/ia32/src/drivers/ega.c	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ arch/ia32/src/drivers/ega.c	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -34,4 +34,5 @@
 #include <arch/types.h>
 #include <arch/asm.h>
+#include <memstr.h>
 
 /*
@@ -73,5 +74,5 @@
 		return;
 
-	memcopy(PA2KA(VIDEORAM) + ROW*2, PA2KA(VIDEORAM), (SCREEN - ROW)*2);
+	memcopy((void *)PA2KA(VIDEORAM),(void *)PA2KA(VIDEORAM) + ROW*2, (SCREEN - ROW)*2); //swaped
 	memsetw(PA2KA(VIDEORAM) + (SCREEN - ROW)*2, ROW, 0x0720);
 	ega_cursor = ega_cursor - ROW;
Index: arch/ia32/src/drivers/i8254.c
===================================================================
--- arch/ia32/src/drivers/i8254.c	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ arch/ia32/src/drivers/i8254.c	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -37,5 +37,7 @@
 #include <arch/pm.h>
 #include <arch/asm.h>
+#include <arch/cpuid.h>
 #include <arch.h>
+#include <time/delay.h>
 
 /*
Index: arch/ia32/src/drivers/i8259.c
===================================================================
--- arch/ia32/src/drivers/i8259.c	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ arch/ia32/src/drivers/i8259.c	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -32,4 +32,5 @@
 #include <arch/asm.h>
 #include <arch.h>
+#include <print.h>
 
 /*
Index: arch/ia32/src/ia32.c
===================================================================
--- arch/ia32/src/ia32.c	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ arch/ia32/src/ia32.c	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -46,5 +46,9 @@
 #include <arch/asm.h>
 #include <arch/acpi/acpi.h>
+
+#include <arch/bios/bios.h>
+
 #include <arch/mm/memory_init.h>
+
 
 void arch_pre_mm_init(void)
Index: arch/ia32/src/mm/memory_init.c
===================================================================
--- arch/ia32/src/mm/memory_init.c	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ arch/ia32/src/mm/memory_init.c	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -29,4 +29,5 @@
 #include <arch/boot/memmap.h>
 #include <arch/mm/memory_init.h>
+#include <print.h>
 
 size_t get_memory_size(void) 
Index: arch/ia32/src/mm/page.c
===================================================================
--- arch/ia32/src/mm/page.c	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ arch/ia32/src/mm/page.c	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -37,4 +37,5 @@
 #include <synch/spinlock.h>
 #include <debug.h>
+#include <memstr.h>
 
 __address bootstrap_dba; 
@@ -72,5 +73,5 @@
 
 		dba = frame_alloc(FRAME_KA | FRAME_PANIC);
-		memcopy(bootstrap_dba, dba, PAGE_SIZE);
+		memcopy((void *)dba,(void *)bootstrap_dba , PAGE_SIZE); //swaped
 		write_cr3(KA2PA(dba));
 	}
Index: arch/ia32/src/pm.c
===================================================================
--- arch/ia32/src/pm.c	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ arch/ia32/src/pm.c	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -36,4 +36,6 @@
 #include <panic.h>
 #include <arch/mm/page.h>
+#include <mm/heap.h>
+#include <memstr.h>
 
 /*
Index: arch/ia32/src/smp/mps.c
===================================================================
--- arch/ia32/src/smp/mps.c	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ arch/ia32/src/smp/mps.c	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -41,4 +41,5 @@
 #include <arch/asm.h>
 #include <arch/bios/bios.h>
+#include <mm/frame.h>
 
 /*
Index: arch/ia32/src/smp/smp.c
===================================================================
--- arch/ia32/src/smp/smp.c	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ arch/ia32/src/smp/smp.c	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -43,4 +43,7 @@
 #include <mm/page.h>
 #include <mm/heap.h>
+#include <print.h>
+#include <memstr.h>
+#include <arch/i8259.h>
 
 #ifdef __SMP__
@@ -137,6 +140,6 @@
 			panic("couldn't allocate memory for GDT\n");
 
-		memcopy(gdt, gdt_new, GDT_ITEMS*sizeof(struct descriptor));
-		memsetb(&gdt_new[TSS_DES], sizeof(struct descriptor), 0);
+		memcopy(gdt_new, gdt, GDT_ITEMS*sizeof(struct descriptor));           // swaped
+		memsetb((__address)(&gdt_new[TSS_DES]), sizeof(struct descriptor), 0);
 		gdtr.base = KA2PA((__address) gdt_new);
 
Index: arch/ia64/Makefile.inc
===================================================================
--- arch/ia64/Makefile.inc	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ arch/ia64/Makefile.inc	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -12,5 +12,5 @@
 DEFS=-DARCH=$(ARCH)
 CPPFLAGS=$(DEFS) -nostdinc -I../include
-CFLAGS=$(CPPFLAGS) -mconstant-gp -nostdlib -fno-builtin -fno-unwind-tables -Wmissing-prototypes -Werror -O3
+CFLAGS=$(CPPFLAGS) -mconstant-gp -nostdlib -fno-builtin -fno-unwind-tables -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3
 LFLAGS=-EL -M -T ../arch/ia64/_link.ld
 
Index: arch/ia64/include/asm.h
===================================================================
--- arch/ia64/include/asm.h	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ arch/ia64/include/asm.h	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -48,3 +48,8 @@
 }
 
+
+void cpu_sleep(void);
+
+void asm_delay_loop(__u32 t);
+
 #endif
Index: arch/mips/Makefile.inc
===================================================================
--- arch/mips/Makefile.inc	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ arch/mips/Makefile.inc	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -12,5 +12,5 @@
 DEFS=-DARCH=$(ARCH)
 CPPFLAGS=$(DEFS) -mno-abicalls -nostdinc -I../include
-CFLAGS=$(CPPFLAGS) -mips2 -G 0 -nostdlib -fno-builtin -Wmissing-prototypes -Werror -O2
+CFLAGS=$(CPPFLAGS) -mips2 -G 0 -nostdlib -fno-builtin -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O2
 LFLAGS=-mips2 -M -no-check-sections -T ../arch/mips/_link.ld
 
Index: arch/mips/include/asm.h
===================================================================
--- arch/mips/include/asm.h	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ arch/mips/include/asm.h	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -50,3 +50,6 @@
 }
 
+void asm_delay_loop(__u32 t);
+
+
 #endif
Index: arch/mips/src/cpu/cpu.c
===================================================================
--- arch/mips/src/cpu/cpu.c	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ arch/mips/src/cpu/cpu.c	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -35,4 +35,5 @@
 
 #include <typedefs.h>
+#include <print.h>
 
 struct {
Index: arch/mips/src/exception.c
===================================================================
--- arch/mips/src/exception.c	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ arch/mips/src/exception.c	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -28,4 +28,5 @@
 
 #include <arch/exception.h>
+#include <arch/interrupt.h>
 #include <panic.h>
 #include <arch/cp0.h>
Index: arch/mips/src/mm/page.c
===================================================================
--- arch/mips/src/mm/page.c	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ arch/mips/src/mm/page.c	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -32,4 +32,5 @@
 #include <mm/frame.h>
 #include <mm/page.h>
+#include <memstr.h>
 
 pte_t *PTL0 = NULL;
Index: arch/mips/src/mm/tlb.c
===================================================================
--- arch/mips/src/mm/tlb.c	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ arch/mips/src/mm/tlb.c	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -34,4 +34,9 @@
 #include <arch.h>
 
+void main_bsp(void);
+
+
+
+
 int bootstrap = 1;
 
Index: arch/ppc/Makefile.inc
===================================================================
--- arch/ppc/Makefile.inc	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ arch/ppc/Makefile.inc	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -12,5 +12,5 @@
 DEFS=-DARCH=$(ARCH)
 CPPFLAGS=$(DEFS) -nostdinc -I../include
-CFLAGS=$(CPPFLAGS) -nostdlib -fno-builtin -Wmissing-prototypes -Werror -O2
+CFLAGS=$(CPPFLAGS) -nostdlib -fno-builtin -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O2
 LFLAGS=-M -no-check-sections -T ../arch/ppc/_link.ld
 
Index: include/cpu.h
===================================================================
--- include/cpu.h	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ include/cpu.h	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -75,4 +75,6 @@
 
 extern void cpu_init(void);
+extern void cpu_halt(void);
+
 extern void cpu_arch_init(void);
 extern void cpu_identify(void);
Index: include/memstr.h
===================================================================
--- include/memstr.h	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ include/memstr.h	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -33,5 +33,5 @@
 #include <arch/types.h>
 
-extern void memcopy(__address src, __address dst, size_t cnt);
+extern char *  memcopy(void * dst, const void *src, size_t cnt);
 
 extern void memsetw(__address dst, size_t cnt, __u16 x);
@@ -43,5 +43,5 @@
  * Architecture independent variants.
  */
-extern void _memcopy(__address src, __address dst, size_t cnt);
+extern char * _memcopy(void *dst, const void *src, size_t cnt);
 extern void _memsetb(__address dst, size_t cnt, __u8 x);
 
Index: src/Makefile.config
===================================================================
--- src/Makefile.config	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ src/Makefile.config	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -35,2 +35,3 @@
 #TEST_DIR=fpu/fpu1
 #TEST_DIR=print/print1
+TEST_DIR=thread/thread1
Index: src/debug/print.c
===================================================================
--- src/debug/print.c	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ src/debug/print.c	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -32,4 +32,5 @@
 #include <arch/arg.h>
 #include <arch/asm.h>
+#include <arch.h>
 
 
Index: src/lib/memstr.c
===================================================================
--- src/lib/memstr.c	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ src/lib/memstr.c	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -42,5 +42,7 @@
  *
  */
-void _memcopy(__address src, __address dst, size_t cnt)
+
+char *  _memcopy(void * dst,const void *src, size_t cnt);
+char *  _memcopy(void * dst,const void *src, size_t cnt)
 {
 	int i;
@@ -48,4 +50,6 @@
 	for (i=0; i<cnt; i++)
 		*((__u8 *) (dst + i)) = *((__u8 *) (src + i));
+		
+	return (char *)src;
 }
 
Index: src/main/kinit.c
===================================================================
--- src/main/kinit.c	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ src/main/kinit.c	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -41,4 +41,5 @@
 #include <arch/mm/page.h>
 #include <mm/vm.h>
+#include <print.h>
 
 #ifdef __SMP__
Index: src/main/uinit.c
===================================================================
--- src/main/uinit.c	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ src/main/uinit.c	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -31,4 +31,6 @@
 #include <proc/thread.h>
 #include <userspace.h>
+#include <print.h>
+
 
 void uinit(void *arg)
Index: src/mm/frame.c
===================================================================
--- src/mm/frame.c	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ src/mm/frame.c	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -44,4 +44,5 @@
 
 #include <arch/asm.h>
+#include <arch.h>
 
 count_t frames = 0;
Index: src/mm/heap.c
===================================================================
--- src/mm/heap.c	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ src/mm/heap.c	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -34,4 +34,5 @@
 #include <arch/types.h>
 #include <arch/asm.h>
+#include <arch.h>
 
 /*
Index: src/mm/page.c
===================================================================
--- src/mm/page.c	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ src/mm/page.c	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -33,4 +33,6 @@
 #include <typedefs.h>
 #include <arch/asm.h>
+#include <memstr.h>
+
 
 void page_init(void)
Index: src/mm/vm.c
===================================================================
--- src/mm/vm.c	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ src/mm/vm.c	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -41,4 +41,6 @@
 #include <arch/asm.h>
 #include <debug.h>
+#include <memstr.h>
+#include <arch.h>
 
 #define KAS_START_INDEX		PTL0_INDEX(KERNEL_ADDRESS_SPACE_START)
@@ -67,5 +69,5 @@
 //			memsetb((__address) dst_ptl0, PAGE_SIZE, 0);
 //			memcopy((__address) &src_ptl0[KAS_START_INDEX], (__address) &dst_ptl0[KAS_START_INDEX], KAS_INDICES*sizeof(pte_t));
-			memcopy(PA2KA((__address) GET_PTL0_ADDRESS()), (__address) dst_ptl0, PAGE_SIZE);
+			memcopy((void *)PA2KA((__address) dst_ptl0), (void *)GET_PTL0_ADDRESS() , PAGE_SIZE);
 			m->ptl0 = (pte_t *) KA2PA((__address) dst_ptl0);
 		}
Index: src/proc/scheduler.c
===================================================================
--- src/proc/scheduler.c	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ src/proc/scheduler.c	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -44,4 +44,8 @@
 #include <arch/faddr.h>
 #include <arch/atomic.h>
+#include <print.h>
+#include <mm/frame.h>
+#include <mm/heap.h>
+
 
 volatile int nrdy;
@@ -358,6 +362,7 @@
 		THREAD = NULL;
 	}
-
+	printf("*0*");
 	THREAD = find_best_thread();
+	printf("*1*");
 	
 	spinlock_lock(&THREAD->lock);
Index: src/proc/thread.c
===================================================================
--- src/proc/thread.c	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ src/proc/thread.c	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -51,4 +51,5 @@
 #include <arch/faddr.h>
 #include <arch/atomic.h>
+#include <memstr.h>
 
 char *thread_states[] = {"Invalid", "Running", "Sleeping", "Ready", "Entering", "Exiting"}; /**< Thread states */
Index: src/synch/semaphore.c
===================================================================
--- src/synch/semaphore.c	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ src/synch/semaphore.c	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -32,4 +32,5 @@
 #include <synch/spinlock.h>
 #include <arch/asm.h>
+#include <arch.h>
 
 void semaphore_initialize(semaphore_t *s, int val)
Index: src/synch/spinlock.c
===================================================================
--- src/synch/spinlock.c	(revision 8fc0d4553a1a8e382979ca225a7ae2d3e376d1a2)
+++ src/synch/spinlock.c	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -32,4 +32,5 @@
 #include <arch/barrier.h>
 #include <synch/spinlock.h>
+#include <print.h>
 
 #ifdef __SMP__
Index: test/thread/thread1/test.c
===================================================================
--- test/thread/thread1/test.c	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
+++ test/thread/thread1/test.c	(revision 9c0a9b3057ce928cdefd80ab4215be954d01adb1)
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2005 Jakub Vana
+ * 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 <print.h>
+#include <debug.h>
+#include <panic.h>
+
+#include <test.h>
+#include <arch/atomic.h>
+#include <proc/thread.h>
+
+#include <arch.h>
+
+
+
+#define THREADS 5
+
+
+static void thread(void *data)
+{
+    while(1)
+    {
+        printf("%d\n",(int)(THREAD->tid));
+	scheduler();
+    }
+}
+
+
+
+void test(void)
+{
+	thread_t *t;
+	int i;
+
+
+
+	for (i=0; i<THREADS; i++) 
+	{  
+		if (!(t = thread_create(thread, NULL, TASK, 0)))
+			panic("could not create thread\n");
+		thread_ready(t);
+	}
+	printf("ok\n");
+	
+}
