[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] dma/rc4030: do multiple calls to address_space_rw w
From: |
Hervé Poussineau |
Subject: |
[Qemu-devel] [PATCH] dma/rc4030: do multiple calls to address_space_rw when doing DMA transfers |
Date: |
Thu, 11 Jun 2015 22:30:31 +0200 |
This workarounds a bug in memory management.
To reproduce the problem, try to start the Windows NT 4.0/MIPS installer.
After loading some files, you should see a screen saying
"To set up Windows NT now, press ENTER."
However, you're welcomed with an IRQL_NOT_LESS_OR_EQUAL bugcheck or an
Unknown Hard Error c0000221.
Signed-off-by: Hervé Poussineau <address@hidden>
---
hw/dma/rc4030.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/hw/dma/rc4030.c b/hw/dma/rc4030.c
index 3efa6de..d265d6c 100644
--- a/hw/dma/rc4030.c
+++ b/hw/dma/rc4030.c
@@ -681,6 +681,7 @@ static void rc4030_do_dma(void *opaque, int n, uint8_t
*buf, int len, int is_wri
rc4030State *s = opaque;
hwaddr dma_addr;
int dev_to_mem;
+ int i;
s->dma_regs[n][DMA_REG_ENABLE] &= ~(DMA_FLAG_TC_INTR | DMA_FLAG_MEM_INTR |
DMA_FLAG_ADDR_INTR);
@@ -699,8 +700,22 @@ static void rc4030_do_dma(void *opaque, int n, uint8_t
*buf, int len, int is_wri
dma_addr = s->dma_regs[n][DMA_REG_ADDRESS];
/* Read/write data at right place */
+#if 1 /* workaround for a bug in memory management */
+ for (i = 0; i < len; ) {
+ int ncpy = DMA_PAGESIZE - (dma_addr & (DMA_PAGESIZE - 1));
+ if (ncpy > len - i) {
+ ncpy = len - i;
+ }
+ address_space_rw(&s->dma_as, dma_addr, MEMTXATTRS_UNSPECIFIED,
+ buf + i, ncpy, is_write);
+
+ dma_addr += ncpy;
+ i += ncpy;
+ }
+#else
address_space_rw(&s->dma_as, dma_addr, MEMTXATTRS_UNSPECIFIED,
buf, len, is_write);
+#endif
s->dma_regs[n][DMA_REG_ENABLE] |= DMA_FLAG_TC_INTR;
s->dma_regs[n][DMA_REG_COUNT] -= len;
--
2.1.4
- [Qemu-devel] [PATCH] dma/rc4030: do multiple calls to address_space_rw when doing DMA transfers,
Hervé Poussineau <=
- Re: [Qemu-devel] [PATCH] dma/rc4030: do multiple calls to address_space_rw when doing DMA transfers, Aurelien Jarno, 2015/06/11
- Re: [Qemu-devel] [PATCH] dma/rc4030: do multiple calls to address_space_rw when doing DMA transfers, Hervé Poussineau, 2015/06/15
- Re: [Qemu-devel] [PATCH] dma/rc4030: do multiple calls to address_space_rw when doing DMA transfers, Aurelien Jarno, 2015/06/16
- Re: [Qemu-devel] [PATCH] dma/rc4030: do multiple calls to address_space_rw when doing DMA transfers, Paolo Bonzini, 2015/06/17
- Re: [Qemu-devel] [PATCH] dma/rc4030: do multiple calls to address_space_rw when doing DMA transfers, Paolo Bonzini, 2015/06/17
- Re: [Qemu-devel] [PATCH] dma/rc4030: do multiple calls to address_space_rw when doing DMA transfers, Hervé Poussineau, 2015/06/17
- Re: [Qemu-devel] [PATCH] dma/rc4030: do multiple calls to address_space_rw when doing DMA transfers, Paolo Bonzini, 2015/06/17