Andrew's port to sparc
[akaros.git] / kern / src / manager.c
1 /*
2  * Copyright (c) 2009 The Regents of the University of California
3  * See LICENSE for details.
4  */
5
6 #ifdef __DEPUTY__
7 #pragma nodeputy
8 #endif
9
10 #include <arch/types.h>
11 #include <smp.h>
12
13 #include <assert.h>
14 #include <manager.h>
15 #include <env.h>
16 #include <workqueue.h>
17 #include <syscall.h>
18 #include <testing.h>
19
20 /*
21  * Currently, if you leave this function by way of env_run (process_workqueue
22  * that env_runs), you will never come back to where you left off, and the
23  * function will start from the top.  Hence the hack 'progress'.
24  */
25 void manager(void)
26 {
27         static uint8_t progress = 0;
28         env_t *envs[256];
29
30         switch (progress++) {
31                 case 0:
32                         envs[0] = ENV_CREATE(roslib_proctests);
33                         envs[1] = ENV_CREATE(roslib_proctests);
34                         envs[2] = ENV_CREATE(roslib_proctests);
35                         envs[3] = ENV_CREATE(roslib_fptest);
36                         envs[4] = ENV_CREATE(roslib_fptest);
37                         envs[4] = ENV_CREATE(roslib_fptest);
38                         envs[5] = ENV_CREATE(roslib_hello);
39                         envs[6] = ENV_CREATE(roslib_null);
40                         //envs[6] = ENV_CREATE(roslib_measurements);
41                         env_run(envs[0]);
42                         break;
43                 case 1:
44                 case 2:
45                 case 3:
46                 #if 0
47                 case 0:
48                         printk("Beginning Tests\n");
49                         test_run_measurements(progress-1);  // should never return
50                         break;
51                 case 1:
52                 case 2:
53                 case 3:
54                 case 4:
55                 case 5:
56                 case 6:
57                 case 7:
58                 case 8:
59                 case 9:
60                 case 10:
61                 case 11:
62                 case 12:
63                 case 13:
64                 case 14:
65                         test_run_measurements(progress-1);
66                         break;
67                 #endif
68                 default:
69                         printk("Manager Progress: %d\n", progress);
70                         schedule();
71         }
72         panic("If you see me, then you probably screwed up");
73
74         /*
75         printk("Servicing syscalls from Core 0:\n\n");
76         while (1) {
77                 process_generic_syscalls(&envs[0], 1);
78                 cpu_relax();
79         }
80         */
81         return;
82 }
83