Subversion Repositories HelenOS-historic

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1.  
  2.  
  3.  
  4. #include <arch/interrupt.h>
  5. #include <print.h>
  6. #include <debug.h>
  7. #include <panic.h>
  8. #include <arch/i8259.h>
  9. #include <func.h>
  10. #include <cpu.h>
  11. #include <arch/asm.h>
  12. #include <mm/tlb.h>
  13.  
  14.  
  15.  
  16. #include <test.h>
  17. #include <arch.h>
  18. #include <arch/smp/atomic.h>
  19. #include <proc/thread.h>
  20.  
  21.  
  22.  
  23.  
  24. thread_t *thread_create(void (* func)(void *), void *arg, task_t *task, int flags);
  25.  
  26.  
  27. static void thread(void *data)
  28. {
  29.   while(1)
  30.   {
  31.     double e,d,le,f;
  32.     le=-1;
  33.     e=0;
  34.     f=1;
  35.     for(d=1;e!=le;d*=f,f+=1) {le=e;e=e+1/d;}
  36.    
  37.     if((int)(100000000*e)==271828182) printf("THREAD:%s e OK\n",(char*)data);
  38.     else panic("THREAD:%s e Failed\n",(char*)data);
  39.  
  40.    
  41. //    printf("100000000*e:%d\n");
  42.   }
  43.   //printf("TEST:%s\n",(char*)data);  
  44. }
  45.  
  46.  
  47.  
  48. void test(void)
  49. {
  50.   thread_t *t;
  51.  
  52.   t=thread_create(thread, (void*)"0", TASK,0);
  53.   thread_ready(t);
  54.  
  55.  
  56.  
  57.   t=thread_create(thread, (void*)"1", TASK,0);
  58.   thread_ready(t);
  59.  
  60.  
  61.  
  62.   t=thread_create(thread, (void*)"2", TASK,0);
  63.   thread_ready(t);
  64.  
  65.   t=thread_create(thread, (void*)"3", TASK,0);
  66.   thread_ready(t);
  67.   while(1);
  68.  
  69. }
  70.  
  71.