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