source: mainline/test/fp/fp0/test.c@ 6de2480e

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 6de2480e was 6de2480e, checked in by Jakub Vana <jakub.vana@…>, 21 years ago

IA-32 FPU lazy context switching.
Doesn't work on Bochs and sometimes produces wrong results on P4.
Seems to work on VMware and PII.

Build script for IA-32 changed to build floppy images (image.bin) 1440K long.

  • Property mode set to 100644
File size: 1.0 KB
Line 
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
24thread_t *thread_create(void (* func)(void *), void *arg, task_t *task, int flags);
25
26
27static 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
48void 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
Note: See TracBrowser for help on using the repository browser.