2021-05-10 20:33:25 +00:00
|
|
|
#include "kernel.h"
|
2021-11-03 19:03:38 +00:00
|
|
|
#include "memory/PageFrameAllocator.h"
|
2021-05-12 22:03:00 +00:00
|
|
|
|
2021-11-03 19:03:38 +00:00
|
|
|
extern "C" void early_main(unsigned long magic, unsigned long addr){
|
2021-07-22 19:02:47 +00:00
|
|
|
/** initialize terminal interface */
|
|
|
|
kterm_init();
|
2021-10-23 11:26:15 +00:00
|
|
|
|
2021-07-22 19:02:47 +00:00
|
|
|
if (magic != MULTIBOOT_BOOTLOADER_MAGIC){
|
2021-10-23 11:26:15 +00:00
|
|
|
printf("Invalid magic number: 0x%x\n", magic);
|
2021-07-22 19:02:47 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-10-23 11:26:15 +00:00
|
|
|
CheckMBT( (multiboot_info_t *) addr);
|
2021-07-22 19:02:47 +00:00
|
|
|
|
2021-10-23 11:26:15 +00:00
|
|
|
multiboot_info_t* mbt = (multiboot_info_t*) addr;
|
2021-07-22 19:02:47 +00:00
|
|
|
|
|
|
|
/* Are mmap_* valid? */
|
2021-10-23 11:26:15 +00:00
|
|
|
if (CHECK_FLAG(mbt->flags, 6)){
|
2021-11-03 19:03:38 +00:00
|
|
|
mapMultibootMemoryMap(mbt);
|
2021-11-02 20:03:11 +00:00
|
|
|
|
2021-07-22 19:02:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Draw diagonal blue line */
|
2021-11-02 20:03:11 +00:00
|
|
|
if (CHECK_FLAG (mbt->flags, 12)){
|
2021-07-22 19:02:47 +00:00
|
|
|
printf("Can draw!");
|
|
|
|
}
|
2021-07-22 21:14:58 +00:00
|
|
|
|
2021-11-02 20:03:11 +00:00
|
|
|
//setupGdt();
|
2021-07-22 21:14:58 +00:00
|
|
|
|
2021-11-02 20:03:11 +00:00
|
|
|
|
2021-05-12 22:03:00 +00:00
|
|
|
}
|
|
|
|
|
2021-11-03 19:03:38 +00:00
|
|
|
extern "C" void kernel_main (void) {
|
2021-05-12 22:03:00 +00:00
|
|
|
|
2021-07-22 19:02:47 +00:00
|
|
|
init_serial();
|
|
|
|
|
2021-11-02 20:03:11 +00:00
|
|
|
while (false){
|
2021-05-28 21:20:13 +00:00
|
|
|
//Read time indefinetely
|
2021-05-18 20:14:26 +00:00
|
|
|
read_rtc();
|
2021-07-22 19:02:47 +00:00
|
|
|
printf( "UTC time: %02d-%02d-%02d %02d:%02d:%02d [ Formatted as YY-MM-DD h:mm:ss]\r" ,year, month, day, hour, minute, second);
|
2021-05-18 20:14:26 +00:00
|
|
|
delay(1000);
|
|
|
|
}
|
2021-07-22 21:14:58 +00:00
|
|
|
|
2021-05-10 20:33:25 +00:00
|
|
|
}
|
2021-11-03 19:03:38 +00:00
|
|
|
|