Master the fundamental concepts of bios & uefi programming through this focused micro-challenge.
Before OS PCI drivers exist, the PCI BIOS extensions (INT 0x1A, AX=0xB101) let real-mode code enumerate devices. You supply a bus/device/function triple and a register offset; the call returns configuration dword data. For example, reading offset 0x00 on bus 0 dev 0 fn 0 yields vendor ID 0x8086 for many Intel host bridges.
nasmLoading…
Vendor ID 0xFFFF means no device present at that slot.
Many UEFI-only machines omit PCI BIOS entirely; your code should detect failure via carry and fall back to MMIO ECAM if present. Function numbers above zero appear on multifunction cards like USB controllers. Always enable I/O and memory decode in the command register before expecting BAR accesses to work on real hardware after enumeration.
You will enumerate PCI functions and print vendor/device IDs using INT 0x1A. This exercise requires packing bus, device, and function into BX and interpreting the configuration dword the BIOS returns.
Implement PCI BIOS function calls in C.
Requirements:
Test:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github