]> git.dujemihanovic.xyz Git - nameless-os.git/blobdiff - kernel/kernel.c
Enable paging in bootloader
[nameless-os.git] / kernel / kernel.c
index 4c6efd8692da90d7ab15cf782846b3194e9483f7..060051c25782f3317f426f0ea44362e420a98b80 100644 (file)
@@ -3,11 +3,14 @@
 #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 kmain(void)
 {
@@ -16,8 +19,9 @@ void kmain(void)
        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);