Hello,
I don't know if "corrupted" is the proper word but nevertheless I got a curious problem while reading registers of the PCI configuration space in Qemu:
Compared to to what I get when I execute the same code in Bochs, it seems that the register values of PCI config space lack of the last byte when executed in Qemu.
Here is a short example:
In my PCI startup code I enumerate the PCI bus to determine the base/sub class of each PCI device. Therefore I read the register at offset 0x08 of each device (e.g. Host-PCI Bridge or PCI-ISA Bridge) and the content differs like the following:
Host-PCI Bridge
Bochs: I got a value like 0x6010000
Qemu: the value of the register is 0x60100
PCI-ISA Bridge
Bochs: I got a value like 0x6000000
Qemu: the value of the register is 0x60000
In both cases only Bochs provides register values that seem to be reasonably. As written before, when run in Qemu, it seems that the registers lack of one bte.
Does anyone have an idee or know what's the difference between Bochs and Qemu?
Registers of PCI config space seem to be corrupted in Qemu
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Registers of PCI config space seem to be corrupted in Qemu
There is no obvious difference in class codes between Bochs and QEmu - in fact in both cases I get correct data returned.
What can matter is how hardware responds to various sized reads - You should always read doublewords and then perform the shifts manually. QEmu is known to differ from real hardware in this respect.
how it should be done
What can matter is how hardware responds to various sized reads - You should always read doublewords and then perform the shifts manually. QEmu is known to differ from real hardware in this respect.
how it should be done
Re: Registers of PCI config space seem to be corrupted in Qemu
Thank you very much!
Finally, when I read the link "how it should be done", I saw that I specified the wrong address type (bit 0 and 1) while assembling the pci configuration space address.
Cheers!
Finally, when I read the link "how it should be done", I saw that I specified the wrong address type (bit 0 and 1) while assembling the pci configuration space address.
Cheers!
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Registers of PCI config space seem to be corrupted in Qemu
Glad it helped, even after all this time