[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] ioemu: Better fix for SB16 infinite looping.
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1201685606 0 # Node ID 3daab9b636c121bc9d957568ea135b2f40776ca5 # Parent daf1862c4ee50e5d57304e80bd62ba40b8565a3a ioemu: Better fix for SB16 infinite looping. Qemu upstream solves "Fix an infinite loop in the emulated SB16 device" issue differently as stated in [2] [1] http://xenbits.xensource.com/xen-3.1-testing.hg?rev/4b22d472bda6 [2] http://lists.gnu.org/archive/html/qemu-devel/2008-01/msg00709.html Signed-off-by: S. Caglar Onur <caglar@xxxxxxxxxxxxx> --- tools/ioemu/hw/dma.c | 10 ++++++++++ tools/ioemu/hw/sb16.c | 12 ++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff -r daf1862c4ee5 -r 3daab9b636c1 tools/ioemu/hw/dma.c --- a/tools/ioemu/hw/dma.c Wed Jan 30 09:31:35 2008 +0000 +++ b/tools/ioemu/hw/dma.c Wed Jan 30 09:33:26 2008 +0000 @@ -440,6 +440,13 @@ static void dma_reset(void *opaque) write_cont (d, (0x0d << d->dshift), 0); } +static int dma_phony_handler (void *opaque, int nchan, int dma_pos, int dma_len) +{ + dolog ("unregistered DMA channel used nchan=%d dma_pos=%d dma_len=%d\n", + nchan, dma_pos, dma_len); + return dma_pos; +} + /* dshift = 0: 8 bit DMA, 1 = 16 bit DMA */ static void dma_init2(struct dma_cont *d, int base, int dshift, int page_base, int pageh_base) @@ -472,6 +479,9 @@ static void dma_init2(struct dma_cont *d } qemu_register_reset(dma_reset, d); dma_reset(d); + for (i = 0; i < LENOFA (d->regs); ++i) { + d->regs[i].transfer_handler = dma_phony_handler; + } } static void dma_save (QEMUFile *f, void *opaque) diff -r daf1862c4ee5 -r 3daab9b636c1 tools/ioemu/hw/sb16.c --- a/tools/ioemu/hw/sb16.c Wed Jan 30 09:31:35 2008 +0000 +++ b/tools/ioemu/hw/sb16.c Wed Jan 30 09:33:26 2008 +0000 @@ -1188,6 +1188,12 @@ static int SB_read_DMA (void *opaque, in SB16State *s = opaque; int till, copy, written, free; + if (s->block_size <= 0) { + dolog ("invalid block size=%d nchan=%d dma_pos=%d dma_len=%d\n", + s->block_size, nchan, dma_pos, dma_len); + return dma_pos; + } + if (s->left_till_irq < 0) { s->left_till_irq = s->block_size; } @@ -1235,10 +1241,8 @@ static int SB_read_DMA (void *opaque, in s->block_size); #endif - if (s->block_size) { - while (s->left_till_irq <= 0) { - s->left_till_irq = s->block_size + s->left_till_irq; - } + while (s->left_till_irq <= 0) { + s->left_till_irq = s->block_size + s->left_till_irq; } return dma_pos; _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |