]> git.dujemihanovic.xyz Git - nameless-os.git/blobdiff - kernel/kernel.c
Enable paging in bootloader
[nameless-os.git] / kernel / kernel.c
index e1a0df5158f3b06bfd44e8693db172d431737dbf..060051c25782f3317f426f0ea44362e420a98b80 100644 (file)
@@ -3,21 +3,25 @@
 #include <irq/idt.h>
 #include <irq/i8259a.h>
 #include <stdint.h>
+#include <mm/paging.h>
 
 extern void double_fault(struct abort_frame *frame);
 extern void keyb_handler(struct interrupt_frame *frame);
-struct idt_descriptor idt[256] __attribute__((aligned(0x10)));
-struct idtr idtr __attribute__((aligned(0x10)));
+extern void pf_handler(struct fault_frame *frame);
+static struct idt_descriptor idt[256] __attribute__((aligned(0x10)));
+static struct idtr idtr __attribute__((aligned(0x10)));
 
-void _start(void)
+
+void kmain(void)
 {
        screen_clear();
        kprint("Welcome to Nameless OS!\nRunning revision: ", 0);
        kprint(GIT_COMMIT, 0);
        kprint("\n", 0);
        kprint("Preparing IDT...\n", 0);
-       idt_set_descriptor(idt, 0x8, 0x8, (uint32_t) double_fault, IDT_TRAP_GATE, 0x0);
-       idt_set_descriptor(idt, 0x21, 0x8, (uint32_t) keyb_handler, IDT_INTERRUPT_GATE, 0x0);
+       idt_set_descriptor(idt, 8, 0x8, (uint32_t) double_fault, IDT_INTERRUPT_GATE, 0x0);
+       idt_set_descriptor(idt, 14, 0x8, (uint32_t) pf_handler, IDT_INTERRUPT_GATE, 0x0);
+       idt_set_descriptor(idt, 33, 0x8, (uint32_t) keyb_handler, IDT_INTERRUPT_GATE, 0x0);
        kprint("IDT prepared, loading...\n", 0);
        populate_idtr(&idtr, idt);
        load_idt(idtr);