Add apic module that does not do anything yet

This commit is contained in:
Josh Holtrop 2022-10-18 12:56:02 -04:00
parent dba58b2277
commit b1be5b888f
2 changed files with 24 additions and 0 deletions

22
src/hulk/apic.d Normal file
View File

@ -0,0 +1,22 @@
/**
* APIC (Advanced Programmable Interrupt Controller) functionality.
*/
module hulk.apic;
import hulk.klog;
import hulk.hurl;
import hulk.acpi;
struct apic
{
public enum uint * local_apic_registers = cast(uint *)0xFEE0_0000u;
public static void initialize()
{
Hurl.map(cast(ulong)local_apic_registers,
cast(ulong)local_apic_registers,
MAP_WRITABLE | MAP_WRITE_THROUGH | MAP_DISABLE_CACHE | MAP_NO_EXECUTE);
klog.writefln("LAPIC ID: 0x%08x", local_apic_registers[0x20/4]);
klog.writefln("LAPIC version: 0x%08x", local_apic_registers[0x30/4]);
}
}

View File

@ -19,6 +19,7 @@ import hos.cpu;
import ldc.llvmasm;
import hulk.pic;
import hulk.acpi;
import hulk.apic;
extern extern(C) __gshared ubyte _hulk_total_size;
@ -52,6 +53,7 @@ void hulk_start()
pci.initialize();
pic.initialize();
acpi.initialize(hulk_header.bootinfo.acpi_xsdt_phys);
apic.initialize();
sti();
for (;;)