addind more important kernel files and also fixing bugs

This commit is contained in:
2025-05-15 02:37:06 -07:00
parent 512bd49ff7
commit a9f2826014
21 changed files with 489 additions and 17 deletions

View File

@@ -1,12 +1,12 @@
#include "terminal.h"
#include "serial.h"
#include "isr.h"
#include "io.h"
static isr_callback_t interrupt_handlers[MAX_INTERRUPTS] = { 0 };
void isr_handler(uint32_t int_num, uint32_t err_code) {
terminal_write("Interrupt occurred: ");
// Here you can add a basic itoa to print int_num
serial_write("INT triggered\n");
if (interrupt_handlers[int_num]) {
@@ -27,6 +27,16 @@ void isr_handler(uint32_t int_num, uint32_t err_code) {
asm volatile ("hlt");
}
}
// === Send End Of Interrupt to PIC(s) ===
if (int_num >= 40) {
// Send reset signal to slave PIC
outb(0xA0, 0x20);
}
if (int_num >= 32) {
// Send reset signal to master PIC
outb(0x20, 0x20);
}
}
void register_interrupt_handler(uint8_t n, isr_callback_t handler) {