]> git.buserror.net Git - polintos/scott/priv.git/blob - kernel/core/init.cc
2c874e5ddd756066d56557bb4676b066ba663049
[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 conditions:
11 // 
12 //     * Redistributions of source code must retain the above copyright notice,
13 //       this list of conditions and the following disclaimers.
14 // 
15 //     * Redistributions in binary form must reproduce the above copyright notice,
16 //       this list of conditions and the following disclaimers in the
17 //       documentation and/or other materials provided with the distribution.
18 // 
19 //     * The names of the Software's authors and/or contributors
20 //       may not be used to endorse or promote products derived from
21 //       this Software without specific prior written permission.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
25 // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
26 // CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
29 // SOFTWARE.
30
31 #include <kern/types.h>
32 #include <kern/libc.h>
33 #include <kern/console.h>
34 #include <kern/arch.h>
35 #include <kern/time.h>
36 #include <kern/thread.h>
37
38 extern void *eh_frame_begin;
39 extern "C" void __register_frame(const void *begin);
40
41 void run_test();
42
43 extern "C" void start_kernel()
44 {
45         run_ctors();
46         Arch::arch_init();
47
48         // __register_frame must not be called until after dynamic memory
49         // allocation is initialized (exceptions wouldn't work before then,
50         // anyway; if one is thrown, abort() will be called).
51         
52         __register_frame(&eh_frame_begin);
53         printf("Starting kernel...\n");
54
55         Time::init();
56         Threads::sched.init();
57         ll_ints_on();
58         
59         run_test();
60         
61         printf("done.\n");
62         for(;;);
63 }