more x86_64 work. started to put the mmu bits together in the (former) stage2 loader.
[newos.git] / apps / testapp / fputests.cpp
blobfabd3e50c4f0667d630db48d45668e93d50b1b3a
1 /*
2 ** Copyright 2004, Travis Geiselbrecht. All rights reserved.
3 ** Distributed under the terms of the NewOS License.
4 */
5 #include <string.h>
6 #include <stdio.h>
7 #include <unistd.h>
8 #include <sys/syscalls.h>
10 static int fpu_test_thread(void *arg)
12 thread_id tid = _kern_get_current_thread_id();
13 double foo = tid;
14 double bar;
16 printf("starting thread %d\n", tid);
18 for(;;) {
19 bar = foo * 1.47;
20 foo = bar / 1.47;
21 if(foo != (double)tid)
22 printf("error: foo %f, should be %f\n", foo, (double)tid);
25 return 0;
28 int fpu_test(int arg)
30 int i;
32 for(i=0; i<5; i++) {
33 thread_id tid = _kern_thread_create_thread("fpu tester", &fpu_test_thread, 0);
34 _kern_thread_set_priority(tid, 1);
35 _kern_thread_resume_thread(tid);
38 printf("finished creating threads, waiting forever\n");
39 for(;;)
40 usleep(1000000);
42 return 0;