59 lines
1.5 KiB
C++
59 lines
1.5 KiB
C++
//To load GDT
|
|
#include "GDT/gdt.hpp"
|
|
#include "./Helpers/memPrint.hpp"
|
|
|
|
|
|
//----- PiegOS kernel main -----
|
|
int main(){
|
|
|
|
//Test print a char
|
|
/*char* letter=(char*)0xB8A00;
|
|
*letter='H';
|
|
letter++;
|
|
*letter=(GREEN << 4) | BLUE;*/
|
|
|
|
memPrint VideoRam;
|
|
|
|
|
|
VideoRam.print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
|
VideoRam.print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
|
VideoRam.print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
|
VideoRam.print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
|
VideoRam.print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
|
VideoRam.print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
|
|
|
//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();
|
|
}
|
|
|