]> git.buserror.net Git - polintos/scott/priv.git/blob - kernel/core/init.cc
Switch to a simple X11-style license.
[polintos/scott/priv.git] / kernel / core / init.cc
1 // core/init.cc -- C++ entry point and component initialization.
2 //
3 // This software is copyright (c) 2006 Scott Wood <scott@buserror.net>.
4 // 
5 // Permission is hereby granted, free of charge, to any person obtaining a copy of
6 // this software and associated documentation files (the "Software"), to deal with
7 // the Software without restriction, including without limitation the rights to
8 // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9 // of the Software, and to permit persons to whom the Software is furnished to do
10 // so, subject to the following condition:
11 // 
12 // The above copyright notice and this permission notice shall be
13 // included in all copies or substantial portions of the Software.
14 // 
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
18 // CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
21 // SOFTWARE.
22
23 #include <kern/types.h>
24 #include <kern/libc.h>
25 #include <kern/console.h>
26 #include <kern/arch.h>
27 #include <kern/time.h>
28 #include <kern/thread.h>
29
30 extern void *eh_frame_begin;
31 extern "C" void __register_frame(const void *begin);
32
33 void run_test();
34
35 extern "C" void start_kernel()
36 {
37         run_ctors();
38         Arch::arch_init();
39
40         // __register_frame must not be called until after dynamic memory
41         // allocation is initialized (exceptions wouldn't work before then,
42         // anyway; if one is thrown, abort() will be called).
43         
44         __register_frame(&eh_frame_begin);
45         printf("Starting kernel...\n");
46
47         Time::init();
48         Threads::sched.init();
49         ll_ints_on();
50         
51         run_test();
52         
53         printf("done.\n");
54         for(;;);
55 }