1
0
Fork 0

feat/kernel: Removed broken PIT and added yet another broken PIT

This commit is contained in:
Kevin Alavik 2025-05-17 12:33:25 +02:00
parent 560417b091
commit c10028d366
Signed by: cmpsb
GPG key ID: 10D1CC0526FDC6D7
5 changed files with 102 additions and 82 deletions

View file

@ -22,7 +22,6 @@
#include <arch/smp.h>
#include <sys/lapic.h>
#include <sys/ioapic.h>
#include <sys/pit.h>
__attribute__((used, section(".limine_requests"))) static volatile LIMINE_BASE_REVISION(3);
__attribute__((used, section(".limine_requests"))) static volatile struct limine_memmap_request memmap_request = {
@ -67,6 +66,15 @@ void tick(struct register_ctx *)
lapic_eoi();
}
void timer_init()
{
uint16_t divisor = 11932;
outb(0x43, 0x36);
outb(0x40, divisor & 0xFF);
outb(0x40, (divisor >> 8) & 0xFF);
idt_register_handler(0x32, tick);
}
void emk_entry(void)
{
__asm__ volatile("movq %%rsp, %0" : "=r"(kstack_top));
@ -194,8 +202,7 @@ void emk_entry(void)
log_early("Initialized LAPIC");
/* Setup timer */
pit_init(tick);
log_early("Initialized Timer");
timer_init();
/* Setup SMP */
if (!mp_request.response)