Merge branch 'master' into net-dev
[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(parlib_channel_test_client);
33                         envs[1] = ENV_CREATE(parlib_channel_test_server);
34                         smp_call_function_single(1, run_env_handler, envs[0], 0);
35                         smp_call_function_single(2, run_env_handler, envs[1], 0);
36                 #if 0
37                 case 0:
38                         envs[0] = ENV_CREATE(roslib_proctests);
39                         envs[1] = ENV_CREATE(roslib_proctests);
40                         envs[2] = ENV_CREATE(roslib_proctests);
41                         envs[3] = ENV_CREATE(roslib_fptest);
42                         envs[4] = ENV_CREATE(roslib_fptest);
43                         envs[4] = ENV_CREATE(roslib_fptest);
44                         envs[5] = ENV_CREATE(roslib_hello);
45                         envs[6] = ENV_CREATE(roslib_null);
46                         //envs[6] = ENV_CREATE(roslib_measurements);
47                         env_run(envs[0]);
48                         break;
49                 case 1:
50                 case 2:
51                 case 3:
52                 #endif
53                 #if 0
54                 case 0:
55                         printk("Beginning Tests\n");
56                         test_run_measurements(progress-1);  // should never return
57                         break;
58                 case 1:
59                 case 2:
60                 case 3:
61                 case 4:
62                 case 5:
63                 case 6:
64                 case 7:
65                 case 8:
66                 case 9:
67                 case 10:
68                 case 11:
69                 case 12:
70                 case 13:
71                 case 14:
72                         test_run_measurements(progress-1);
73                         break;
74                 #endif
75                 default:
76                         printk("Manager Progress: %d\n", progress);
77                         schedule();
78         }
79         panic("If you see me, then you probably screwed up");
80
81         /*
82         printk("Servicing syscalls from Core 0:\n\n");
83         while (1) {
84                 process_generic_syscalls(&envs[0], 1);
85                 cpu_relax();
86         }
87         */
88         return;
89 }
90