diff --git a/emulators/bochs/Makefile b/emulators/bochs/Makefile index 233700e6a56..b33af2b8525 100644 --- a/emulators/bochs/Makefile +++ b/emulators/bochs/Makefile @@ -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/} diff --git a/emulators/bochs/patches/patch-iodev_iodev_h b/emulators/bochs/patches/patch-iodev_iodev_h new file mode 100644 index 00000000000..28211c38795 --- /dev/null +++ b/emulators/bochs/patches/patch-iodev_iodev_h @@ -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; diff --git a/emulators/bochs/patches/patch-memory_memory_cc b/emulators/bochs/patches/patch-memory_memory_cc new file mode 100644 index 00000000000..07849553f7f --- /dev/null +++ b/emulators/bochs/patches/patch-memory_memory_cc @@ -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); ++ } ++} diff --git a/emulators/bochs/patches/patch-memory_memory_h b/emulators/bochs/patches/patch-memory_memory_h new file mode 100644 index 00000000000..85982d89dd2 --- /dev/null +++ b/emulators/bochs/patches/patch-memory_memory_h @@ -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)