Index: arch/ia32/Makefile.inc
===================================================================
--- arch/ia32/Makefile.inc	(revision c01bd2804fd614b41795206b217e7ea7ab277eb3)
+++ arch/ia32/Makefile.inc	(revision 54ca352335c8934ae1048cc311d5426c76a346cd)
@@ -14,5 +14,5 @@
 
 CPPFLAGS=$(DEFS) -nostdinc -I../include
-CFLAGS=$(CPPFLAGS) -nostdlib -fno-builtin -fomit-frame-pointer -Wmissing-prototypes -Werror -O0
+CFLAGS=$(CPPFLAGS) -nostdlib -fno-builtin -fomit-frame-pointer -Wmissing-prototypes -Werror -O3
 LFLAGS=-M -no-check-sections -T ../arch/ia32/_link.ld
 
Index: arch/ia32/include/fpu_context.h
===================================================================
--- arch/ia32/include/fpu_context.h	(revision c01bd2804fd614b41795206b217e7ea7ab277eb3)
+++ arch/ia32/include/fpu_context.h	(revision 54ca352335c8934ae1048cc311d5426c76a346cd)
@@ -1,4 +1,4 @@
 /*
- * Copyright (C) 2001-2004 Jakub Jermar
+ * Copyright (C) 2005 Jakub Vana
  * All rights reserved.
  *
Index: arch/ia32/src/fpu_context.c
===================================================================
--- arch/ia32/src/fpu_context.c	(revision c01bd2804fd614b41795206b217e7ea7ab277eb3)
+++ arch/ia32/src/fpu_context.c	(revision 54ca352335c8934ae1048cc311d5426c76a346cd)
@@ -1,36 +1,35 @@
 /*
-#
-# Copyright (C) 2005 Jakub Vana
-# 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.
-#
-*/
+ *
+ * Copyright (C) 2005 Jakub Vana
+ * 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 <fpu_context.h>
 #include <arch.h>
 #include <cpu.h>
-
 
 void fpu_context_save(fpu_context_t *fctx)
@@ -80,7 +79,6 @@
 void fpu_init(void)
 {
-    asm(
-        "fninit;"
-    );
+	asm(
+        	"fninit;"
+	);
 }
-
Index: arch/ia32/src/interrupt.c
===================================================================
--- arch/ia32/src/interrupt.c	(revision c01bd2804fd614b41795206b217e7ea7ab277eb3)
+++ arch/ia32/src/interrupt.c	(revision 54ca352335c8934ae1048cc311d5426c76a346cd)
@@ -97,27 +97,13 @@
 void nm_fault(__u8 n, __u32 stack[])
 {
-
-//	printf("-1\n");        
 	reset_TS_flag();
         if ((CPU->fpu_owner)!=NULL) 
 	{  
-//		printf("tid:%d \n", THREAD->tid);
-//		printf("owner:%d\n", (CPU->fpu_owner)->tid);
 	        fpu_lazy_context_save(&((CPU->fpu_owner)->saved_fpu_context));
-
-//	        printf("owner 2\n");
-		(CPU->fpu_owner)->fpu_context_engaged=0; /* Enables migration */
-//	        printf("owner 3\n");        
-
+		(CPU->fpu_owner)->fpu_context_engaged=0; /* don't prevent migration */
 	}
-//	printf("0\n");
 	if(THREAD->fpu_context_exists) fpu_lazy_context_restore(&(THREAD->saved_fpu_context));
         else {fpu_init();THREAD->fpu_context_exists=1;}
-//	printf("1\n");
 	CPU->fpu_owner=THREAD;
-//	printf("2\n");
-	
-//	printf("3\n");	
-//	panic("#NM fault\n");
 }
 
Index: arch/ia64/include/fpu_context.h
===================================================================
--- arch/ia64/include/fpu_context.h	(revision c01bd2804fd614b41795206b217e7ea7ab277eb3)
+++ arch/ia64/include/fpu_context.h	(revision 54ca352335c8934ae1048cc311d5426c76a346cd)
@@ -1,4 +1,4 @@
 /*
- * Copyright (C) 2005 Jakub Jermar
+ * Copyright (C) 2005 Jakub Vana
  * All rights reserved.
  *
Index: arch/ia64/src/fpu_context.c
===================================================================
--- arch/ia64/src/fpu_context.c	(revision c01bd2804fd614b41795206b217e7ea7ab277eb3)
+++ arch/ia64/src/fpu_context.c	(revision 54ca352335c8934ae1048cc311d5426c76a346cd)
@@ -1,31 +1,31 @@
 /*
-#
-# Copyright (C) 2005 Jakub Vana
-# 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.
-#
-*/
+ *
+ * Copyright (C) 2005 Jakub Vana
+ * 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 <fpu_context.h>
Index: arch/mips/include/fpu_context.h
===================================================================
--- arch/mips/include/fpu_context.h	(revision c01bd2804fd614b41795206b217e7ea7ab277eb3)
+++ arch/mips/include/fpu_context.h	(revision 54ca352335c8934ae1048cc311d5426c76a346cd)
@@ -1,4 +1,4 @@
 /*
- * Copyright (C) 2001-2004 Jakub Jermar
+ * Copyright (C) 2005 Jakub Vana
  * All rights reserved.
  *
Index: arch/mips/src/fpu_context.c
===================================================================
--- arch/mips/src/fpu_context.c	(revision c01bd2804fd614b41795206b217e7ea7ab277eb3)
+++ arch/mips/src/fpu_context.c	(revision 54ca352335c8934ae1048cc311d5426c76a346cd)
@@ -1,31 +1,31 @@
 /*
-#
-# Copyright (C) 2005 Jakub Vana
-# 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.
-#
-*/
+ *
+ * Copyright (C) 2005 Jakub Vana
+ * 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 <fpu_context.h>
Index: include/fpu_context.h
===================================================================
--- include/fpu_context.h	(revision c01bd2804fd614b41795206b217e7ea7ab277eb3)
+++ include/fpu_context.h	(revision 54ca352335c8934ae1048cc311d5426c76a346cd)
@@ -1,2 +1,29 @@
+/*
+ * Copyright (C) 2005 Jakubi Vana 
+ * 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.
+ */
 
 #ifndef fpu_context_h
