PIF RAM mutual DMA x64 breakpoints replaced with fast C

This commit is contained in:
unknown 2015-09-07 12:16:36 -04:00
parent 120d4d5590
commit 4a03a8d1e4
3 changed files with 15 additions and 53 deletions

View File

@ -40,7 +40,7 @@ CMipsMemoryVM::CMipsMemoryVM( CMipsMemory_CallBack * CallBack, bool SavesReadOnl
m_IMEM = NULL; m_IMEM = NULL;
} }
static unsigned long swap32by8(unsigned long word) unsigned long swap32by8(unsigned long word)
{ {
const unsigned long swapped = const unsigned long swapped =
#if defined(_MSC_VER) #if defined(_MSC_VER)

View File

@ -10,6 +10,8 @@
****************************************************************************/ ****************************************************************************/
#pragma once #pragma once
extern unsigned long swap32by8(unsigned long word);
class CMipsMemoryVM : class CMipsMemoryVM :
public CMipsMemory, public CMipsMemory,
public CTransVaddr, public CTransVaddr,

View File

@ -302,34 +302,14 @@ void CPifRam::SI_DMA_READ()
} }
else else
{ {
#ifdef _M_IX86 size_t i;
_asm
for (i = 0; i < 64; i += 4)
{ {
mov edi, dword ptr [SI_DRAM_ADDR_REG] *(unsigned __int32 *)&RDRAM[SI_DRAM_ADDR_REG + i] = swap32by8(
mov edi, dword ptr [edi] *(unsigned __int32 *)&PifRamPos[i]
add edi, RDRAM );
mov ecx, PifRamPos
mov edx, 0
memcpyloop:
mov eax, dword ptr [ecx + edx]
bswap eax
mov dword ptr [edi + edx],eax
mov eax, dword ptr [ecx + edx + 4]
bswap eax
mov dword ptr [edi + edx + 4],eax
mov eax, dword ptr [ecx + edx + 8]
bswap eax
mov dword ptr [edi + edx + 8],eax
mov eax, dword ptr [ecx + edx + 12]
bswap eax
mov dword ptr [edi + edx + 12],eax
add edx, 16
cmp edx, 64
jb memcpyloop
} }
#else
g_Notify->BreakPoint(__FILEW__,__LINE__);
#endif
} }
if (LogOptions.LogPRDMAMemStores) if (LogOptions.LogPRDMAMemStores)
@ -413,34 +393,14 @@ void CPifRam::SI_DMA_WRITE()
} }
else else
{ {
#ifdef _M_IX86 size_t i;
_asm
for (i = 0; i < 64; i += 4)
{ {
mov ecx, dword ptr [SI_DRAM_ADDR_REG] *(unsigned __int32 *)&PifRamPos[i] = swap32by8(
mov ecx, dword ptr [ecx] *(unsigned __int32 *)&RDRAM[SI_DRAM_ADDR_REG + i]
add ecx, RDRAM );
mov edi, PifRamPos
mov edx, 0
memcpyloop:
mov eax, dword ptr [ecx + edx]
bswap eax
mov dword ptr [edi + edx],eax
mov eax, dword ptr [ecx + edx + 4]
bswap eax
mov dword ptr [edi + edx + 4],eax
mov eax, dword ptr [ecx + edx + 8]
bswap eax
mov dword ptr [edi + edx + 8],eax
mov eax, dword ptr [ecx + edx + 12]
bswap eax
mov dword ptr [edi + edx + 12],eax
add edx, 16
cmp edx, 64
jb memcpyloop
} }
#else
g_Notify->BreakPoint(__FILEW__,__LINE__);
#endif
} }
if (LogOptions.LogPRDMAMemLoads) if (LogOptions.LogPRDMAMemLoads)