Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Added CONFIG_V3VEE to kernel config file
[palacios.git] / kitten / init / main.c
1 #include <lwk/init.h>
2 #include <lwk/kernel.h>
3 #include <lwk/params.h>
4 #include <lwk/console.h>
5 #include <lwk/cpuinfo.h>
6 #include <lwk/percpu.h>
7 #include <lwk/smp.h>
8 #include <lwk/cpuinfo.h>
9 #include <lwk/delay.h>
10 #include <lwk/bootmem.h>
11 #include <lwk/aspace.h>
12 #include <lwk/task.h>
13 #include <lwk/sched.h>
14 #include <lwk/timer.h>
15
16 /**
17  * Pristine copy of the LWK boot command line.
18  */
19 char lwk_command_line[COMMAND_LINE_SIZE];
20
21
22 /**
23  * This is the architecture-independent kernel entry point. Before it is
24  * called, architecture-specific code has done the bare minimum initialization
25  * necessary. This function initializes the kernel and its various subsystems.
26  * It calls back to architecture-specific code at several well defined points,
27  * which all architectures must implement (e.g., setup_arch()).
28  */
29 void
30 start_kernel()
31 {
32         unsigned int cpu;
33         unsigned int timeout;
34         int status;
35
36         /*
37          * Parse the kernel boot command line.
38          * This is where boot-time configurable variables get set,
39          * e.g., the ones with param() and driver_param() specifiers.
40          */
41         parse_params(lwk_command_line);
42
43         /*
44          * Initialize the console subsystem.
45          * printk()'s will be visible after this.
46          */
47         console_init();
48
49         /*
50          * Hello, Dave.
51          */
52         printk(lwk_banner);
53         printk(KERN_DEBUG "%s\n", lwk_command_line);
54
55         /*
56          * Do architecture specific initialization.
57          * This detects memory, CPUs, etc.
58          */
59         setup_arch();
60
61         /*
62          * Initialize the kernel memory subsystem. Up until now, the simple
63          * boot-time memory allocator (bootmem) has been used for all dynamic
64          * memory allocation. Here, the bootmem allocator is destroyed and all
65          * of the free pages it was managing are added to the kernel memory
66          * pool (kmem) or the user memory pool (umem).
67          *
68          * After this point, any use of the bootmem allocator will cause a
69          * kernel panic. The normal kernel memory subsystem API should be used
70          * instead (e.g., kmem_alloc() and kmem_free()).
71          */
72         mem_subsys_init();
73
74         /*
75          * Initialize the address space management subsystem.
76          */
77         aspace_subsys_init();
78
79         /*
80          * Initialize the task management subsystem.
81          */
82         task_subsys_init();
83
84         /*
85          * Initialize the task scheduling subsystem.
86          */
87         sched_subsys_init();
88
89         /*
90          * Initialize the task scheduling subsystem.
91          */
92         timer_subsys_init();
93
94         /*
95          * Boot all of the other CPUs in the system, one at a time.
96          */
97         printk(KERN_INFO "Number of CPUs detected: %d\n", num_cpus());
98         for_each_cpu_mask(cpu, cpu_present_map) {
99                 /* The bootstrap CPU (that's us) is already booted. */
100                 if (cpu == 0) {
101                         cpu_set(cpu, cpu_online_map);
102                         continue;
103                 }
104
105                 printk(KERN_DEBUG "Booting CPU %u.\n", cpu);
106                 arch_boot_cpu(cpu);
107
108                 /* Wait for ACK that CPU has booted (5 seconds max). */
109                 for (timeout = 0; timeout < 50000; timeout++) {
110                         if (cpu_isset(cpu, cpu_online_map))
111                                 break;
112                         udelay(100);
113                 }
114
115                 if (!cpu_isset(cpu, cpu_online_map))
116                         panic("Failed to boot CPU %d.\n", cpu);
117         }
118
119 #ifdef CONFIG_V3VEE
120         /*
121          * Start up the V3Vee subsystem
122          */
123         Init_V3( 0, 0 );
124 #else
125         /*
126          * Start up user-space...
127          */
128         printk(KERN_INFO "Loading initial user-level task (init_task)...\n");
129         if ((status = create_init_task()) != 0)
130                 panic("Failed to create init_task (status=%d).", status);
131 #endif
132
133         schedule();  /* This should not return */
134         BUG();
135 }