ioemu, passthrough: fix corrupting register value in pt_pci_write_config().
authorKeir Fraser <keir.fraser@citrix.com>
Fri, 1 Aug 2008 08:54:13 +0000 (09:54 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Fri, 1 Aug 2008 08:54:13 +0000 (09:54 +0100)
I forgot to shift value read from real device. If the emulated
register offset is not aligned with 4 byte, the write emulation will
not be handled well because of corrupting register value read from
real device. The patch fixes this issue.

Signed-off-by: Yuji Shimada <shimada-yxb@necst.nec.co.jp>
tools/ioemu/hw/pass-through.c

index d1101addfd82980cf8ed0dba5da75a45669a1416..428845f2c9f04359260bfe12bed623e8fd36c5da 100644 (file)
@@ -1101,7 +1101,8 @@ static void pt_pci_write_config(PCIDevice *d, uint32_t address, uint32_t val,
     if (reg_grp_entry == NULL)
         goto out;
 
-    /* adjust the write value to appropriate CFC-CFF window */
+    /* adjust the read and write value to appropriate CFC-CFF window */
+    read_val <<= ((address & 3) << 3);
     val <<= ((address & 3) << 3);
     emul_len = len;