aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/kernel.c
blob: b6f0591ee205817f5dd05565fbd7c448b2020f8f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <kernel/graphics/vesa.h>
#include <kernel/gdt/gdt.h>
#include <kernel/interrupts/interrupts.h>
#include <kernel/io/io.h>
#include <kernel/timer/timer.h>
#include <kernel/paging/paging.h>
#include <kernel/input/input.h>

void init() {
    timer_install();
    gdt_install();
    paging_install();
    keyboard_install();
    idt_install();
    isrs_install();
    irq_install();
    init_serial();
    set_optimal_resolution();
    asm volatile ("sti");
}

void kernel_main(void) {
    init();

    vesa_draw_string("This is a testing text!");

    if (vesa_available) {
        serial_write("Loaded VESA!\n");
    } else {
        serial_write("VESA loading failed!\n");
        switch_to_vga();
    }

    // __asm__  ("div %0" :: "r"(0)); // Exception testing x/0
    loop:
    asm volatile ("hlt");
    goto loop;
}