Index: arch/ia32/boot/Makefile
===================================================================
--- arch/ia32/boot/Makefile	(revision 1eee8383af7d588119b3a08d9aae36b0319f7a7c)
+++ arch/ia32/boot/Makefile	(revision 6de2480e819cb6659290da33064f6e6ee09969df)
@@ -6,4 +6,5 @@
 	dd if=boot.bin of=../../../src/image.bin bs=512 conv=sync
 	-cat ../../../src/kernel.bin >>../../../src/image.bin
+	dd if=/dev/zero of=../../../src/image.bin bs=1 seek=$(KERNEL_SIZE) count=`expr 1474560 - $(KERNEL_SIZE)`
 
 boot.bin: boot.o
Index: arch/ia32/include/interrupt.h
===================================================================
--- arch/ia32/include/interrupt.h	(revision 1eee8383af7d588119b3a08d9aae36b0319f7a7c)
+++ arch/ia32/include/interrupt.h	(revision 6de2480e819cb6659290da33064f6e6ee09969df)
@@ -78,4 +78,5 @@
 extern void gp_fault(__u8 n, __u32 stack[]);
 extern void nm_fault(__u8 n, __u32 stack[]);
+extern void ss_fault(__u8 n, __u32 stack[]);
 extern void page_fault(__u8 n, __u32 stack[]);
 extern void syscall(__u8 n, __u32 stack[]);
Index: arch/ia32/src/fpu_context.c
===================================================================
--- arch/ia32/src/fpu_context.c	(revision 1eee8383af7d588119b3a08d9aae36b0319f7a7c)
+++ arch/ia32/src/fpu_context.c	(revision 6de2480e819cb6659290da33064f6e6ee09969df)
@@ -52,24 +52,26 @@
 void fpu_lazy_context_save(fpu_context_t *fctx)
 {
+    printf("");
     asm(
         "mov %0,%%eax;"
         "fxsave (%%eax);"
-        "ret;"
 	:"=m"(fctx)
 	:
-	:"%eax"
+	:"eax"
     );	
+    printf("");
 }
 
 void fpu_lazy_context_restore(fpu_context_t *fctx)
 {
+    printf("");
     asm(
         "mov %0,%%eax;"
         "fxrstor (%%eax);"
-        "ret;"
 	:"=m"(fctx)
 	:
-	:"%eax"
+	:"eax"
     );
+    printf("");    
 }
 
Index: arch/ia32/src/interrupt.c
===================================================================
--- arch/ia32/src/interrupt.c	(revision 1eee8383af7d588119b3a08d9aae36b0319f7a7c)
+++ arch/ia32/src/interrupt.c	(revision 6de2480e819cb6659290da33064f6e6ee09969df)
@@ -86,20 +86,36 @@
 }
 
+void ss_fault(__u8 n, __u32 stack[])
+{
+	printf("stack[0]=%X, %%eip=%X, %%cs=%X, flags=%X\n", stack[0], stack[1], stack[2], stack[3]);
+	printf("%%eax=%L, %%ebx=%L, %%ecx=%L, %%edx=%L,\n%%edi=%L, %%esi=%L, %%ebp=%L, %%esp=%L\n", stack[-2], stack[-5], stack[-3], stack[-4], stack[-9], stack[-8], stack[-1], stack);
+	printf("stack: %X, %X, %X, %X\n", stack[4], stack[5], stack[6], stack[7]);
+	panic("Stack fault\n");
+}
+
+
 void nm_fault(__u8 n, __u32 stack[])
 {
 
+//	printf("-1\n");        
+	reset_TS_flag();
         if ((CPU->fpu_owner)!=NULL) 
 	{  
-		fpu_lazy_context_save(&((CPU->fpu_owner)->saved_fpu_context));
+//	        printf("owner %X\n",(int)(&((CPU->fpu_owner)->saved_fpu_context)));        
+	        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");        
+
 	}
-	
+//	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;
-
-	reset_TS_flag();
+//	printf("2\n");
 	
+//	printf("3\n");	
 //	panic("#NM fault\n");
 }
Index: arch/ia32/src/pm.c
===================================================================
--- arch/ia32/src/pm.c	(revision 1eee8383af7d588119b3a08d9aae36b0319f7a7c)
+++ arch/ia32/src/pm.c	(revision 6de2480e819cb6659290da33064f6e6ee09969df)
@@ -122,4 +122,5 @@
 	trap_register(13, gp_fault);
 	trap_register( 7, nm_fault);
+	trap_register(12, ss_fault);
 }
 
Index: src/Makefile.config
===================================================================
--- src/Makefile.config	(revision 1eee8383af7d588119b3a08d9aae36b0319f7a7c)
+++ src/Makefile.config	(revision 6de2480e819cb6659290da33064f6e6ee09969df)
@@ -18,5 +18,5 @@
 
 # Uncomment if you want to run in the test mode
-#TEST=__TEST__
+TEST=__TEST__
 
 TEST_FILE=test.c
@@ -26,6 +26,7 @@
 #TEST_DIR=synch/rwlock2/
 #TEST_DIR=synch/rwlock3/
-TEST_DIR=synch/rwlock4/
+#TEST_DIR=synch/rwlock4/
 #TEST_DIR=synch/rwlock5/
 #TEST_DIR=synch/semaphore1/
 #TEST_DIR=synch/semaphore2/
+TEST_DIR=fp/fp0
Index: test/fp/fp0/test.c
===================================================================
--- test/fp/fp0/test.c	(revision 6de2480e819cb6659290da33064f6e6ee09969df)
+++ test/fp/fp0/test.c	(revision 6de2480e819cb6659290da33064f6e6ee09969df)
@@ -0,0 +1,70 @@
+
+
+
+#include <arch/interrupt.h>
+#include <print.h>
+#include <debug.h>
+#include <panic.h>
+#include <arch/i8259.h>
+#include <func.h>
+#include <cpu.h>
+#include <arch/asm.h>
+#include <mm/tlb.h>
+
+
+
+#include <test.h>
+#include <arch.h>
+#include <arch/smp/atomic.h>
+#include <proc/thread.h>
+
+
+
+
+thread_t *thread_create(void (* func)(void *), void *arg, task_t *task, int flags);
+
+
+static void thread(void *data)
+{
+  while(1) 
+  {
+    double e,d,le,f;
+    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)==271828182) printf("THREAD:%s e OK\n",(char*)data);
+    else panic("THREAD:%s e Failed\n",(char*)data);
+
+    
+//    printf("100000000*e:%d\n");
+  }
+  //printf("TEST:%s\n",(char*)data);  
+}
+
+
+
+void test(void)
+{
+  thread_t *t;
+  
+  t=thread_create(thread, (void*)"0", TASK,0);
+  thread_ready(t);
+
+
+
+  t=thread_create(thread, (void*)"1", TASK,0);
+  thread_ready(t);
+
+
+
+  t=thread_create(thread, (void*)"2", TASK,0);
+  thread_ready(t);
+
+  t=thread_create(thread, (void*)"3", TASK,0);
+  thread_ready(t);
+  while(1);
+
+}
+
