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:
- The interrupt controller (IO APIC) is built, milestone 161's own item 2, reached directly by
arch::x86_64::irqrather than throughmemory.rs's statics. - PCI is wired, and has been since milestone 165's ACPI/MCFG work.
kernel/src/main.rscallsmemory::record_pci_regionsfrom the ACPIecampath, somemory::pci_regions()returnsSomeon x86_64.
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
- Decision.
design/decisions/0121-port-io-capability.mdgives x86's legacy devices aPortRangecapability, anddesign/decisions/0130-cmos-rtc-delegation.mduses it for the RTC: the userspace clock service reads the CMOS through it.rtc_region()staysNoneon x86_64 because the CMOS has no page. - Recorded.
clock_contract(spelled clock_proto when this was written, and now atpartsfoundry/clock_contract) carries the newrtckind, shipped as a provisional name like every name a lane mints.CMOSis unlike its siblings in kind.PL031andGOLDFISHname a register layout the clock service reads through a mapping, whileCMOSnames two I/O ports it reads through aPortRange. - Recorded.
kernel/src/arch/x86_64/machine.rs's BUGS section had claimed for two milestones that the interrupt controller and the PCIe ECAM range were stillNoneon x86_64, after milestones 161 and 165 had wired both. Corrected here, and it now names only the device windows that are genuinely absent. - Milestone 362.
design/roadmap/0362-virtio-rng-on-the-x86-64-runner.md, attach a virtio-rng function to the x86_64 test runner and wire it, so the NTP client has a nonce source there; four ofntp_tests.rs's six tests skip on x86_64 without one. That block is SUPERSEDED, on its own instruction: the larger x86_64 fixture lane it asked to be folded into is numbered now and names the RNG among its devices, so the work is there rather than in two places.
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.