-
Notifications
You must be signed in to change notification settings - Fork 0
/
kernel.cpp
54 lines (43 loc) · 1.21 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
52
53
54
#define VERSION 0.1
#include "types.h"
#include "gdt.h"
#include "interrupts.h"
#include "driver.h"
#include "scr_text.h"
#include "keyboard.h"
//prints
//tatic uint8_t term_color = 0xff00;
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)();
}
}
void wait(int c) { //nopnopnopnopnonpnnonpnonpnon
for(int i = 0; i < c * 1000; i++) __asm__ volatile("nop");
}
extern "C" void init(void* mbs_info, uint32_t mb_magic) {
//callConstructors();
print("ThornsOS Version 0.1 \n");
print("\n");
print("(c) pv42\n");
print("\n");
GlobalDescriptorTable gdt;
InterruptManager interruptManager(&gdt);
print("Initializing Hardware, Stage 0\n");
DriverManager driverManager;
KeyboardDriver keyboardDriver(&interruptManager);
driverManager.addDriver(&keyboardDriver);
print("Initializing Hardware, Stage 1\n");
driverManager.activateAll();
print("Initializing Hardware, Stage 2\n");
interruptManager.activate();
//loadin done
//while(1) {
// wait(100000);
// print(">");
//}
while(1);
}