I'm currently working on interrupts for my small OS, and I've been at it for quite a while, to no avail. It seems that whenever I start up my OS it causes a General Protection Fault (interrupt 13). The full code is available at the link in my signature.
I've scoured the internet searching for a solution, and currently my code is pretty sloppy, I'm just trying to make it work. I always end up on the same webpages telling me the same things.
This is my kernel's main function:
Code: Select all
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
// Header files
#include <lib/idt.h>
#include <drivers/io.h>
#include <drivers/pic.h>
#include <drivers/vga.h>
#include <drivers/keyboard.h>
void main(void) {
idt_init();
pic_init();
vga_init();
// even with all of this commented out, I get exception 13 thrown at me.
// keyboard_init();
// vga_prints("Welcome to Nox!");
// while (true) {
// keyboard_input();
// }
return;
}
Once my main function returns, I don't disable interrupts since that's how I intend to get keyboard input down the line, which explains the reboot loop.
I'm very new when it comes to interrupts, exceptions, the IDT in general, and I'm having a bit of trouble wrapping my head around it all. I've read all of the pages on the OSDev Wiki on these subjects, but it doesn't help that I'm having problems getting everything set up.
Does anybody know what why I'm getting these exceptions?