2015-07-21 17:25:36 +04:00
|
|
|
//To load GDT
|
2015-07-20 16:34:46 +04:00
|
|
|
#include "GDT/gdt.hpp"
|
2015-07-22 13:22:53 +04:00
|
|
|
#include "./Helpers/memPrint.hpp"
|
2015-07-21 17:25:36 +04:00
|
|
|
|
2015-07-19 11:52:01 +04:00
|
|
|
|
2015-07-21 16:53:10 +04:00
|
|
|
//----- PiegOS kernel main -----
|
2015-07-20 16:34:46 +04:00
|
|
|
int main(){
|
2015-07-19 11:20:21 +04:00
|
|
|
|
2015-07-22 13:22:53 +04:00
|
|
|
//Test print a char
|
2015-07-22 19:45:08 +04:00
|
|
|
/*char* letter=(char*)0xB8A00;
|
2015-07-22 13:22:53 +04:00
|
|
|
*letter='H';
|
|
|
|
letter++;
|
2015-07-22 19:45:08 +04:00
|
|
|
*letter=(GREEN << 4) | BLUE;*/
|
|
|
|
|
|
|
|
memPrint VideoRam;
|
|
|
|
|
|
|
|
|
|
|
|
VideoRam.print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
|
|
|
VideoRam.print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
|
|
|
VideoRam.print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
|
|
|
VideoRam.print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
|
|
|
VideoRam.print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
|
|
|
VideoRam.print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
2015-07-22 13:22:53 +04:00
|
|
|
|
2015-07-21 16:53:10 +04:00
|
|
|
//Infinite loop
|
|
|
|
while(1);
|
|
|
|
|
|
|
|
//Exit code
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//----- PiegOS kernel boot -----
|
|
|
|
//Mangling the _boot function
|
|
|
|
extern "C" void _boot(){
|
|
|
|
|
2015-07-21 14:23:57 +04:00
|
|
|
//Create Gdt instance
|
|
|
|
Gdt gdt;
|
|
|
|
|
|
|
|
//Load Gdt into memory
|
2015-07-22 19:45:08 +04:00
|
|
|
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)
|
2015-07-21 16:53:10 +04:00
|
|
|
main();
|
2015-07-19 11:20:21 +04:00
|
|
|
}
|
2015-07-21 16:53:10 +04:00
|
|
|
|