1000Hz PIC timer working + IDT dispatch/handler fixes

This commit is contained in:
2025-12-27 13:52:05 +01:00
parent 24d75463b8
commit 54f26c506e
9 changed files with 204 additions and 52 deletions

View File

@@ -7,6 +7,8 @@
#include "mem/gdt.h"
#include "mem/utils.h"
#include "idt/idt.h"
#include "kernel.h"
#include "time/timer.h"
// Limine version used
__attribute__((used, section(".limine_requests")))
@@ -36,20 +38,6 @@ static void hcf()
}
}
static inline void trigger_div0(void)
{
asm volatile (
"mov $1, %%rax\n"
"xor %%rdx, %%rdx\n"
"xor %%rcx, %%rcx\n" // divisor = 0
"idiv %%rcx\n"
:
:
: "rax", "rcx", "rdx"
);
}
// This is our entry point
void kmain()
{
@@ -63,12 +51,15 @@ void kmain()
if (serial_init()) kputs("kernel: serial: error: Cannot init serial communication!");
CLEAR_INTERRUPTS;
gdt_init();
idt_init();
timer_init();
SET_INTERRUPTS;
// Draw something
printf("%s, %s!", "Hello", "world");
trigger_div0();
//printf("%d", 4/0);
hcf();
}