blob: a7bc68b55074fd9377a54d41c556cd574e8058fd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#include <kernel/console.H> // TODO : Remove this.
#include <sys/task.h>
#include <sys/mutex.h>
#include <sys/msg.h>
mutex_t global_mutex;
void init_child(void* unused)
{
mutex_lock(global_mutex);
printk("Here I am %d\n", task_gettid());
mutex_unlock(global_mutex);
task_end();
}
void vfs_main(void*);
void init_main(void* unused)
{
printk("Starting init!\n");
printk("Bringing up VFS...");
task_create(&vfs_main, NULL);
task_yield(); // TODO... add a barrier to ensure VFS is fully up.
global_mutex = mutex_create();
msg_q_t msgq = msg_q_create();
msg_q_register(msgq, "/msg/init");
msg_t* msg = msg_allocate();
msg->type = 1; msg->data[0] = 0xDEADBEEF12345678;
msg_send(msgq, msg);
msg = msg_wait(msgq);
printk("Got Message: %llx\n", msg->data[0]);
while(1)
{
mutex_lock(global_mutex);
int t = task_create(&init_child, NULL);
printk("Created child %d\n", t);
for (volatile int i = 0 ; i < 10000000; i++);
mutex_unlock(global_mutex);
}
}
|