limine/ioapic: Change spec to avoid masking IOAPIC RTEs unless Fixed or Lowest Priority

This commit is contained in:
mintsuki 2023-10-23 05:11:28 +02:00
parent 3e77a04d2f
commit de7dff1d4f
2 changed files with 10 additions and 1 deletions

View File

@ -197,7 +197,8 @@ If 5-level paging is requested and available, then 5-level paging is enabled
The A20 gate is opened. The A20 gate is opened.
Legacy PIC and IO APIC IRQs are all masked. Legacy PIC (if available) and IO APIC IRQs (only those with delivery mode fixed
(0b000) or lowest priority (0b001)) are all masked.
If booted by EFI/UEFI, boot services are exited. If booted by EFI/UEFI, boot services are exited.

View File

@ -156,6 +156,14 @@ void io_apic_mask_all(void) {
uint32_t gsi_count = io_apic_gsi_count(i); uint32_t gsi_count = io_apic_gsi_count(i);
for (uint32_t j = 0; j < gsi_count; j++) { for (uint32_t j = 0; j < gsi_count; j++) {
uintptr_t ioredtbl = j * 2 + 16; uintptr_t ioredtbl = j * 2 + 16;
switch ((io_apic_read(i, ioredtbl) >> 8) & 0b111) {
case 0b000: // Fixed
case 0b001: // Lowest Priority
break;
default:
continue;
}
io_apic_write(i, ioredtbl, (1 << 16)); // mask io_apic_write(i, ioredtbl, (1 << 16)); // mask
io_apic_write(i, ioredtbl + 1, 0); io_apic_write(i, ioredtbl + 1, 0);
} }