From 13bd34116cddb4768cd518a55152f668cca4d5b9 Mon Sep 17 00:00:00 2001 From: Tulio A M Mendes Date: Mon, 16 Feb 2026 21:45:26 -0300 Subject: [PATCH] =?utf8?q?fix:=20KVA=5FIOAPIC=20VA=20collision=20with=20BS?= =?utf8?q?S=20=E2=80=94=20move=20from=200xC0201000=20to=200xC0401000?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Root cause: multiboot_copy (64KB static buffer) starts at VA 0xC0200FE0, spanning pages 0xC0200000-0xC0210000. KVA_IOAPIC at 0xC0201000 mapped IOAPIC MMIO over the BSS page containing the multiboot2 cmdline tag data. After arch_platform_setup, reading bi->cmdline returned IOAPIC register data (zeros) instead of the original cmdline string. Symptom: [CMDLINE] "" regardless of GRUB menu entry selected. Classic Heisenbug — adding a debug kprintf before IOAPIC init read the correct data, masking the corruption. Fix: move KVA_IOAPIC to 0xC0401000 (next to LAPIC at 0xC0400000), well past _end at 0xC0265728. Updated VA map comment to reflect current BSS extent (~0xC0266000). --- include/arch/x86/kernel_va_map.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/arch/x86/kernel_va_map.h b/include/arch/x86/kernel_va_map.h index b5c3505..3ab77b2 100644 --- a/include/arch/x86/kernel_va_map.h +++ b/include/arch/x86/kernel_va_map.h @@ -10,8 +10,7 @@ * * Layout (sorted by VA): * - * 0xC0000000 .. ~0xC0203000 Kernel .text/.data/.bss (variable) - * 0xC0201000 IOAPIC MMIO (1 page) + * 0xC0000000 .. ~0xC0266000 Kernel .text/.data/.bss (variable) * 0xC0280000 vDSO shared page (1 page) * 0xC0300000 .. 0xC030FFFF ACPI temp window (16 pages) * 0xC0320000 ATA DMA PRDT (1 page) @@ -22,6 +21,7 @@ * 0xC0352000 .. 0xC0361FFF E1000 TX buffers (16 pages) * 0xC0362000 .. 0xC0371FFF E1000 RX buffers (16 pages) * 0xC0400000 LAPIC MMIO (1 page) + * 0xC0401000 IOAPIC MMIO (1 page) * 0xC8000000 .. Kernel stacks (guard + 8KB per thread) * 0xD0000000 .. Kernel heap (10 MB) * 0xDC000000 .. Initrd / generic phys mapping (up to 64 MB) @@ -29,7 +29,7 @@ */ /* IOAPIC (arch/x86/ioapic.c) */ -#define KVA_IOAPIC 0xC0201000U +#define KVA_IOAPIC 0xC0401000U /* vDSO shared page (kernel/vdso.c) */ #define KVA_VDSO 0xC0280000U -- 2.43.0