]> git.buserror.net Git - polintos/scott/priv.git/blob - kernel/core/init.cc
5f309c4035a8f260485f226c3fd3fdd7aa953e0c
[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 // This software is provided 'as-is', without any express or implied warranty.
6 // In no event will the authors or contributors be held liable for any damages
7 // arising from the use of this software.
8 // 
9 // Permission is hereby granted to everyone, free of charge, to use, copy,
10 // modify, prepare derivative works of, publish, distribute, perform,
11 // sublicense, and/or sell copies of the Software, provided that the above
12 // copyright notice and disclaimer of warranty be included in all copies or
13 // substantial portions of this software.
14
15 #include <kern/types.h>
16 #include <kern/libc.h>
17 #include <kern/console.h>
18 #include <kern/arch.h>
19 #include <kern/time.h>
20 #include <kern/thread.h>
21
22 extern void *eh_frame_begin;
23 extern "C" void __register_frame(const void *begin);
24
25 void run_test();
26
27 extern "C" void start_kernel()
28 {
29         run_ctors();
30         Arch::arch_init();
31
32         // __register_frame must not be called until after dynamic memory
33         // allocation is initialized (exceptions wouldn't work before then,
34         // anyway; if one is thrown, abort() will be called).
35         
36         __register_frame(&eh_frame_begin);
37         printf("Starting kernel...\n");
38
39         Time::init();
40         Threads::sched.init();
41         ll_ints_on();
42         
43         run_test();
44         
45         printf("done.\n");
46         for(;;);
47 }