Kernel: Add processor dump flag to APIC

This commit is contained in:
Bananymous 2023-01-26 13:13:46 +02:00
parent 6418d7cfc3
commit bfe3426f6d
1 changed files with 11 additions and 0 deletions

View File

@ -14,6 +14,8 @@
#define IOAPIC_MAX_REDIRS 0x01 #define IOAPIC_MAX_REDIRS 0x01
#define IOAPIC_REDIRS 0x10 #define IOAPIC_REDIRS 0x10
#define DEBUG_PRINT_PROCESSORS 0
// https://uefi.org/specs/ACPI/6.5/05_ACPI_Software_Programming_Model.html#multiple-apic-description-table-madt-format // https://uefi.org/specs/ACPI/6.5/05_ACPI_Software_Programming_Model.html#multiple-apic-description-table-madt-format
static constexpr uint32_t RSPD_SIZE = 20; static constexpr uint32_t RSPD_SIZE = 20;
@ -288,6 +290,15 @@ APIC* APIC::Create()
uint32_t sivr = apic->ReadFromLocalAPIC(LAPIC_SIV_REG); uint32_t sivr = apic->ReadFromLocalAPIC(LAPIC_SIV_REG);
apic->WriteToLocalAPIC(LAPIC_SIV_REG, sivr | 0x1FF); apic->WriteToLocalAPIC(LAPIC_SIV_REG, sivr | 0x1FF);
#if DEBUG_PRINT_PROCESSORS
for (auto& processor : apic->m_processors)
{
dprintln("Processor{}", processor.processor_id);
dprintln(" lapic id: {}", processor.apic_id);
dprintln(" status: {}", (processor.flags & Processor::Flags::Enabled) ? "enabled" : (processor.flags & Processor::Flags::OnlineCapable) ? "can be enabled" : "disabled");
}
#endif
return apic; return apic;
} }