hw/dma.c: Fix conversion of ioport_register* to MemoryRegion
authorJulien Grall <julien.grall@citrix.com>
Wed, 19 Dec 2012 12:09:21 +0000 (12:09 +0000)
committerAndreas Färber <afaerber@suse.de>
Tue, 15 Jan 2013 18:45:25 +0000 (19:45 +0100)
commitecd584b836937eb45f7e7e487595002486a09cb7
treea336308db12a651607b1aee059b564f83d8cf664
parentcf7c3f0cb5a7129f57fa9e69d410d6a05031988c
hw/dma.c: Fix conversion of ioport_register* to MemoryRegion

The commit 582299336879504353e60c7937fbc70fea93f3da introduced a 1-shift for
some offset in DMA emulation.

Before the previous commit, which converted ioport_register_* to
MemoryRegion, the DMA controller registered 8 ioports with the following
formula:
base + ((8 + i) << d->shift) where 0 <= i < 8
When an IO occured within a Memory Region, DMA callback receives an
offset relative to the start address. Here the start address is:
base + (8 << d->shift).
The offset should be: (i << d->shift). After the shift is reverted, the
offsets are 0..7 not 1..8.

Fixes LP#1089996.

Reported-by: Andreas Gustafsson <gson@gson.org>
Signed-off-by: Julien Grall <julien.grall@citrix.com>
Tested-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
hw/dma.c