roadmap BUILT

176. The x86_64 discovery seam's wide half: COM1's IRQ and a CMOS RTC

This is the wide half of milestone 161 (the x86_64 kernel port)'s item 0. Piece 1 is built (below). Piece 2 needed a decision, ratified 2026-08-26: DECISIONS §130 (how the userspace clock service reads the x86 CMOS RTC). It is built against it (below).

The four device windows, and which two are this milestone's

The x86_64 discovery seam has four device windows that a tree supplies on the other architectures. They are the interrupt controller, the RTC, the UART's interrupt line, and the PCIe ECAM range. Two of those four are built elsewhere:

Two are real, and are this milestone's actual scope:

Built: piece 1, COM1's IRQ wired, 2026-08-25

Acpi::isa_irqs already resolved all sixteen legacy ISA IRQs at boot; isa_irqs[4] is the console UART's line. kernel/src/main.rs's boot tour now reads it (acpi.isa_irqs[4].gsi) and hands it to a new memory::record_uart_irq, the same-shaped setter memory::record_pci_regions already was for PCI. It fills memory::UART_IRQ, the exact static the other two architectures fill from their device tree at memory.rs line 135. user::uart_irq_and_source() (already generic across all three architectures) now reports a real answer on x86_64 instead of always falling back to the UART_RX_INTID constant. Its "device tree" source string, and memory::uart_irq()'s matching doc comment, were generalized to "machine description" since ACPI is now a second source feeding the same seam. Nothing calls it yet (the x86 console is polled, as the milestone that raised this item already said). This is exactly what it was scoped as: filling a seam for a future reader to find real, rather than routing an interrupt.

kernel/src/arch/x86_64/machine.rs's stale BUGS comment was also corrected: PCI has been wired since milestone 165 (x86_64 PCI enumeration) and the interrupt controller since milestone 161 (the x86_64 kernel port)'s item 2, neither is None today. The BUGS section now names only the CMOS RTC (piece 2, below) as the device window with no seam at all.

Built: piece 2, a CMOS RTC read by the kernel, 2026-08-25

Sizing this found a real design fork, not a shape to build: the other two architectures' RTCs are memory-mapped, so their RTC_REGION seam is a physical page a driver maps and pokes directly. The PC-compatible CMOS RTC is two fixed I/O ports, and DECISIONS §121's current (still-PROPOSED) recommendation keeps all x86 legacy port I/O kernel-resident, so the existing "map the device, let userspace drive it" pattern has no CMOS equivalent. Full writeup, four options considered, and the decision itself in DECISIONS §130. Option 2: the clock service holds a PortRange capability over the two CMOS ports and reads the CMOS itself, as it maps a PL031 on the other architectures. The kernel reads no CMOS.

The CMOS reader is components/src/clock.rs's CMOS driver: a dozen in8/out8 pairs against ports 0x70/0x71, with the CMOS update-in-progress flag polled and a double-read-and-compare so a read never lands mid-update. BCD-to-binary and 12h/24h are decoded per status register B, and the six raw fields turned into a Unix timestamp through the calendar crate this tree already depends on rather than a second copy of that arithmetic. clock_contract::rtc::CMOS (provisional; a kind, = 3) names the two ports the service reads, rtc::INDEX_PORT and rtc::DATA_PORT, as PL031 and GOLDFISH name register layouts the service reads through a mapping. The wiring grants the service a PortRange over both ports with WRITE, because the I/O permission bitmap cannot permit in without out (§121 (what a device capability is when the device has no page)). rtc_region() stays None on x86_64: the ports are not a page. read_rtc in the service takes the CMOS kind and reads through the PortRange, with no base address.

date_tests.rs, time_tests.rs, clock_tests.rs and ntp_tests.rs all run on x86_64 now instead of skipping via clock_service::machine_has_no_rtc(), which itself now asks the kernel's CMOS reader on this architecture rather than the device tree. Four of ntp_tests.rs's six tests still skip there, but for an unrelated, pre-existing reason found while wiring this up. The test runner attaches no virtio-rng function on any bus for x86_64 yet (notes/x86-port.md). So the NTP client correctly refuses to reach the network without a nonce source, the same refusal without_entropy_the_client_refuses_rather_than_guessing tests on purpose. ntp_tests.rs gained a machine_has_no_entropy guard, the same convention disk_tests, credential_tests and entropy_tests already use for that cause, so the four skip with a reason rather than panic; giving x86_64 a network entropy device is its own, unstarted piece of work.

Piece 1 is complete and independent of this.

Follow-on

Index row

Milestone 161's own item 0, re-scoped fresh: two of the four windows its text named (the interrupt controller, PCI) turned out to already be built, checked directly against the tree. Piece 1 built (2026-08-25): COM1's already-discovered IRQ (Acpi::isa_irqs[4]) wired into memory::UART_IRQ, and machine.rs's stale BUGS comment corrected. Piece 2, a CMOS RTC, built (2026-08-25) against DECISIONS §130. The userspace clock service reads the CMOS itself, through a PortRange capability over ports 0x70 and 0x71 (clock_contract::rtc::CMOS), as every other RTC consumer assumed. The kernel reads no CMOS. date_tests.rs, time_tests.rs, clock_tests.rs and ntp_tests.rs now run on x86_64 instead of skipping.