From: <vru...@us...> - 2011-11-30 17:11:54
|
Revision: 10811 http://bochs.svn.sourceforge.net/bochs/?rev=10811&view=rev Author: vruppert Date: 2011-11-30 17:11:43 +0000 (Wed, 30 Nov 2011) Log Message: ----------- - final fix for busmaster DMA transfers from device to memory: new memory method writePhysicalBlock() replaces the buggy code in iodev.h. Calling pageWriteStampTable.decWriteStamp(addr) is required here to make memcpy() work. Modified Paths: -------------- trunk/bochs/iodev/iodev.h trunk/bochs/memory/memory.cc trunk/bochs/memory/memory.h Modified: trunk/bochs/iodev/iodev.h =================================================================== --- trunk/bochs/iodev/iodev.h 2011-11-29 19:50:26 UTC (rev 10810) +++ trunk/bochs/iodev/iodev.h 2011-11-30 17:11:43 UTC (rev 10811) @@ -651,17 +651,7 @@ while(len > 0) { unsigned remainingInPage = 0x1000 - (phy_addr & 0xfff); if (len < remainingInPage) remainingInPage = len; - // FIXME: writePhysicalPage() should not copy a block > 8 bytes in - // reverse order on big endian hosts. With memcpy() it fails in some cases, - // but the reason is unknown. -#if BX_BIG_ENDIAN - Bit8u *memptr = BX_MEM(0)->getHostMemAddr(NULL, phy_addr, BX_WRITE); - if (memptr != NULL) { - memcpy(memptr, ptr, remainingInPage); - } -#else - BX_MEM(0)->writePhysicalPage(NULL, phy_addr, remainingInPage, ptr); -#endif + BX_MEM(0)->writePhysicalBlock(phy_addr, remainingInPage, ptr); ptr += remainingInPage; phy_addr += remainingInPage; len -= remainingInPage; Modified: trunk/bochs/memory/memory.cc =================================================================== --- trunk/bochs/memory/memory.cc 2011-11-29 19:50:26 UTC (rev 10810) +++ trunk/bochs/memory/memory.cc 2011-11-30 17:11:43 UTC (rev 10811) @@ -365,3 +365,12 @@ } } } + +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); + } +} Modified: trunk/bochs/memory/memory.h =================================================================== --- trunk/bochs/memory/memory.h 2011-11-29 19:50:26 UTC (rev 10810) +++ trunk/bochs/memory/memory.h 2011-11-30 17:11:43 UTC (rev 10811) @@ -101,6 +101,7 @@ 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) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |