Add a fix for a bus DMA bug

From Brad, thanks
This commit is contained in:
giovanni 2011-12-05 14:56:27 +00:00
parent 5fcf31f8d0
commit f5a4a37cbd
4 changed files with 58 additions and 1 deletions

View File

@ -1,8 +1,9 @@
# $OpenBSD: Makefile,v 1.52 2011/12/02 14:36:14 espie Exp $
# $OpenBSD: Makefile,v 1.53 2011/12/05 14:56:27 giovanni Exp $
COMMENT= x86 machine simulator
DISTNAME= bochs-2.5
REVISION= 1
CATEGORIES= emulators
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=bochs/}

View File

@ -0,0 +1,23 @@
$OpenBSD: patch-iodev_iodev_h,v 1.1 2011/12/05 14:56:27 giovanni Exp $
Fix for busmaster DMA transfers from device to memory
--- iodev/iodev.h.orig Thu Dec 1 04:31:04 2011
+++ iodev/iodev.h Thu Dec 1 04:32:51 2011
@@ -648,15 +648,10 @@ BX_CPP_INLINE void DEV_MEM_WRITE_PHYSICAL(bx_phy_addre
BX_CPP_INLINE void DEV_MEM_WRITE_PHYSICAL_BLOCK(bx_phy_address phy_addr, unsigned len, Bit8u *ptr)
{
- Bit8u *memptr;
-
while(len > 0) {
unsigned remainingInPage = 0x1000 - (phy_addr & 0xfff);
if (len < remainingInPage) remainingInPage = len;
- memptr = BX_MEM(0)->getHostMemAddr(NULL, phy_addr, BX_WRITE);
- if (memptr != NULL) {
- memcpy(memptr, ptr, remainingInPage);
- }
+ BX_MEM(0)->writePhysicalBlock(phy_addr, remainingInPage, ptr);
ptr += remainingInPage;
phy_addr += remainingInPage;
len -= remainingInPage;

View File

@ -0,0 +1,19 @@
$OpenBSD: patch-memory_memory_cc,v 1.3 2011/12/05 14:56:27 giovanni Exp $
Fix for busmaster DMA transfers from device to memory
--- memory/memory.cc.orig Thu Dec 1 04:34:02 2011
+++ memory/memory.cc Thu Dec 1 04:35:34 2011
@@ -365,3 +365,12 @@ inc_one:
}
}
}
+
+void BX_MEM_C::writePhysicalBlock(bx_phy_address addr, unsigned len, void *data)
+{
+ Bit8u *memptr = getHostMemAddr(NULL, addr, BX_WRITE);
+ if (memptr != NULL) {
+ pageWriteStampTable.decWriteStamp(addr);
+ memcpy(memptr, data, len);
+ }
+}

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-memory_memory_h,v 1.1 2011/12/05 14:56:27 giovanni Exp $
Fix for busmaster DMA transfers from device to memory
--- memory/memory.h.orig Thu Dec 1 04:34:13 2011
+++ memory/memory.h Thu Dec 1 04:34:53 2011
@@ -101,6 +101,7 @@ class BOCHSAPI BX_MEM_C : public logfunctions { (publi
unsigned len, void *data);
BX_MEM_SMF void writePhysicalPage(BX_CPU_C *cpu, bx_phy_address addr,
unsigned len, void *data);
+ BX_MEM_SMF void writePhysicalBlock(bx_phy_address addr, unsigned len, void *data);
BX_MEM_SMF void load_ROM(const char *path, bx_phy_address romaddress, Bit8u type);
BX_MEM_SMF void load_RAM(const char *path, bx_phy_address romaddress, Bit8u type);
#if (BX_DEBUGGER || BX_DISASM || BX_GDBSTUB)