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 | d3a652e | 2021-02-21 22:16:06 -0800 | [diff] [blame^] | 10 | // initialize_paging(); |
11 | |||||
swissChili | d813792 | 2021-02-17 15:34:07 -0800 | [diff] [blame] | 12 | vga_clear(); |
13 | vga_set_color(LIGHT_BLUE, BLACK); | ||||
14 | vga_write("Hello!\nWelcome to Bluejay OS\n"); | ||||
swissChili | d813792 | 2021-02-17 15:34:07 -0800 | [diff] [blame] | 15 | vga_set_color(WHITE, BLACK); |
16 | |||||
swissChili | 0b35bf2 | 2021-02-18 12:49:40 -0800 | [diff] [blame] | 17 | init_descriptor_tables(); |
swissChili | d813792 | 2021-02-17 15:34:07 -0800 | [diff] [blame] | 18 | |
swissChili | 0b35bf2 | 2021-02-18 12:49:40 -0800 | [diff] [blame] | 19 | vga_set_color(LIGHT_GREEN, BLACK); |
20 | vga_write("Setup complete!\n"); | ||||
21 | vga_set_color(WHITE, BLACK); | ||||
swissChili | d813792 | 2021-02-17 15:34:07 -0800 | [diff] [blame] | 22 | |
swissChili | 825d46b | 2021-02-21 10:14:16 -0800 | [diff] [blame] | 23 | init_timer(20); |
24 | |||||
swissChili | 19ef418 | 2021-02-21 17:45:51 -0800 | [diff] [blame] | 25 | init_kbd(); |
swissChili | defeb0d | 2021-02-18 15:28:36 -0800 | [diff] [blame] | 26 | asm volatile("sti"); |
27 | |||||
swissChili | 0b35bf2 | 2021-02-18 12:49:40 -0800 | [diff] [blame] | 28 | |
swissChili | 825d46b | 2021-02-21 10:14:16 -0800 | [diff] [blame] | 29 | #ifdef TEST_PAGE_FAULT |
30 | kprintf("Causing page fault:\n"); | ||||
31 | |||||
32 | volatile uint *ptr = (uint *) 0xa0000000; | ||||
33 | volatile uint cause_page_fault = *ptr; | ||||
34 | |||||
35 | kprintf("Should have caused page fault: %d...\n", cause_page_fault); | ||||
36 | #endif | ||||
37 | |||||
38 | while (true) | ||||
39 | asm volatile("hlt"); | ||||
40 | |||||
swissChili | d813792 | 2021-02-17 15:34:07 -0800 | [diff] [blame] | 41 | return 0xCAFEBABE; |
42 | } |