swissChili | d813792 | 2021-02-17 15:34:07 -0800 | [diff] [blame] | 1 | #include "descriptor_tables.h" |
swissChili | 825d46b | 2021-02-21 10:14:16 -0800 | [diff] [blame] | 2 | #include "io.h" |
3 | #include "log.h" | ||||
swissChili | defeb0d | 2021-02-18 15:28:36 -0800 | [diff] [blame] | 4 | #include "timer.h" |
swissChili | 825d46b | 2021-02-21 10:14:16 -0800 | [diff] [blame] | 5 | #include "vga.h" |
6 | #include "paging.h" | ||||
swissChili | d813792 | 2021-02-17 15:34:07 -0800 | [diff] [blame] | 7 | |
swissChili | 0b35bf2 | 2021-02-18 12:49:40 -0800 | [diff] [blame] | 8 | int kmain(void *mboot) |
swissChili | d813792 | 2021-02-17 15:34:07 -0800 | [diff] [blame] | 9 | { |
10 | vga_clear(); | ||||
11 | vga_set_color(LIGHT_BLUE, BLACK); | ||||
12 | vga_write("Hello!\nWelcome to Bluejay OS\n"); | ||||
swissChili | d813792 | 2021-02-17 15:34:07 -0800 | [diff] [blame] | 13 | vga_set_color(WHITE, BLACK); |
14 | |||||
swissChili | 0b35bf2 | 2021-02-18 12:49:40 -0800 | [diff] [blame] | 15 | init_descriptor_tables(); |
swissChili | d813792 | 2021-02-17 15:34:07 -0800 | [diff] [blame] | 16 | |
swissChili | 0b35bf2 | 2021-02-18 12:49:40 -0800 | [diff] [blame] | 17 | vga_set_color(LIGHT_GREEN, BLACK); |
18 | vga_write("Setup complete!\n"); | ||||
19 | vga_set_color(WHITE, BLACK); | ||||
swissChili | d813792 | 2021-02-17 15:34:07 -0800 | [diff] [blame] | 20 | |
swissChili | 825d46b | 2021-02-21 10:14:16 -0800 | [diff] [blame] | 21 | init_timer(20); |
22 | |||||
23 | initialize_paging(); | ||||
swissChili | 19ef418 | 2021-02-21 17:45:51 -0800 | [diff] [blame] | 24 | init_kbd(); |
swissChili | defeb0d | 2021-02-18 15:28:36 -0800 | [diff] [blame] | 25 | asm volatile("sti"); |
26 | |||||
swissChili | 0b35bf2 | 2021-02-18 12:49:40 -0800 | [diff] [blame] | 27 | |
swissChili | 825d46b | 2021-02-21 10:14:16 -0800 | [diff] [blame] | 28 | #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 | |||||
swissChili | d813792 | 2021-02-17 15:34:07 -0800 | [diff] [blame] | 40 | return 0xCAFEBABE; |
41 | } |