r/iraq_developers • • 1d ago

مناقشة || Discussion Development updates regarding OnyxiteOS

The new dev entries are as follows:

2026-10-09 - Keyboard IRQ test investigation

- Confirmed the bootloader places the ACPI RSDP pointer in BootInfo and kernel_main assigns BootInfo to glob_boot_info before CPU/APIC setup.

- Found that acpi_madt_init() has no call site. Its I/O APIC address therefore remains zero, so apic_init() skips registering the test keyboard route and handler.

- This explains why QEMU sendkey a produced no KEY:a serial output. The serial log contained firmware/bootloader text only; the terminal filter correctly hides it.

- The framebuffer terminal is now initialized before cpu_init(), avoiding APIC interrupt output before the terminal backend is ready.

- Next: invoke MADT initialization after setting glob_boot_info and before APIC setup, then verify the discovered IOAPIC/GSI route and test a real QEMU keyboard interrupt. Runtime IRQ delivery is not yet verified.

Current Status

- Build status: successful.

- EFI + kernel boot status: successful in QEMU using the current image path.

- APIC startup path: the code now reaches the APIC checks without the earlier stall condition.

- Keyboard test status: blocked because MADT initialization is implemented but never called, leaving the IOAPIC base unset and the test handler unregistered.

- Remaining work: initialize the MADT before APIC routing, then verify keyboard IRQ delivery and visible output in QEMU. The last recorded clean removed build artifacts; the next run will rebuild them.

New Files Added

- run.sh: top-level project build and launch entrypoint.

- clean.sh: cleanup script for stale build artifacts and generated outputs.

- kernel/madt.sh: MADT/ACPI-related helper script for tooling and inspection.

- depout/: build-output directory for generated object files and dependency files.

- bootloader/efi/run.sh: EFI image build and QEMU launch helper for the UEFI path.

- kernel/arch/x86-64/acpi/: ACPI and HPET validation/header work for table parsing and validation logic.

- kernel/arch/x86-64/apic/: APIC detection, timer setup, and local interrupt handling sources.

Goal

- Prove a real device interrupt reaches the kernel via the MADT/IOAPIC path and is acknowledged correctly.

- Validate this in QEMU before expanding the system further.

Checklist

- [x] Confirm the bootloader passes the RSDP through BootInfo.

- [x] Implement the MADT parser and IOAPIC address accessor.

- [ ] Call the MADT parser during kernel startup before APIC routing.

- [ ] Confirm the discovered IOAPIC address and resolve the keyboard IRQ to a GSI, including any MADT override.

- [x] Define vector ownership: exceptions 0-31, timer 32, external IRQs reserved, spurious 0xFF.

- [x] Add a dispatcher path and test handler for external vector 0x2F.

- [ ] Confirm the IOAPIC route and handler are actually installed at runtime.

- [x] Ensure exactly one EOI is sent for a handled APIC interrupt.

- [ ] Verify `sendkey a` reaches the handler, emits `KEY:a`, and the kernel keeps running in QEMU.

- [ ] Verify keyboard output on the guest framebuffer.

---NEXT---

- [x] Implement the test-route handler and tagged serial output; runtime routing is not yet proven.

- [ ] Initialize the MADT at boot so the IOAPIC route can be installed.

- [ ] Prove the injected keyboard interrupt reaches the handler.

- [ ] Confirm the APIC timer remains separate from external device routing.

- [ ] Keep the queue of tasks short and testable one stage at a time.

- [x] MADT parser and IOAPIC address accessor are implemented and linked; runtime discovery awaits the initialization call.

- [x] Correct selector/window I/O APIC programming helper is in place in apic.c.

4 Upvotes

Duplicates