summaryrefslogtreecommitdiffstats
path: root/src/kernel/kernel.C
blob: 2ce5f3e43b0943a43b2401a29787b5b96dfd36c8 (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
#include <stdint.h>
#include <kernel/console.H>
#include <kernel/pagemgr.H>
#include <util/singleton.H>

class Kernel
{
    public:
	void cppBootstrap();	
	void memBootstrap();

    protected:
	Kernel() {};
};

int main()
{
    printk("Booting %s kernel...\n\n", "Chenoo");
    
    Kernel& kernel = Singleton<Kernel>::instance();
    kernel.cppBootstrap();
    kernel.memBootstrap(); 

    while(1);
    return 0;
}

void Kernel::cppBootstrap()
{
    // Call default constructors for any static objects.
    extern void (*ctor_start_address)();
    extern void (*ctor_end_address)();
    void(**ctors)() = &ctor_start_address;
    while(ctors != &ctor_end_address)
    {
	(*ctors)();
	ctors++;
    }
}

void Kernel::memBootstrap()
{
    PageManager::freePage(PageManager::allocatePage());
}

OpenPOWER on IntegriCloud