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