-
Notifications
You must be signed in to change notification settings - Fork 0
/
kernel.cpp
executable file
·51 lines (41 loc) · 1.41 KB
/
kernel.cpp
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
46
47
48
49
50
51
#include "gdt.h"
#include "textio.h"
#include "types.h"
#include "port.h"
#include "memory.h"
#include "interrupts.h"
#include "keyboard.h"
#include "clock.h"
#include "mouse.h"
typedef void (*constructor)();
extern "C" constructor start_ctors;
extern "C" constructor end_ctors;
extern "C" void callConstructors() {
for(constructor* i = &start_ctors; i != &end_ctors; i++)
(*i)();
}
extern "C" void kernelMain(const void* multiboot_structure, unsigned int multiboot_magic) {
print("[kernel - kernelMain] initializing GDT... ");
GlobalDescriptorTable gdt;
puts("done");
print("[kernel - kernelMain] instanciating interrupt manager... ");
InterruptManager interrupts(&gdt);
puts("done");
print("[kernel - kernelMain] instanciating clock...");
Clock clock(&interrupts);
puts("done");
print("[kernel - kernelMain] instanciating keyboard handler... ");
KeyboardDriver keyboard(&interrupts);
puts("done");
print("[kernel - kernelMain] instanciating mouse handler... ");
MouseDriver mouse(&interrupts);
puts("done");
print("[kernel - kernelMain] activating interrupt manager... ");
interrupts.activate();
puts("done");
print("\n");
print("WELCOME TO MoOS!\n", 0x0b);
print("Currently, this screen is the only thing I can offer here.\nFeel free to move around your mouse or type something nice... Have fun ;D\n");
while(true) {
}
}