2022-02-22 14:01:39 +02:00
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdint.h>
|
2022-02-24 18:16:17 +02:00
|
|
|
#include "gfx/terminal.h"
|
2022-02-22 21:20:57 +02:00
|
|
|
#include "cpu/pic.h"
|
|
|
|
#include "cpu/idt.h"
|
2022-02-24 18:11:09 +02:00
|
|
|
#include "std/kstd.h"
|
2022-02-22 21:20:57 +02:00
|
|
|
|
2022-02-22 14:01:39 +02:00
|
|
|
#if defined(__linux__)
|
|
|
|
#error "You are not using a cross-compiler, you will most certainly run into trouble"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(__i386__)
|
|
|
|
#error "This OS needs to be compiled with a ix86-elf compiler"
|
|
|
|
#endif
|
2022-02-22 21:20:57 +02:00
|
|
|
|
|
|
|
void kmain(void) {
|
2022-02-22 14:01:39 +02:00
|
|
|
terminal_initialize();
|
2022-02-22 21:20:57 +02:00
|
|
|
|
2022-02-24 18:11:09 +02:00
|
|
|
kprintf("kmain(): info: kernel init started\n");
|
2022-02-22 21:20:57 +02:00
|
|
|
|
2022-02-24 18:11:09 +02:00
|
|
|
kprintf("[ ] Remapping PIC");
|
2022-02-22 21:20:57 +02:00
|
|
|
pic_remap(0x20, 0x28);
|
2022-02-24 18:11:09 +02:00
|
|
|
kprintf("\r[ OK ]\n");
|
2022-02-22 21:20:57 +02:00
|
|
|
|
2022-02-24 18:11:09 +02:00
|
|
|
kprintf("[ ] Installing exception handlers");
|
|
|
|
exception_handlers_init();
|
|
|
|
kprintf("\r[ OK ]\n");
|
|
|
|
|
|
|
|
kprintf("[ ] Initializing IDT");
|
|
|
|
idt_init();
|
|
|
|
kprintf("\r[ OK ]\n");
|
2022-02-22 21:20:57 +02:00
|
|
|
|
2022-02-24 18:11:09 +02:00
|
|
|
terminal_writestring("Initialization finished.\n");
|
2022-02-22 14:01:39 +02:00
|
|
|
}
|
|
|
|
|