blob: 15b6c09f0ccbd2a96771d28c58c53e23745e7c83 [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{
10 vga_clear();
11 vga_set_color(LIGHT_BLUE, BLACK);
12 vga_write("Hello!\nWelcome to Bluejay OS\n");
swissChilid8137922021-02-17 15:34:07 -080013 vga_set_color(WHITE, BLACK);
14
swissChili0b35bf22021-02-18 12:49:40 -080015 init_descriptor_tables();
swissChilid8137922021-02-17 15:34:07 -080016
swissChili0b35bf22021-02-18 12:49:40 -080017 vga_set_color(LIGHT_GREEN, BLACK);
18 vga_write("Setup complete!\n");
19 vga_set_color(WHITE, BLACK);
swissChilid8137922021-02-17 15:34:07 -080020
swissChili825d46b2021-02-21 10:14:16 -080021 init_timer(20);
22
23 initialize_paging();
swissChili19ef4182021-02-21 17:45:51 -080024 init_kbd();
swissChilidefeb0d2021-02-18 15:28:36 -080025 asm volatile("sti");
26
swissChili0b35bf22021-02-18 12:49:40 -080027
swissChili825d46b2021-02-21 10:14:16 -080028#ifdef TEST_PAGE_FAULT
29 kprintf("Causing page fault:\n");
30
31 volatile uint *ptr = (uint *) 0xa0000000;
32 volatile uint cause_page_fault = *ptr;
33
34 kprintf("Should have caused page fault: %d...\n", cause_page_fault);
35#endif
36
37 while (true)
38 asm volatile("hlt");
39
swissChilid8137922021-02-17 15:34:07 -080040 return 0xCAFEBABE;
41}