@@ -15,2 +42,3 @@
 
 #endif /*fpu_context_h*/
+
Index: src/Makefile.config
===================================================================
--- src/Makefile.config	(revision c01bd2804fd614b41795206b217e7ea7ab277eb3)
+++ src/Makefile.config	(revision 54ca352335c8934ae1048cc311d5426c76a346cd)
@@ -6,5 +6,5 @@
 
 # Support for symetric multiprocessors
-SMP=__SMP__
+#SMP=__SMP__
 
 # Improved support for hyperthreading
@@ -18,5 +18,5 @@
 
 # Uncomment if you want to run in the test mode
-TEST=__TEST__
+#TEST=__TEST__
 
 TEST_FILE=test.c
Index: test/fpu/fpu1/test.c
===================================================================
--- test/fpu/fpu1/test.c	(revision c01bd2804fd614b41795206b217e7ea7ab277eb3)
+++ test/fpu/fpu1/test.c	(revision 54ca352335c8934ae1048cc311d5426c76a346cd)
@@ -44,4 +44,5 @@
 
 #define THREADS		150*2
+#define ATTEMPTS	10
 
 #define E_10e8	271828182
@@ -55,46 +56,54 @@
 static void e(void *data)
 {
+	int i;
 	double e,d,le,f;
-	le=-1;
-	e=0;
-	f=1;
 
 	waitq_sleep(&can_start);
 
-	for(d=1;e!=le;d*=f,f+=1) {
-		le=e;
-		e=e+1/d;
+	for (i = 0; i<ATTEMPTS; i++) {
+		le=-1;
+		e=0;
+		f=1;
+
+		for(d=1;e!=le;d*=f,f+=1) {
+			le=e;
+			e=e+1/d;
+		}
+
+		if((int)(100000000*e)!=E_10e8)
+			panic("tid%d: e*10e8=%d\n", THREAD->tid, (int) 100000000*e);
 	}
 
-	if((int)(100000000*e)==E_10e8) {
-		atomic_inc((int *) &threads_ok);
-	}
-	else
-		printf("tid%d: e*10e8=%d)\n", THREAD->tid, (int) 100000000*e);
+	atomic_inc((int *) &threads_ok);
 }
 
 static void pi(void *data)
 {
-        double lpi = -1, pi = 0;
-        double ab, ad;
-        int n;
+	int i;
+        double lpi, pi;
+        double n, ab, ad;
 
 	waitq_sleep(&can_start);
 
-        for (n=2, ab = sqrt(2); lpi != pi; n *= 2, ab = ad) {
-                double sc, cd;
 
-                sc = sqrt(1 - (ab*ab/4));
-                cd = 1 - sc;
-                ad = sqrt(ab*ab/4 + cd*cd);
-                lpi = pi;
-                pi = 2 * n * ad;
-        }
+	for (i = 0; i<ATTEMPTS; i++) {
+		lpi = -1;
+		pi = 0;
 
-	if((int)(100000000*pi)==PI_10e8) {
-		atomic_inc((int *) &threads_ok);
+        	for (n=2, ab = sqrt(2); lpi != pi; n *= 2, ab = ad) {
+                	double sc, cd;
+
+                	sc = sqrt(1 - (ab*ab/4));
+                	cd = 1 - sc;
+                	ad = sqrt(ab*ab/4 + cd*cd);
+                	lpi = pi;
+                	pi = 2 * n * ad;
+        	}
+
+		if((int)(100000000*pi)!=PI_10e8)
+			panic("tid%d: pi*10e8=%d\n", THREAD->tid, (int) 100000000*pi);
 	}
-	else
-		printf("tid%d: pi*10e8=%d)\n", THREAD->tid, (int) 100000000*pi);
+
+	atomic_inc((int *) &threads_ok);
 }
 
