From ced00ad8546f4dce96f2b5cb0994f009562c8a08 Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Mon, 18 Apr 2022 01:32:07 +0200 Subject: [PATCH] Fixed bootloop --- bootloader/bootloader.asm | 2 +- kernel/interupt.c | 4 ++-- kernel/kernel.c | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/bootloader/bootloader.asm b/bootloader/bootloader.asm index 37d4afe..f04fef8 100644 --- a/bootloader/bootloader.asm +++ b/bootloader/bootloader.asm @@ -60,7 +60,7 @@ pm_init: mov fs, ax mov gs, ax - mov ebp, 0x900000 ; Update the stack pointer + mov ebp, 0xf00000 ; Update the stack pointer mov esp, ebp call BEGIN_PM diff --git a/kernel/interupt.c b/kernel/interupt.c index 07e5584..cd4ac59 100644 --- a/kernel/interupt.c +++ b/kernel/interupt.c @@ -13,7 +13,7 @@ typedef struct { uint base; } __attribute__((packed)) idtr; -__attribute__((aligned(4))) +__attribute__((aligned(16))) static idt_entry IDT[IDT_MAX_DESCS]; static idtr IDTR; @@ -31,7 +31,7 @@ void idt_set_desc(uint8 idx, void* isr, uint8 flags) { idt_entry* desc = &IDT[idx]; // get descriptor desc->offset_1 = (uint) isr & 0xffff; - desc->selector = 0x05; // kernel code selector for the GDT (null is 0x0 - 0x4 => code is 0x05 to something...) + desc->selector = 0x08; // kernel code selector for the GDT (null is 0x0 - 0x4 => code is 0x05 to something...) desc->reserved = 0; desc->type_attr = flags; desc->offset_2 = (uint) isr >> 16; diff --git a/kernel/kernel.c b/kernel/kernel.c index 118903f..c49bd10 100644 --- a/kernel/kernel.c +++ b/kernel/kernel.c @@ -52,7 +52,6 @@ void print_kernel_stats() { } void kernel_init() { - idt_init(); // Enable interupts vga_init(); // Initialize the screen first // i.e. clear the screen et cetera. @@ -67,6 +66,6 @@ void kernel_init() { print_kernel_motd(); print_kernel_stats(); + idt_init(); // Enable interupts while(true) {} - }