Search code examples
operating-systemkernelqemu

QEMU i386 pmio addresses


I'm starting developing a toy kernel for i386, and I'm finding it hard to locate the ISA addresses of the PMIO registers. For example, I've been looking at the Intel 8259 PIC (Programmable Interrupt Controller), but its port address is nowhere to be found in the QEMU source code. I've done a thorough search in the code base. Also, I'm couldn't find the memory layout of the i386 platform it's emulating.


Solution

  • QEMU emulates a fairly standard x86 PC, either an i440fx or a q35 motherboard, depending on which machine type you picked on the command line. So, like every x86 PC, the 8529 lives at port address 0x20 for the master and 0xA0 for the slave, as described eg here: https://wiki.osdev.org/8259_PIC . For other information like the memory layout, you should consult references on PC-class x86 hardware.

    In the QEMU source code, these port addresses are set in the i8259_init_chip() function, which sets the "iobase" property of the 8259 to either 0x20 or 0xa0.