From 8c715178a115fd4eab786653eb5fcc093a4a18fd Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Fri, 1 Aug 2008 09:54:13 +0100 Subject: [PATCH] ioemu, passthrough: fix corrupting register value in pt_pci_write_config(). 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 --- tools/ioemu/hw/pass-through.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/ioemu/hw/pass-through.c b/tools/ioemu/hw/pass-through.c index d1101addfd..428845f2c9 100644 --- a/tools/ioemu/hw/pass-through.c +++ b/tools/ioemu/hw/pass-through.c @@ -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; -- 2.30.2