blob: 0dec7e0f10ea07e06f0714276ab20d5841faff3d (
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
46
47
48
49
50
51
52
|
//To load GDT
#include "GDT/gdt.hpp"
#include "./Helpers/memPrint.hpp"
//----- Global Definition -----
memPrint VideoRam; //Used to print data on screen
//-----------------------------
//----- PiegOS kernel main -----
int main(){
//Welcome
VideoRam.print("Welcome to PiegOS");
//Infinite loop
while(1);
//Exit code
return 0;
}
//----- PiegOS kernel boot -----
//Mangling the _boot function
extern "C" void _boot(){
//Create Gdt instance
Gdt gdt;
//Load Gdt into memory
gdt.loadGdt();
//Init all segments and stack
__asm__("\
movw $0x10, %ax; \n \
movw %ax, %ds; \n \
movw %ax, %es \n \
ljmp $0x08, $updateDS;\
updateDS: \n\
movw $0x18, %ax \n \
movw %ax, %ss \n \
movl $0x00B00000, %esp \n\
");
//Call main function after stack pointer changing (due to C++ optimisation)
main();
}
|