Clean up ApicRegister

This commit is contained in:
Josh Holtrop 2022-11-05 22:22:09 -04:00
parent 95b9e4558a
commit 5231930543

View File

@ -11,19 +11,11 @@ struct apic
{ {
static struct ApicRegister static struct ApicRegister
{ {
private uint register; public uint value;
alias value this;
private ubyte[12] _padding; private ubyte[12] _padding;
}
public uint read() const
{
return register;
}
public void write(uint value)
{
register = value;
}
};
static struct ApicRegisters static struct ApicRegisters
{ {
@ -55,7 +47,7 @@ struct apic
ApicRegister current_count; ApicRegister current_count;
ApicRegister[4] _reserved3; ApicRegister[4] _reserved3;
ApicRegister divide_configuration; ApicRegister divide_configuration;
}; }
public static void initialize() public static void initialize()
{ {
@ -63,7 +55,7 @@ struct apic
cast(ApicRegisters *)acpi.apic_address; cast(ApicRegisters *)acpi.apic_address;
hurl.map(cast(ulong)apic_registers, cast(ulong)apic_registers, hurl.map(cast(ulong)apic_registers, cast(ulong)apic_registers,
PT_WRITABLE | PT_WRITE_THROUGH | PT_DISABLE_CACHE | PT_NO_EXECUTE); PT_WRITABLE | PT_WRITE_THROUGH | PT_DISABLE_CACHE | PT_NO_EXECUTE);
klog.writefln("LAPIC ID: 0x%08x", apic_registers.lapic_id.read()); klog.writefln("LAPIC ID: 0x%08x", apic_registers.lapic_id.value);
klog.writefln("LAPIC version: 0x%08x", apic_registers.lapic_version.read()); klog.writefln("LAPIC version: 0x%08x", apic_registers.lapic_version.value);
} }
} }