blob: a8668523a88809dab9cbd737ba976052d34168cb [file] [log] [blame]
swissChilid8137922021-02-17 15:34:07 -08001#include "descriptor_tables.h"
swissChili825d46b2021-02-21 10:14:16 -08002#include "io.h"
3#include "log.h"
swissChilidefeb0d2021-02-18 15:28:36 -08004#include "timer.h"
swissChili825d46b2021-02-21 10:14:16 -08005#include "vga.h"
6#include "paging.h"
swissChilid8137922021-02-17 15:34:07 -08007
swissChili0b35bf22021-02-18 12:49:40 -08008int kmain(void *mboot)
swissChilid8137922021-02-17 15:34:07 -08009{
swissChilie0a79bb2021-02-22 19:54:48 -080010 init_paging();
swissChilidc25b2b2021-02-23 17:07:13 -080011 init_vga();
swissChilid3a652e2021-02-21 22:16:06 -080012
swissChilid8137922021-02-17 15:34:07 -080013 vga_clear();
14 vga_set_color(LIGHT_BLUE, BLACK);
15 vga_write("Hello!\nWelcome to Bluejay OS\n");
swissChilid8137922021-02-17 15:34:07 -080016 vga_set_color(WHITE, BLACK);
17
swissChili0b35bf22021-02-18 12:49:40 -080018 init_descriptor_tables();
swissChilid8137922021-02-17 15:34:07 -080019
swissChili0b35bf22021-02-18 12:49:40 -080020 vga_set_color(LIGHT_GREEN, BLACK);
21 vga_write("Setup complete!\n");
22 vga_set_color(WHITE, BLACK);
swissChilid8137922021-02-17 15:34:07 -080023
swissChili825d46b2021-02-21 10:14:16 -080024 init_timer(20);
25
swissChili19ef4182021-02-21 17:45:51 -080026 init_kbd();
swissChilidefeb0d2021-02-18 15:28:36 -080027 asm volatile("sti");
28
swissChili0b35bf22021-02-18 12:49:40 -080029
swissChili825d46b2021-02-21 10:14:16 -080030#ifdef TEST_PAGE_FAULT
31 kprintf("Causing page fault:\n");
32
33 volatile uint *ptr = (uint *) 0xa0000000;
34 volatile uint cause_page_fault = *ptr;
35
36 kprintf("Should have caused page fault: %d...\n", cause_page_fault);
37#endif
38
39 while (true)
40 asm volatile("hlt");
41
swissChilid8137922021-02-17 15:34:07 -080042 return 0xCAFEBABE;
43}