1
0
Fork 0

feat/kernel: APIC (LAPIC / IOAPIC) and PIT

This commit is contained in:
Kevin Alavik 2025-05-16 20:19:05 +02:00
parent cdceef1da7
commit 9fcac766f6
Signed by: cmpsb
GPG key ID: 10D1CC0526FDC6D7
10 changed files with 350 additions and 11 deletions

30
kernel/src/sys/ioapic.h Normal file
View file

@ -0,0 +1,30 @@
/* EMK 1.0 Copyright (c) 2025 Piraterna */
#ifndef IOAPIC_H
#define IOAPIC_H
// Credits: https://github.com/SILD-Project/soaplin/blob/main/kernel/src/dev/ioapic.h
#include <stdbool.h>
#include <sys/acpi.h>
#include <sys/acpi/madt.h>
#define IOAPIC_REGSEL 0x0
#define IOAPIC_IOWIN 0x10
#define IOAPIC_ID 0x0
#define IOAPIC_VER 0x01
#define IOAPIC_ARB 0x02
#define IOAPIC_REDTBL 0x10
void ioapic_write(acpi_madt_ioapic_t *ioapic, uint8_t reg, uint32_t val);
uint32_t ioapic_read(acpi_madt_ioapic_t *ioapic, uint8_t reg);
void ioapic_redirect_irq(uint32_t lapic_id, uint8_t vec, uint8_t irq,
bool mask);
uint32_t ioapic_get_redirect_irq(uint8_t irq);
void ioapic_set_entry(acpi_madt_ioapic_t *ioapic, uint8_t idx, uint64_t data);
void ioapic_init();
#endif // IOAPIC_H