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 | { |
swissChili | e0a79bb | 2021-02-22 19:54:48 -0800 | [diff] [blame] | 10 | init_paging(); |
swissChili | dc25b2b | 2021-02-23 17:07:13 -0800 | [diff] [blame] | 11 | init_vga(); |
swissChili | d3a652e | 2021-02-21 22:16:06 -0800 | [diff] [blame] | 12 | |
swissChili | d813792 | 2021-02-17 15:34:07 -0800 | [diff] [blame] | 13 | vga_clear(); |
14 | vga_set_color(LIGHT_BLUE, BLACK); | ||||
15 | vga_write("Hello!\nWelcome to Bluejay OS\n"); | ||||
swissChili | d813792 | 2021-02-17 15:34:07 -0800 | [diff] [blame] | 16 | vga_set_color(WHITE, BLACK); |
17 | |||||
swissChili | 0b35bf2 | 2021-02-18 12:49:40 -0800 | [diff] [blame] | 18 | init_descriptor_tables(); |
swissChili | d813792 | 2021-02-17 15:34:07 -0800 | [diff] [blame] | 19 | |
swissChili | 0b35bf2 | 2021-02-18 12:49:40 -0800 | [diff] [blame] | 20 | vga_set_color(LIGHT_GREEN, BLACK); |
21 | vga_write("Setup complete!\n"); | ||||
22 | vga_set_color(WHITE, BLACK); | ||||
swissChili | d813792 | 2021-02-17 15:34:07 -0800 | [diff] [blame] | 23 | |
swissChili | 825d46b | 2021-02-21 10:14:16 -0800 | [diff] [blame] | 24 | init_timer(20); |
25 | |||||
swissChili | 19ef418 | 2021-02-21 17:45:51 -0800 | [diff] [blame] | 26 | init_kbd(); |
swissChili | defeb0d | 2021-02-18 15:28:36 -0800 | [diff] [blame] | 27 | asm volatile("sti"); |
28 | |||||
swissChili | 0b35bf2 | 2021-02-18 12:49:40 -0800 | [diff] [blame] | 29 | |
swissChili | 825d46b | 2021-02-21 10:14:16 -0800 | [diff] [blame] | 30 | #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 | |||||
swissChili | d813792 | 2021-02-17 15:34:07 -0800 | [diff] [blame] | 42 | return 0xCAFEBABE; |
43 | } |